3

我正在尝试创建一个持久类型,该类型的模型类似于:

MyModel
    something Text
    somethingElse [Int]

我得到一个错误:

非法类型构造函数或类名:`[Int]' 拼接 TH 声明时:data MyModel = MyModel {myModelSomething :: Text, myModelSomethingElse :: [Int]} deriving (Show, Read, Eq)

任何帮助表示赞赏。

4

1 回答 1

2

This is just a limitation of the Persistent syntax. To get around it, define a type synonym in your Haskell code (before the mkPersist call) like:

type Ints = [Int]

Then replace [Int] with Ints in your declaration, it should work.

于 2011-07-26T03:27:07.290 回答