[Haskell-cafe] Problem using Persistent

Debasish Ghosh ghosh.debasish at gmail.com
Fri Jan 17 17:29:19 UTC 2020


Hi -

I have an entity declaration in persistent as follows:

share [mkPersist sqlSettings { mpsGenerateLenses = True, mpsPrefixFields =
False }, mkMigrate "migrateAll"] [persistLowerCase|
    Account
        accountNo           Text
        accountType         AccountType
        accountHolderName   Text
        accountOpenDate     UTCTime default=CURRENT_TIME
        accountCloseDate    UTCTime Maybe default=NULL
        currentBalance      MoneyUSD
        rateOfInterest      Double
        Primary             accountNo
        deriving Show
|]

I am getting this compilation error ..

• No instance for (Generic (Key Account))
        arising from the 'deriving' clause of a data type declaration
      Possible fix:
        use a standalone 'deriving instance' declaration,
          so you can specify the instance context yourself
    • When deriving the instance for
(aeson-1.4.6.0:Data.Aeson.Types.ToJSON.ToJSON
                                        (Key Account))
   |
40 | share [mkPersist sqlSettings { mpsGenerateLenses = True,
mpsPrefixFields = False }, mkMigrate "migrateAll"] [persistLowerCase|
   |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...

and another exactly similar for FromJSON

What exactly is going wrong here ? I am not using json in the above
definition.

regards.
-- 
Debasish Ghosh
http://manning.com/ghosh2
http://manning.com/ghosh

Twttr: @debasishg
Blog: http://debasishg.blogspot.com
Code: http://github.com/debasishg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20200117/85f49635/attachment.html>


More information about the Haskell-Cafe mailing list