Commit c2e60027 authored by Iustin Pop's avatar Iustin Pop

Change how customFields are built

Instead of passing an expression (which cannot come from the current
module), we pass a name, which is allowed to reference functions from
the module we're in. Since we currently don't have custom fields, we
don't need to modify any callers.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarAgata Murawska <agatamurawska@google.com>
parent 0fc8e521
......@@ -110,9 +110,12 @@ containerField :: Field -> Field
containerField field = field { fieldIsContainer = True }
-- | Sets custom functions on a field.
customField :: Q Exp -> Q Exp -> Field -> Field
customField :: Name -- ^ The name of the read function
-> Name -- ^ The name of the show function
-> Field -- ^ The original field
-> Field -- ^ Updated field
customField readfn showfn field =
field { fieldRead = Just readfn, fieldShow = Just showfn }
field { fieldRead = Just (varE readfn), fieldShow = Just (varE showfn) }
fieldRecordName :: Field -> String
fieldRecordName (Field { fieldName = name, fieldConstr = alias }) =
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment