[Haskell-cafe] Filtering on data constructors with TH

Bulat Ziganshin bulat.ziganshin at gmail.com
Thu Jun 1 01:39:51 EDT 2006


Hello Christophe,

Thursday, June 1, 2006, 6:59:56 AM, you wrote:

> data Plop a b = Foo a | Bar b deriving Show
>   print $ filter isFoo l2

btw, DrIFT already have modules what implements this, along with
many other. it's a list of basic rules included in DrIFT:

standardRules = [("test",dattest, "Utility", "output raw data for testing", Nothing),
                  ("update",updatefn, "Utility","for label 'foo' provides 'foo_u' to update it and foo_s to set it", Nothing ),
                  ("is",isfn, "Utility", "provides isFoo for each constructor", Nothing),
                  ("get",getfn, "Utility", "for label 'foo' provide foo_g to get it", Nothing),
                  ("from",fromfn, "Utility", "provides fromFoo for each constructor", Nothing),
                  ("has",hasfn, "Utility", "hasfoo for record types", Nothing),
                  ("un",unfn, "Utility", "provides unFoo for unary constructors", Nothing),
                  ("NFData",nffn, "General","provides 'rnf' to reduce to normal form (deepSeq)", Nothing ),
                  ("Eq",eqfn, "Prelude","", Nothing),
                  ("Ord",ordfn, "Prelude", "", Nothing),
                  ("Enum",enumfn, "Prelude", "", Nothing),
                  ("Show",showfn, "Prelude", "", Nothing),
                  ("Read",readfn, "Prelude", "", Nothing),
                  ("Bounded",boundedfn, "Prelude", "", Nothing)]




-- 
Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com



More information about the Haskell-Cafe mailing list