Safe Haskell | None |
---|---|
Language | Haskell2010 |
Documentation
decons :: Name -> Q Exp Source
Generate a deconstructor that takes as input a value and returns Maybe
the deconstructed value.
This functions as a Data Constructor inverter. If the number of
parameters of a constructor is not equal to 1, Maybe
a tuple is returned.-- The result of this function is defined only when
Example:
$(decons 'Right) (Right "foo") :: Maybe String $(decons '(:)) "bar" :: Maybe (Char, String)