Open reygoch opened 6 years ago
This had me puzzled for a while! The Maybe
needs to be inside the UserID'
, like this:
type UserIDC = UserID' (Column PGInt4)
type UserIDM = UserID' (Maybe (Column PGInt4))
$(makeAdaptorAndInstance "pUserID" ''UserID')
type UserW = User'
(UserIDM)
(Column PGText)
type UserR = User'
(UserIDC)
(Column PGText)
Thanks for raising this issue. It should probably mentioned explicitly in the tutorial.
I've been following the tutorial where it is described how to make a typesafe primary key with newtype. Problem is that I can't use that to work with optional primary key.
I've used the following to add some semantics to my code for now:
But that is not very type safe so I've created the following type:
Which I than use like this:
But when I try to define my table:
I get the following error which I can't figure out: