caseof-0.0.0: Combinators for casing on constructors

Safe HaskellNone
LanguageHaskell2010

CaseOf

Synopsis

Documentation

isCaseOf :: Name -> Q Exp Source #

Create a predicate that returns true if its argument is the given constructor.

maybeCaseOf :: Name -> Q Exp Source #

Return Just (x, y, ..) for the constructor C x y .., or Nothing.

caseOf :: Name -> Q Exp Source #

Call a function with arguments from the constructor if it matches, or pass it to the wildcard function.

nameAsValue :: Name -> Q Name Source #

Return the name if it is a value constructor, otherwise lookup a value name.