Safe Haskell | None |
---|---|
Language | Haskell2010 |
Generate predicates from constructor names or from quoted patterns.
You must enable the TemplateHaskell
extension to use this module
From constructors
Given a constructor for type T
, is
generates a function of type
T -> Bool
.
The function evaluates its argument to WHNF, and returns
True
if the head constructor matches the given one, False
otherwise.
$(isNot 'Con) ≡ not . $(is 'Con)
>>>
$(is 'Just) (Just 5)
True>>>
$(isNot 'Left) (Left "a")
False