stack-prism-0.1: Stack prisms

Safe HaskellNone

Data.StackPrism.TH

Synopsis

Documentation

deriveStackPrisms :: Name -> Q [Dec]Source

Derive stack prisms for a given datatype.

For example:

 deriveStackPrisms ''Maybe

will create

 _Just :: StackPrism (a :- t) (Maybe a :- t)
 _Nothing :: StackPrism t (Nothing :- t)

together with their implementations.

deriveStackPrismsWith :: (String -> String) -> Name -> Q [Dec]Source

Derive stack prisms given a function that derives variable names from constructor names.

deriveStackPrismsFor :: [String] -> Name -> Q [Dec]Source

Derive stack prisms given a list of variable names, one for each constructor.