pringletons-0.4: Classes and data structures complementing the singletons library

Safe HaskellNone
LanguageHaskell2010

Data.Case.Enumerate

Synopsis

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.