-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Generic pattern predicates -- -- Generate predicates of type (t → Bool) from constructors or patterns -- of type t. Uses either Template Haskell or instances of Generic or -- Typeable. Generating predicates from arbitrary patterns requires TH. @package is @version 0.4 module Data.Generics.Is.TH -- | Given a constructor (or pattern synonym) 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. -- --
--   >>> $(is 'Just) (Just 5)
--   True
--   
is :: Name -> Q Exp -- |
--   $(isNot 'Con) ≡ not . $(is 'Con)
--   
-- --
--   >>> $(isNot '(:)) [1,2,3]
--   False
--   
isNot :: Name -> Q Exp -- | Given a pattern for type T, isP generates a function -- of type T → Bool. -- -- The function returns True if the expression matches the -- pattern; a and False otherwise. -- --
--   $(isP [p| Con{} |]) ≡ $(is 'Con)
--   
-- --
--   >>> $(isP [p| Just{} |]) Nothing
--   False
--   
isP :: Q Pat -> Q Exp -- |
--   $(isNotP [p| P |]) ≡ not . $(isP [p| P |])
--   
isNotP :: Q Pat -> Q Exp -- | Generate predicates of the form isK -- --
--   >>> $(makePredicates ''E)
--   
--   >>> isPlus (Plus (Lit 1) (Lit 2))
--   True
--   
makePredicates :: Name -> Q [Dec] -- | Generate predicates of the form isNotK -- --
--   >>> $(makePredicatesNot ''E)
--   
--   >>> isNotAnd (Showable True)
--   True
--   
makePredicatesNot :: Name -> Q [Dec] -- | Generate predicates of both forms, isK and isNotK -- --
--   $(makePredicatesAll ''E) ≡ $(makePredicates ''E) ; $(makePredicatesNot ''E)
--   
makePredicatesAll :: Name -> Q [Dec] module Data.Generics.Is.Generic is :: forall c a. (Constructs c a, Generic a, EqHead (Rep a)) => c -> a -> Bool isNot :: forall c a. (Constructs c a, Generic a, EqHead (Rep a)) => c -> a -> Bool module Data.Generics.Is.Data is :: forall a b. (Constructs a b, Data b) => a -> b -> Bool isNot :: forall a b. (Constructs a b, Data b) => a -> b -> Bool -- | Deprecated: Import Data.Generics.Is.TH directly, or port -- your code to using Data.Generics.Is.Generic. module Data.Generics.Is