Hi,
busNum n | (isBusId n) = $(modify 'query) ($(set 'queryBusNumber) (Just n)) | otherwise = id
The solution I am using is creating for each record type @Rec@, and
each of its fields @fieldName :: T@ an updater
updateFieldName :: (T -> T) -> Rec -> Rec
This way you can write
busNum n
| (isBusId n) = updateQuery $ updateQueryBusNumber $ const (Just n)
| otherwise = id
The task of creating updaters can be automated using TH, this is what
the attached library does: all you need is to say
$(genUpdaters ''Opts)
$(genUpdaters ''Query)
Cheers,
Misha
RecordUpdate.tar.gz
Description: GNU Zip compressed data
_______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
