FW: [Template-haskell] Records and generating splices
Rene de Visser
rene_de_visser at hotmail.com
Tue Jul 12 04:12:19 EDT 2005
>From: "Rene de Visser" <rene_de_visser at hotmail.com>
>test9 = [d| add_rel1 value = $(exp) value |] where
> exp = [| (\value -> modify (\db -> $(updater) db (Set.insert
>value (rel1 db)))) |] where
> updater = [|(\db value -> db{rel1 = value}) |]
> --updater = LamE [VarP db_2,VarP value_3] (RecUpdE (VarE db_2)
>[(DataBase.rel1,VarE value_3)]) where
> db_2 = mkName "db_2" ; value_3 = mkName "value_3"
Ok, I've found the error, that needs to be
updater = lamE [varP db_2,varP value_3] (recUpdE (varE db_2) [fieldExp
'DataBase.rel1 (varE value_3)])
Rene.
More information about the template-haskell
mailing list