Closed ivan-m closed 7 years ago
I'll have to dig into this a bit, but there would seem to be an issue with GHC and/or GHCi. There may well also be an issue with postgresql-simple
.
Before I dig in, it may be worth pointing out that there's almost but not quite a ToRow
instance for Maybe String
: there is a ToRow
instance for lists, and ToRow
instances for some Maybe
types, though not for Maybe [...]
.
Even so, the issue should intuitively be a FromField
error. I'll have to dig in to it more at some point.
Ok, playing around with your example a bit with GHCi 7.10.2, as-is your example produces the same type error. However, using the default instance definitions by writing instance ToRow Claim
without deriving (ToRow)
works just fine.
Looking at the documentation for DeriveAnyClass
, I don't understand how this would be "correct" behavior on the part of GHC, because the documentation claims that those two alternative declarations should be equivalent. But clearly, in actuality they are not.
This has nothing to do with the Maybe
as it applies even if I remove it.
I've reported this to the GHC Trac.
I have a module that - stripped out of unnecessary fluff (that I tested was indeed irrelevant by commenting out) contains the following:
If I load this up in
cabal repl
then there's no problems; however, if I try tocabal build
it then I get the following error message:despite the fact that I can do this in the repl: