Fixed mkToForm
This commit is contained in:
parent
331b2049ff
commit
3affc81c52
@ -153,12 +153,11 @@ mkToForm = mapM derive
|
|||||||
nothing <- [|Nothing|]
|
nothing <- [|Nothing|]
|
||||||
let just' = just `AppE` ConE (mkName $ entityName t)
|
let just' = just `AppE` ConE (mkName $ entityName t)
|
||||||
string' <- [|string|]
|
string' <- [|string|]
|
||||||
mfx <- [|mapFormXml|]
|
|
||||||
ftt <- [|fieldsToTable|]
|
ftt <- [|fieldsToTable|]
|
||||||
ffs' <- [|FormFieldSettings|]
|
ffs' <- [|FormFieldSettings|]
|
||||||
let stm "" = nothing
|
let stm "" = nothing
|
||||||
stm x = just `AppE` LitE (StringL x)
|
stm x = just `AppE` LitE (StringL x)
|
||||||
let go_ = go ap just' ffs' stm string' mfx ftt
|
let go_ = go ap just' ffs' stm string' ftt
|
||||||
let c1 = Clause [ ConP (mkName "Nothing") []
|
let c1 = Clause [ ConP (mkName "Nothing") []
|
||||||
]
|
]
|
||||||
(NormalB $ go_ $ zip cols $ map (const nothing) cols)
|
(NormalB $ go_ $ zip cols $ map (const nothing) cols)
|
||||||
@ -178,9 +177,9 @@ mkToForm = mapM derive
|
|||||||
`AppT` ConT (mkName $ entityName t)
|
`AppT` ConT (mkName $ entityName t)
|
||||||
`AppT` VarT y)
|
`AppT` VarT y)
|
||||||
[FunD (mkName "toForm") [c1, c2]]
|
[FunD (mkName "toForm") [c1, c2]]
|
||||||
go ap just' ffs' stm string' mfx ftt a =
|
go ap just' ffs' stm string' ftt a =
|
||||||
let x = foldl (ap' ap) just' $ map (go' ffs' stm string') a
|
let x = foldl (ap' ap) just' $ map (go' ffs' stm string') a
|
||||||
in mfx `AppE` ftt `AppE` x
|
in ftt `AppE` x
|
||||||
go' ffs' stm string' (((theId, name), ((label, tooltip), tff)), ex) =
|
go' ffs' stm string' (((theId, name), ((label, tooltip), tff)), ex) =
|
||||||
let label' = string' `AppE` LitE (StringL label)
|
let label' = string' `AppE` LitE (StringL label)
|
||||||
tooltip' = string' `AppE` LitE (StringL tooltip)
|
tooltip' = string' `AppE` LitE (StringL tooltip)
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
name: yesod
|
name: yesod
|
||||||
version: 0.5.0
|
version: 0.5.0.1
|
||||||
license: BSD3
|
license: BSD3
|
||||||
license-file: LICENSE
|
license-file: LICENSE
|
||||||
author: Michael Snoyman <michael@snoyman.com>
|
author: Michael Snoyman <michael@snoyman.com>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user