3
votes

I am attempting to create a Persistent type that is modeled something like:

MyModel
    something Text
    somethingElse [Int]

and I get an error:

Illegal type constructor or class name: `[Int]' When splicing a TH declaration: data MyModel = MyModel {myModelSomething :: Text, myModelSomethingElse :: [Int]} deriving (Show, Read, Eq)

Any help is appreciated.

1
It would help if you included a minimal test-case for reproducing your error: the exact contents of a file + the command-line you use.Daniel Wagner

1 Answers

2
votes

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.