I'm trying to follow the Persistent tutorial, which has this code:
{-# LANGUAGE GADTs #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
import Database.Persist
import Database.Persist.TH
import Database.Persist.Sqlite
import Control.Monad.IO.Class (liftIO)
mkPersist sqlSettings [persistLowerCase|
Person
name String
age Int
deriving Show
|]
But when I try to run it, I get:
src/model.hs:31:1: error:
• Illegal instance declaration for ‘ToBackendKey SqlBackend Post’
(Only one type can be given in an instance head.
Use MultiParamTypeClasses if you want to allow more, or zero.)
• In the instance declaration for ‘ToBackendKey SqlBackend Post’
And those declarations (ToBackendKey etc) are not in my code, and not at line 31. What's going on? I have a feeling it's related to TemplateHaskell, but I don't know enough about it to figure this out. How can I debug this?