caseof-0.0.1: Combinators for casing on constructors

Safe HaskellNone
LanguageHaskell2010

CaseOf

Description

Template-Haskell-based combinators that let you select on constructors.

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.

mapCaseOf :: Name -> Q Exp Source #

Apply a function to the slots of a constructor, if it matches, otherwise identity.

caseOf :: Name -> Q Exp Source #

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