-
Notifications
You must be signed in to change notification settings - Fork 294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
persist
quasiquoters have dummy ID fields
#902
Comments
This is a bit tricky! "Why are we even doing this liftAndFixKey :: EntityMap -> FieldDef -> Q Exp
liftAndFixKey entMap (FieldDef a b c sqlTyp e f fieldRef mcomments) =
[|FieldDef a b c $(sqlTyp') e f fieldRef' mcomments|]
where
(fieldRef', sqlTyp') = fromMaybe (fieldRef, lift sqlTyp) $
case fieldRef of
ForeignRef refName _ft -> case M.lookup refName entMap of
Nothing ->
Nothing
Just ent ->
case fieldReference $ entityId ent of
fr@(ForeignRef _Name ft) ->
Just (fr, lift $ SqlTypeExp ft)
_ ->
Nothing
_ -> Nothing (That's
data SqlTypeExp = SqlTypeExp FieldType
| SqlType' SqlType
deriving Show
instance Lift SqlTypeExp where
lift (SqlType' t) = lift t
lift (SqlTypeExp ftype) = return st
where
typ = ftToType ftype
mtyp = (ConT ''Proxy `AppT` typ)
typedNothing = SigE (ConE 'Proxy) mtyp
st = VarE 'sqlType `AppE` typedNothing If we have a If we have a I have a (Maybe this is the wrong way around all this...) |
This is surfacing in the
persistent-documentation
library, where non-int64 keys are kept as dummyInt64
values.The library fixes this up in
liftAndFixKeys
, but this really ought to be fixed up before it gets out of the quasiquoter stage.The text was updated successfully, but these errors were encountered: