[Haskell-cafe] Help using Groundhog Template Haskell.
Andrew
asm198 at gmail.com
Fri Nov 8 14:09:25 UTC 2013
I seem to have worked around this by hand rolling instances
for TransactionType as below. I would still like to understand
how to make this work with mkPersist though.
instance G.PersistField TransactionType where
persistName _ = "TransactionType"
toPersistValues = GG.primToPersistValue
fromPersistValues = GG.primFromPersistValue
dbType _ = G.DbTypePrimitive G.DbString False Nothing Nothing
instance G.PrimitivePersistField TransactionType where
toPrimitivePersistValue _ a = G.PersistString (show a)
fromPrimitivePersistValue _ (G.PersistString s) = read s
fromPrimitivePersistValue _ _ = error "Expected PersistString"
More information about the Haskell-Cafe
mailing list