Safe Haskell | None |
---|---|
Language | Haskell2010 |
Documentation
enumerateConstructors :: Name -> Name -> Exp -> Q Exp Source #
This will create a pattern match on the first argument that splices in the third argument for each pattern. Example:
data Color = Red | Blue | Green deriving Show myFunc :: Color -> String myFunc c = $(enumerateConstructors 'c ''Color =<< [|show c|])
I should fix this function to actually make it work that way. It actually uses the singletonized data type instead.