Copyright  (c) 20102011 Patrick Bahr 

License  BSD3 
Maintainer  Patrick Bahr <paba@diku.dk> 
Stability  experimental 
Portability  nonportable (GHC Extensions) 
Safe Haskell  None 
Language  Haskell98 
This module contains functionality for automatically deriving boilerplate
code using Template Haskell. Examples include instances of Functor
,
Foldable
, and Traversable
.
Synopsis
 derive :: [Name > Q [Dec]] > [Name] > Q [Dec]
 class ShowF f where
 makeShowF :: Name > Q [Dec]
 class ShowConstr f where
 makeShowConstr :: Name > Q [Dec]
 class EqF f where
 makeEqF :: Name > Q [Dec]
 class EqF f => OrdF f where
 makeOrdF :: Name > Q [Dec]
 class Foldable (t :: * > *)
 makeFoldable :: Name > Q [Dec]
 class (Functor t, Foldable t) => Traversable (t :: * > *)
 makeTraversable :: Name > Q [Dec]
 makeHaskellStrict :: Name > Q [Dec]
 haskellStrict :: (Monad m, HaskellStrict f, f :<: (m :+: g)) => f (TermT m g) > TermT m g
 haskellStrict' :: (Monad m, HaskellStrict f, f :<: (m :+: g)) => f (TermT m g) > TermT m g
 class ArbitraryF f where
 makeArbitraryF :: Name > Q [Dec]
 class Arbitrary a where
 class NFData a where
 class NFDataF f where
 makeNFDataF :: Name > Q [Dec]
 smartConstructors :: Name > Q [Dec]
 smartAConstructors :: Name > Q [Dec]
 liftSum :: Name > Q [Dec]
Documentation
derive :: [Name > Q [Dec]] > [Name] > Q [Dec] Source #
Helper function for generating a list of instances for a list of named
signatures. For example, in order to derive instances Functor
and
ShowF
for a signature Exp
, use derive as follows (requires Template
Haskell):
$(derive [makeFunctor, makeShowF] [''Exp])
Derive boilerplate instances for compositional data type signatures.
ShowF
Signature printing. An instance ShowF f
gives rise to an instance
Show (Term f)
.
makeShowF :: Name > Q [Dec] Source #
Derive an instance of ShowF
for a type constructor of any firstorder kind
taking at least one argument.
class ShowConstr f where Source #
Constructor printing.
showConstr :: f a > String Source #
Instances
(ShowConstr f, Show p) => ShowConstr (f :&: p) Source #  
Defined in Data.Comp.Show showConstr :: (f :&: p) a > String Source #  
(ShowConstr f, ShowConstr g) => ShowConstr (f :+: g) Source #  
Defined in Data.Comp.Show showConstr :: (f :+: g) a > String Source # 
makeShowConstr :: Name > Q [Dec] Source #
Derive an instance of showConstr
for a type constructor of any firstorder kind
taking at least one argument.
EqF
Signature equality. An instance EqF f
gives rise to an instance
Eq (Term f)
.
Instances
EqF [] Source #  
EqF Maybe Source #  
Eq a => EqF ((,) a) Source #  
(Eq a, Eq b) => EqF ((,,) a b) Source #  
EqF f => EqF (Cxt h f) Source #  
(Eq a, Eq b, Eq c) => EqF ((,,,) a b c) Source #  
(EqF f, EqF g) => EqF (f :+: g) Source # 

(Eq a, Eq b, Eq c, Eq d) => EqF ((,,,,) a b c d) Source #  
(Eq a, Eq b, Eq c, Eq d, Eq e) => EqF ((,,,,,) a b c d e) Source #  
(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f) => EqF ((,,,,,,) a b c d e f) Source #  
(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g) => EqF ((,,,,,,,) a b c d e f g) Source #  
(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h) => EqF ((,,,,,,,,) a b c d e f g h) Source #  
(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i) => EqF ((,,,,,,,,,) a b c d e f g h i) Source #  
makeEqF :: Name > Q [Dec] Source #
Derive an instance of EqF
for a type constructor of any firstorder kind
taking at least one argument.
OrdF
class EqF f => OrdF f where Source #
Signature ordering. An instance OrdF f
gives rise to an instance
Ord (Term f)
.
Instances
OrdF [] Source #  
OrdF Maybe Source #  
Ord a => OrdF ((,) a) Source #  
(Ord a, Ord b) => OrdF ((,,) a b) Source #  
OrdF f => OrdF (Cxt h f) Source #  
(Ord a, Ord b, Ord c) => OrdF ((,,,) a b c) Source #  
(OrdF f, OrdF g) => OrdF (f :+: g) Source # 

(Ord a, Ord b, Ord c, Ord d) => OrdF ((,,,,) a b c d) Source #  
(Ord a, Ord b, Ord c, Ord d, Ord e) => OrdF ((,,,,,) a b c d e) Source #  
(Ord a, Ord b, Ord c, Ord d, Ord e, Ord f) => OrdF ((,,,,,,) a b c d e f) Source #  
(Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g) => OrdF ((,,,,,,,) a b c d e f g) Source #  
(Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h) => OrdF ((,,,,,,,,) a b c d e f g h) Source #  
(Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i) => OrdF ((,,,,,,,,,) a b c d e f g h i) Source #  
makeOrdF :: Name > Q [Dec] Source #
Derive an instance of OrdF
for a type constructor of any firstorder kind
taking at least one argument.
Foldable
class Foldable (t :: * > *) #
Data structures that can be folded.
For example, given a data type
data Tree a = Empty  Leaf a  Node (Tree a) a (Tree a)
a suitable instance would be
instance Foldable Tree where foldMap f Empty = mempty foldMap f (Leaf x) = f x foldMap f (Node l k r) = foldMap f l `mappend` f k `mappend` foldMap f r
This is suitable even for abstract types, as the monoid is assumed
to satisfy the monoid laws. Alternatively, one could define foldr
:
instance Foldable Tree where foldr f z Empty = z foldr f z (Leaf x) = f x z foldr f z (Node l k r) = foldr f (f k (foldr f z r)) l
Foldable
instances are expected to satisfy the following laws:
foldr f z t = appEndo (foldMap (Endo . f) t ) z
foldl f z t = appEndo (getDual (foldMap (Dual . Endo . flip f) t)) z
fold = foldMap id
length = getSum . foldMap (Sum . const 1)
sum
, product
, maximum
, and minimum
should all be essentially
equivalent to foldMap
forms, such as
sum = getSum . foldMap Sum
but may be less defined.
If the type is also a Functor
instance, it should satisfy
foldMap f = fold . fmap f
which implies that
foldMap f . fmap g = foldMap (f . g)
Instances
Foldable []  Since: base2.1 
Defined in Data.Foldable fold :: Monoid m => [m] > m # foldMap :: Monoid m => (a > m) > [a] > m # foldr :: (a > b > b) > b > [a] > b # foldr' :: (a > b > b) > b > [a] > b # foldl :: (b > a > b) > b > [a] > b # foldl' :: (b > a > b) > b > [a] > b # foldr1 :: (a > a > a) > [a] > a # foldl1 :: (a > a > a) > [a] > a # elem :: Eq a => a > [a] > Bool # maximum :: Ord a => [a] > a #  
Foldable Maybe  Since: base2.1 
Defined in Data.Foldable fold :: Monoid m => Maybe m > m # foldMap :: Monoid m => (a > m) > Maybe a > m # foldr :: (a > b > b) > b > Maybe a > b # foldr' :: (a > b > b) > b > Maybe a > b # foldl :: (b > a > b) > b > Maybe a > b # foldl' :: (b > a > b) > b > Maybe a > b # foldr1 :: (a > a > a) > Maybe a > a # foldl1 :: (a > a > a) > Maybe a > a # elem :: Eq a => a > Maybe a > Bool # maximum :: Ord a => Maybe a > a # minimum :: Ord a => Maybe a > a #  
Foldable Par1  
Defined in Data.Foldable fold :: Monoid m => Par1 m > m # foldMap :: Monoid m => (a > m) > Par1 a > m # foldr :: (a > b > b) > b > Par1 a > b # foldr' :: (a > b > b) > b > Par1 a > b # foldl :: (b > a > b) > b > Par1 a > b # foldl' :: (b > a > b) > b > Par1 a > b # foldr1 :: (a > a > a) > Par1 a > a # foldl1 :: (a > a > a) > Par1 a > a # elem :: Eq a => a > Par1 a > Bool # maximum :: Ord a => Par1 a > a #  
Foldable Complex  
Defined in Data.Complex fold :: Monoid m => Complex m > m # foldMap :: Monoid m => (a > m) > Complex a > m # foldr :: (a > b > b) > b > Complex a > b # foldr' :: (a > b > b) > b > Complex a > b # foldl :: (b > a > b) > b > Complex a > b # foldl' :: (b > a > b) > b > Complex a > b # foldr1 :: (a > a > a) > Complex a > a # foldl1 :: (a > a > a) > Complex a > a # elem :: Eq a => a > Complex a > Bool # maximum :: Ord a => Complex a > a # minimum :: Ord a => Complex a > a #  
Foldable Min  Since: base4.9.0.0 
Defined in Data.Semigroup fold :: Monoid m => Min m > m # foldMap :: Monoid m => (a > m) > Min a > m # foldr :: (a > b > b) > b > Min a > b # foldr' :: (a > b > b) > b > Min a > b # foldl :: (b > a > b) > b > Min a > b # foldl' :: (b > a > b) > b > Min a > b # foldr1 :: (a > a > a) > Min a > a # foldl1 :: (a > a > a) > Min a > a # elem :: Eq a => a > Min a > Bool # maximum :: Ord a => Min a > a #  
Foldable Max  Since: base4.9.0.0 
Defined in Data.Semigroup fold :: Monoid m => Max m > m # foldMap :: Monoid m => (a > m) > Max a > m # foldr :: (a > b > b) > b > Max a > b # foldr' :: (a > b > b) > b > Max a > b # foldl :: (b > a > b) > b > Max a > b # foldl' :: (b > a > b) > b > Max a > b # foldr1 :: (a > a > a) > Max a > a # foldl1 :: (a > a > a) > Max a > a # elem :: Eq a => a > Max a > Bool # maximum :: Ord a => Max a > a #  
Foldable First  Since: base4.9.0.0 
Defined in Data.Semigroup fold :: Monoid m => First m > m # foldMap :: Monoid m => (a > m) > First a > m # foldr :: (a > b > b) > b > First a > b # foldr' :: (a > b > b) > b > First a > b # foldl :: (b > a > b) > b > First a > b # foldl' :: (b > a > b) > b > First a > b # foldr1 :: (a > a > a) > First a > a # foldl1 :: (a > a > a) > First a > a # elem :: Eq a => a > First a > Bool # maximum :: Ord a => First a > a # minimum :: Ord a => First a > a #  
Foldable Last  Since: base4.9.0.0 
Defined in Data.Semigroup fold :: Monoid m => Last m > m # foldMap :: Monoid m => (a > m) > Last a > m # foldr :: (a > b > b) > b > Last a > b # foldr' :: (a > b > b) > b > Last a > b # foldl :: (b > a > b) > b > Last a > b # foldl' :: (b > a > b) > b > Last a > b # foldr1 :: (a > a > a) > Last a > a # foldl1 :: (a > a > a) > Last a > a # elem :: Eq a => a > Last a > Bool # maximum :: Ord a => Last a > a #  
Foldable Option  Since: base4.9.0.0 
Defined in Data.Semigroup fold :: Monoid m => Option m > m # foldMap :: Monoid m => (a > m) > Option a > m # foldr :: (a > b > b) > b > Option a > b # foldr' :: (a > b > b) > b > Option a > b # foldl :: (b > a > b) > b > Option a > b # foldl' :: (b > a > b) > b > Option a > b # foldr1 :: (a > a > a) > Option a > a # foldl1 :: (a > a > a) > Option a > a # elem :: Eq a => a > Option a > Bool # maximum :: Ord a => Option a > a # minimum :: Ord a => Option a > a #  
Foldable ZipList  
Defined in Control.Applicative fold :: Monoid m => ZipList m > m # foldMap :: Monoid m => (a > m) > ZipList a > m # foldr :: (a > b > b) > b > ZipList a > b # foldr' :: (a > b > b) > b > ZipList a > b # foldl :: (b > a > b) > b > ZipList a > b # foldl' :: (b > a > b) > b > ZipList a > b # foldr1 :: (a > a > a) > ZipList a > a # foldl1 :: (a > a > a) > ZipList a > a # elem :: Eq a => a > ZipList a > Bool # maximum :: Ord a => ZipList a > a # minimum :: Ord a => ZipList a > a #  
Foldable Identity  Since: base4.8.0.0 
Defined in Data.Functor.Identity fold :: Monoid m => Identity m > m # foldMap :: Monoid m => (a > m) > Identity a > m # foldr :: (a > b > b) > b > Identity a > b # foldr' :: (a > b > b) > b > Identity a > b # foldl :: (b > a > b) > b > Identity a > b # foldl' :: (b > a > b) > b > Identity a > b # foldr1 :: (a > a > a) > Identity a > a # foldl1 :: (a > a > a) > Identity a > a # elem :: Eq a => a > Identity a > Bool # maximum :: Ord a => Identity a > a # minimum :: Ord a => Identity a > a #  
Foldable First  Since: base4.8.0.0 
Defined in Data.Foldable fold :: Monoid m => First m > m # foldMap :: Monoid m => (a > m) > First a > m # foldr :: (a > b > b) > b > First a > b # foldr' :: (a > b > b) > b > First a > b # foldl :: (b > a > b) > b > First a > b # foldl' :: (b > a > b) > b > First a > b # foldr1 :: (a > a > a) > First a > a # foldl1 :: (a > a > a) > First a > a # elem :: Eq a => a > First a > Bool # maximum :: Ord a => First a > a # minimum :: Ord a => First a > a #  
Foldable Last  Since: base4.8.0.0 
Defined in Data.Foldable fold :: Monoid m => Last m > m # foldMap :: Monoid m => (a > m) > Last a > m # foldr :: (a > b > b) > b > Last a > b # foldr' :: (a > b > b) > b > Last a > b # foldl :: (b > a > b) > b > Last a > b # foldl' :: (b > a > b) > b > Last a > b # foldr1 :: (a > a > a) > Last a > a # foldl1 :: (a > a > a) > Last a > a # elem :: Eq a => a > Last a > Bool # maximum :: Ord a => Last a > a #  
Foldable Dual  Since: base4.8.0.0 
Defined in Data.Foldable fold :: Monoid m => Dual m > m # foldMap :: Monoid m => (a > m) > Dual a > m # foldr :: (a > b > b) > b > Dual a > b # foldr' :: (a > b > b) > b > Dual a > b # foldl :: (b > a > b) > b > Dual a > b # foldl' :: (b > a > b) > b > Dual a > b # foldr1 :: (a > a > a) > Dual a > a # foldl1 :: (a > a > a) > Dual a > a # elem :: Eq a => a > Dual a > Bool # maximum :: Ord a => Dual a > a #  
Foldable Sum  Since: base4.8.0.0 
Defined in Data.Foldable fold :: Monoid m => Sum m > m # foldMap :: Monoid m => (a > m) > Sum a > m # foldr :: (a > b > b) > b > Sum a > b # foldr' :: (a > b > b) > b > Sum a > b # foldl :: (b > a > b) > b > Sum a > b # foldl' :: (b > a > b) > b > Sum a > b # foldr1 :: (a > a > a) > Sum a > a # foldl1 :: (a > a > a) > Sum a > a # elem :: Eq a => a > Sum a > Bool # maximum :: Ord a => Sum a > a #  
Foldable Product  Since: base4.8.0.0 
Defined in Data.Foldable fold :: Monoid m => Product m > m # foldMap :: Monoid m => (a > m) > Product a > m # foldr :: (a > b > b) > b > Product a > b # foldr' :: (a > b > b) > b > Product a > b # foldl :: (b > a > b) > b > Product a > b # foldl' :: (b > a > b) > b > Product a > b # foldr1 :: (a > a > a) > Product a > a # foldl1 :: (a > a > a) > Product a > a # elem :: Eq a => a > Product a > Bool # maximum :: Ord a => Product a > a # minimum :: Ord a => Product a > a #  
Foldable NonEmpty  Since: base4.9.0.0 
Defined in Data.Foldable fold :: Monoid m => NonEmpty m > m # foldMap :: Monoid m => (a > m) > NonEmpty a > m # foldr :: (a > b > b) > b > NonEmpty a > b # foldr' :: (a > b > b) > b > NonEmpty a > b # foldl :: (b > a > b) > b > NonEmpty a > b # foldl' :: (b > a > b) > b > NonEmpty a > b # foldr1 :: (a > a > a) > NonEmpty a > a # foldl1 :: (a > a > a) > NonEmpty a > a # elem :: Eq a => a > NonEmpty a > Bool # maximum :: Ord a => NonEmpty a > a # minimum :: Ord a => NonEmpty a > a #  
Foldable IntMap  
Defined in Data.IntMap.Internal fold :: Monoid m => IntMap m > m # foldMap :: Monoid m => (a > m) > IntMap a > m # foldr :: (a > b > b) > b > IntMap a > b # foldr' :: (a > b > b) > b > IntMap a > b # foldl :: (b > a > b) > b > IntMap a > b # foldl' :: (b > a > b) > b > IntMap a > b # foldr1 :: (a > a > a) > IntMap a > a # foldl1 :: (a > a > a) > IntMap a > a # elem :: Eq a => a > IntMap a > Bool # maximum :: Ord a => IntMap a > a # minimum :: Ord a => IntMap a > a #  
Foldable Tree  
Defined in Data.Tree fold :: Monoid m => Tree m > m # foldMap :: Monoid m => (a > m) > Tree a > m # foldr :: (a > b > b) > b > Tree a > b # foldr' :: (a > b > b) > b > Tree a > b # foldl :: (b > a > b) > b > Tree a > b # foldl' :: (b > a > b) > b > Tree a > b # foldr1 :: (a > a > a) > Tree a > a # foldl1 :: (a > a > a) > Tree a > a # elem :: Eq a => a > Tree a > Bool # maximum :: Ord a => Tree a > a #  
Foldable Seq  
Defined in Data.Sequence.Internal fold :: Monoid m => Seq m > m # foldMap :: Monoid m => (a > m) > Seq a > m # foldr :: (a > b > b) > b > Seq a > b # foldr' :: (a > b > b) > b > Seq a > b # foldl :: (b > a > b) > b > Seq a > b # foldl' :: (b > a > b) > b > Seq a > b # foldr1 :: (a > a > a) > Seq a > a # foldl1 :: (a > a > a) > Seq a > a # elem :: Eq a => a > Seq a > Bool # maximum :: Ord a => Seq a > a #  
Foldable FingerTree  
Defined in Data.Sequence.Internal fold :: Monoid m => FingerTree m > m # foldMap :: Monoid m => (a > m) > FingerTree a > m # foldr :: (a > b > b) > b > FingerTree a > b # foldr' :: (a > b > b) > b > FingerTree a > b # foldl :: (b > a > b) > b > FingerTree a > b # foldl' :: (b > a > b) > b > FingerTree a > b # foldr1 :: (a > a > a) > FingerTree a > a # foldl1 :: (a > a > a) > FingerTree a > a # toList :: FingerTree a > [a] # null :: FingerTree a > Bool # length :: FingerTree a > Int # elem :: Eq a => a > FingerTree a > Bool # maximum :: Ord a => FingerTree a > a # minimum :: Ord a => FingerTree a > a # sum :: Num a => FingerTree a > a # product :: Num a => FingerTree a > a #  
Foldable Digit  
Defined in Data.Sequence.Internal fold :: Monoid m => Digit m > m # foldMap :: Monoid m => (a > m) > Digit a > m # foldr :: (a > b > b) > b > Digit a > b # foldr' :: (a > b > b) > b > Digit a > b # foldl :: (b > a > b) > b > Digit a > b # foldl' :: (b > a > b) > b > Digit a > b # foldr1 :: (a > a > a) > Digit a > a # foldl1 :: (a > a > a) > Digit a > a # elem :: Eq a => a > Digit a > Bool # maximum :: Ord a => Digit a > a # minimum :: Ord a => Digit a > a #  
Foldable Node  
Defined in Data.Sequence.Internal fold :: Monoid m => Node m > m # foldMap :: Monoid m => (a > m) > Node a > m # foldr :: (a > b > b) > b > Node a > b # foldr' :: (a > b > b) > b > Node a > b # foldl :: (b > a > b) > b > Node a > b # foldl' :: (b > a > b) > b > Node a > b # foldr1 :: (a > a > a) > Node a > a # foldl1 :: (a > a > a) > Node a > a # elem :: Eq a => a > Node a > Bool # maximum :: Ord a => Node a > a #  
Foldable Elem  
Defined in Data.Sequence.Internal fold :: Monoid m => Elem m > m # foldMap :: Monoid m => (a > m) > Elem a > m # foldr :: (a > b > b) > b > Elem a > b # foldr' :: (a > b > b) > b > Elem a > b # foldl :: (b > a > b) > b > Elem a > b # foldl' :: (b > a > b) > b > Elem a > b # foldr1 :: (a > a > a) > Elem a > a # foldl1 :: (a > a > a) > Elem a > a # elem :: Eq a => a > Elem a > Bool # maximum :: Ord a => Elem a > a #  
Foldable ViewL  
Defined in Data.Sequence.Internal fold :: Monoid m => ViewL m > m # foldMap :: Monoid m => (a > m) > ViewL a > m # foldr :: (a > b > b) > b > ViewL a > b # foldr' :: (a > b > b) > b > ViewL a > b # foldl :: (b > a > b) > b > ViewL a > b # foldl' :: (b > a > b) > b > ViewL a > b # foldr1 :: (a > a > a) > ViewL a > a # foldl1 :: (a > a > a) > ViewL a > a # elem :: Eq a => a > ViewL a > Bool # maximum :: Ord a => ViewL a > a # minimum :: Ord a => ViewL a > a #  
Foldable ViewR  
Defined in Data.Sequence.Internal fold :: Monoid m => ViewR m > m # foldMap :: Monoid m => (a > m) > ViewR a > m # foldr :: (a > b > b) > b > ViewR a > b # foldr' :: (a > b > b) > b > ViewR a > b # foldl :: (b > a > b) > b > ViewR a > b # foldl' :: (b > a > b) > b > ViewR a > b # foldr1 :: (a > a > a) > ViewR a > a # foldl1 :: (a > a > a) > ViewR a > a # elem :: Eq a => a > ViewR a > Bool # maximum :: Ord a => ViewR a > a # minimum :: Ord a => ViewR a > a #  
Foldable Set  
Defined in Data.Set.Internal fold :: Monoid m => Set m > m # foldMap :: Monoid m => (a > m) > Set a > m # foldr :: (a > b > b) > b > Set a > b # foldr' :: (a > b > b) > b > Set a > b # foldl :: (b > a > b) > b > Set a > b # foldl' :: (b > a > b) > b > Set a > b # foldr1 :: (a > a > a) > Set a > a # foldl1 :: (a > a > a) > Set a > a # elem :: Eq a => a > Set a > Bool # maximum :: Ord a => Set a > a #  
Foldable I #  
Defined in Data.Comp.Multi.HFunctor fold :: Monoid m => I m > m # foldMap :: Monoid m => (a > m) > I a > m # foldr :: (a > b > b) > b > I a > b # foldr' :: (a > b > b) > b > I a > b # foldl :: (b > a > b) > b > I a > b # foldl' :: (b > a > b) > b > I a > b # foldr1 :: (a > a > a) > I a > a # foldl1 :: (a > a > a) > I a > a # elem :: Eq a => a > I a > Bool # maximum :: Ord a => I a > a #  
Foldable (Either a)  Since: base4.7.0.0 
Defined in Data.Foldable fold :: Monoid m => Either a m > m # foldMap :: Monoid m => (a0 > m) > Either a a0 > m # foldr :: (a0 > b > b) > b > Either a a0 > b # foldr' :: (a0 > b > b) > b > Either a a0 > b # foldl :: (b > a0 > b) > b > Either a a0 > b # foldl' :: (b > a0 > b) > b > Either a a0 > b # foldr1 :: (a0 > a0 > a0) > Either a a0 > a0 # foldl1 :: (a0 > a0 > a0) > Either a a0 > a0 # toList :: Either a a0 > [a0] # length :: Either a a0 > Int # elem :: Eq a0 => a0 > Either a a0 > Bool # maximum :: Ord a0 => Either a a0 > a0 # minimum :: Ord a0 => Either a a0 > a0 #  
Foldable (V1 :: * > *)  
Defined in Data.Foldable fold :: Monoid m => V1 m > m # foldMap :: Monoid m => (a > m) > V1 a > m # foldr :: (a > b > b) > b > V1 a > b # foldr' :: (a > b > b) > b > V1 a > b # foldl :: (b > a > b) > b > V1 a > b # foldl' :: (b > a > b) > b > V1 a > b # foldr1 :: (a > a > a) > V1 a > a # foldl1 :: (a > a > a) > V1 a > a # elem :: Eq a => a > V1 a > Bool # maximum :: Ord a => V1 a > a #  
Foldable (U1 :: * > *)  Since: base4.9.0.0 
Defined in Data.Foldable fold :: Monoid m => U1 m > m # foldMap :: Monoid m => (a > m) > U1 a > m # foldr :: (a > b > b) > b > U1 a > b # foldr' :: (a > b > b) > b > U1 a > b # foldl :: (b > a > b) > b > U1 a > b # foldl' :: (b > a > b) > b > U1 a > b # foldr1 :: (a > a > a) > U1 a > a # foldl1 :: (a > a > a) > U1 a > a # elem :: Eq a => a > U1 a > Bool # maximum :: Ord a => U1 a > a #  
Foldable ((,) a)  Since: base4.7.0.0 
Defined in Data.Foldable fold :: Monoid m => (a, m) > m # foldMap :: Monoid m => (a0 > m) > (a, a0) > m # foldr :: (a0 > b > b) > b > (a, a0) > b # foldr' :: (a0 > b > b) > b > (a, a0) > b # foldl :: (b > a0 > b) > b > (a, a0) > b # foldl' :: (b > a0 > b) > b > (a, a0) > b # foldr1 :: (a0 > a0 > a0) > (a, a0) > a0 # foldl1 :: (a0 > a0 > a0) > (a, a0) > a0 # elem :: Eq a0 => a0 > (a, a0) > Bool # maximum :: Ord a0 => (a, a0) > a0 # minimum :: Ord a0 => (a, a0) > a0 #  
Foldable (Array i)  Since: base4.8.0.0 
Defined in Data.Foldable fold :: Monoid m => Array i m > m # foldMap :: Monoid m => (a > m) > Array i a > m # foldr :: (a > b > b) > b > Array i a > b # foldr' :: (a > b > b) > b > Array i a > b # foldl :: (b > a > b) > b > Array i a > b # foldl' :: (b > a > b) > b > Array i a > b # foldr1 :: (a > a > a) > Array i a > a # foldl1 :: (a > a > a) > Array i a > a # elem :: Eq a => a > Array i a > Bool # maximum :: Ord a => Array i a > a # minimum :: Ord a => Array i a > a #  
Foldable (Arg a)  Since: base4.9.0.0 
Defined in Data.Semigroup fold :: Monoid m => Arg a m > m # foldMap :: Monoid m => (a0 > m) > Arg a a0 > m # foldr :: (a0 > b > b) > b > Arg a a0 > b # foldr' :: (a0 > b > b) > b > Arg a a0 > b # foldl :: (b > a0 > b) > b > Arg a a0 > b # foldl' :: (b > a0 > b) > b > Arg a a0 > b # foldr1 :: (a0 > a0 > a0) > Arg a a0 > a0 # foldl1 :: (a0 > a0 > a0) > Arg a a0 > a0 # elem :: Eq a0 => a0 > Arg a a0 > Bool # maximum :: Ord a0 => Arg a a0 > a0 # minimum :: Ord a0 => Arg a a0 > a0 #  
Foldable (Proxy :: * > *)  Since: base4.7.0.0 
Defined in Data.Foldable fold :: Monoid m => Proxy m > m # foldMap :: Monoid m => (a > m) > Proxy a > m # foldr :: (a > b > b) > b > Proxy a > b # foldr' :: (a > b > b) > b > Proxy a > b # foldl :: (b > a > b) > b > Proxy a > b # foldl' :: (b > a > b) > b > Proxy a > b # foldr1 :: (a > a > a) > Proxy a > a # foldl1 :: (a > a > a) > Proxy a > a # elem :: Eq a => a > Proxy a > Bool # maximum :: Ord a => Proxy a > a # minimum :: Ord a => Proxy a > a #  
Foldable (Map k)  
Defined in Data.Map.Internal fold :: Monoid m => Map k m > m # foldMap :: Monoid m => (a > m) > Map k a > m # foldr :: (a > b > b) > b > Map k a > b # foldr' :: (a > b > b) > b > Map k a > b # foldl :: (b > a > b) > b > Map k a > b # foldl' :: (b > a > b) > b > Map k a > b # foldr1 :: (a > a > a) > Map k a > a # foldl1 :: (a > a > a) > Map k a > a # elem :: Eq a => a > Map k a > Bool # maximum :: Ord a => Map k a > a # minimum :: Ord a => Map k a > a #  
Foldable f => Foldable (ListT f)  
Defined in Control.Monad.Trans.List fold :: Monoid m => ListT f m > m # foldMap :: Monoid m => (a > m) > ListT f a > m # foldr :: (a > b > b) > b > ListT f a > b # foldr' :: (a > b > b) > b > ListT f a > b # foldl :: (b > a > b) > b > ListT f a > b # foldl' :: (b > a > b) > b > ListT f a > b # foldr1 :: (a > a > a) > ListT f a > a # foldl1 :: (a > a > a) > ListT f a > a # elem :: Eq a => a > ListT f a > Bool # maximum :: Ord a => ListT f a > a # minimum :: Ord a => ListT f a > a #  
Foldable f => Foldable (MaybeT f)  
Defined in Control.Monad.Trans.Maybe fold :: Monoid m => MaybeT f m > m # foldMap :: Monoid m => (a > m) > MaybeT f a > m # foldr :: (a > b > b) > b > MaybeT f a > b # foldr' :: (a > b > b) > b > MaybeT f a > b # foldl :: (b > a > b) > b > MaybeT f a > b # foldl' :: (b > a > b) > b > MaybeT f a > b # foldr1 :: (a > a > a) > MaybeT f a > a # foldl1 :: (a > a > a) > MaybeT f a > a # elem :: Eq a => a > MaybeT f a > Bool # maximum :: Ord a => MaybeT f a > a # minimum :: Ord a => MaybeT f a > a #  
Foldable (NumMap k) #  
Defined in Data.Comp.Mapping fold :: Monoid m => NumMap k m > m # foldMap :: Monoid m => (a > m) > NumMap k a > m # foldr :: (a > b > b) > b > NumMap k a > b # foldr' :: (a > b > b) > b > NumMap k a > b # foldl :: (b > a > b) > b > NumMap k a > b # foldl' :: (b > a > b) > b > NumMap k a > b # foldr1 :: (a > a > a) > NumMap k a > a # foldl1 :: (a > a > a) > NumMap k a > a # elem :: Eq a => a > NumMap k a > Bool # maximum :: Ord a => NumMap k a > a # minimum :: Ord a => NumMap k a > a #  
Foldable (K a) #  
Defined in Data.Comp.Multi.HFunctor fold :: Monoid m => K a m > m # foldMap :: Monoid m => (a0 > m) > K a a0 > m # foldr :: (a0 > b > b) > b > K a a0 > b # foldr' :: (a0 > b > b) > b > K a a0 > b # foldl :: (b > a0 > b) > b > K a a0 > b # foldl' :: (b > a0 > b) > b > K a a0 > b # foldr1 :: (a0 > a0 > a0) > K a a0 > a0 # foldl1 :: (a0 > a0 > a0) > K a a0 > a0 # elem :: Eq a0 => a0 > K a a0 > Bool # maximum :: Ord a0 => K a a0 > a0 # minimum :: Ord a0 => K a a0 > a0 #  
Foldable f => Foldable (Rec1 f)  
Defined in Data.Foldable fold :: Monoid m => Rec1 f m > m # foldMap :: Monoid m => (a > m) > Rec1 f a > m # foldr :: (a > b > b) > b > Rec1 f a > b # foldr' :: (a > b > b) > b > Rec1 f a > b # foldl :: (b > a > b) > b > Rec1 f a > b # foldl' :: (b > a > b) > b > Rec1 f a > b # foldr1 :: (a > a > a) > Rec1 f a > a # foldl1 :: (a > a > a) > Rec1 f a > a # elem :: Eq a => a > Rec1 f a > Bool # maximum :: Ord a => Rec1 f a > a # minimum :: Ord a => Rec1 f a > a #  
Foldable (URec Char :: * > *)  
Defined in Data.Foldable fold :: Monoid m => URec Char m > m # foldMap :: Monoid m => (a > m) > URec Char a > m # foldr :: (a > b > b) > b > URec Char a > b # foldr' :: (a > b > b) > b > URec Char a > b # foldl :: (b > a > b) > b > URec Char a > b # foldl' :: (b > a > b) > b > URec Char a > b # foldr1 :: (a > a > a) > URec Char a > a # foldl1 :: (a > a > a) > URec Char a > a # toList :: URec Char a > [a] # length :: URec Char a > Int # elem :: Eq a => a > URec Char a > Bool # maximum :: Ord a => URec Char a > a # minimum :: Ord a => URec Char a > a #  
Foldable (URec Double :: * > *)  
Defined in Data.Foldable fold :: Monoid m => URec Double m > m # foldMap :: Monoid m => (a > m) > URec Double a > m # foldr :: (a > b > b) > b > URec Double a > b # foldr' :: (a > b > b) > b > URec Double a > b # foldl :: (b > a > b) > b > URec Double a > b # foldl' :: (b > a > b) > b > URec Double a > b # foldr1 :: (a > a > a) > URec Double a > a # foldl1 :: (a > a > a) > URec Double a > a # toList :: URec Double a > [a] # null :: URec Double a > Bool # length :: URec Double a > Int # elem :: Eq a => a > URec Double a > Bool # maximum :: Ord a => URec Double a > a # minimum :: Ord a => URec Double a > a #  
Foldable (URec Float :: * > *)  
Defined in Data.Foldable fold :: Monoid m => URec Float m > m # foldMap :: Monoid m => (a > m) > URec Float a > m # foldr :: (a > b > b) > b > URec Float a > b # foldr' :: (a > b > b) > b > URec Float a > b # foldl :: (b > a > b) > b > URec Float a > b # foldl' :: (b > a > b) > b > URec Float a > b # foldr1 :: (a > a > a) > URec Float a > a # foldl1 :: (a > a > a) > URec Float a > a # toList :: URec Float a > [a] # null :: URec Float a > Bool # length :: URec Float a > Int # elem :: Eq a => a > URec Float a > Bool # maximum :: Ord a => URec Float a > a # minimum :: Ord a => URec Float a > a #  
Foldable (URec Int :: * > *)  
Defined in Data.Foldable fold :: Monoid m => URec Int m > m # foldMap :: Monoid m => (a > m) > URec Int a > m # foldr :: (a > b > b) > b > URec Int a > b # foldr' :: (a > b > b) > b > URec Int a > b # foldl :: (b > a > b) > b > URec Int a > b # foldl' :: (b > a > b) > b > URec Int a > b # foldr1 :: (a > a > a) > URec Int a > a # foldl1 :: (a > a > a) > URec Int a > a # elem :: Eq a => a > URec Int a > Bool # maximum :: Ord a => URec Int a > a # minimum :: Ord a => URec Int a > a #  
Foldable (URec Word :: * > *)  
Defined in Data.Foldable fold :: Monoid m => URec Word m > m # foldMap :: Monoid m => (a > m) > URec Word a > m # foldr :: (a > b > b) > b > URec Word a > b # foldr' :: (a > b > b) > b > URec Word a > b # foldl :: (b > a > b) > b > URec Word a > b # foldl' :: (b > a > b) > b > URec Word a > b # foldr1 :: (a > a > a) > URec Word a > a # foldl1 :: (a > a > a) > URec Word a > a # toList :: URec Word a > [a] # length :: URec Word a > Int # elem :: Eq a => a > URec Word a > Bool # maximum :: Ord a => URec Word a > a # minimum :: Ord a => URec Word a > a #  
Foldable (URec (Ptr ()) :: * > *)  
Defined in Data.Foldable fold :: Monoid m => URec (Ptr ()) m > m # foldMap :: Monoid m => (a > m) > URec (Ptr ()) a > m # foldr :: (a > b > b) > b > URec (Ptr ()) a > b # foldr' :: (a > b > b) > b > URec (Ptr ()) a > b # foldl :: (b > a > b) > b > URec (Ptr ()) a > b # foldl' :: (b > a > b) > b > URec (Ptr ()) a > b # foldr1 :: (a > a > a) > URec (Ptr ()) a > a # foldl1 :: (a > a > a) > URec (Ptr ()) a > a # toList :: URec (Ptr ()) a > [a] # null :: URec (Ptr ()) a > Bool # length :: URec (Ptr ()) a > Int # elem :: Eq a => a > URec (Ptr ()) a > Bool # maximum :: Ord a => URec (Ptr ()) a > a # minimum :: Ord a => URec (Ptr ()) a > a #  
Foldable (Const m :: * > *)  Since: base4.7.0.0 
Defined in Data.Functor.Const fold :: Monoid m0 => Const m m0 > m0 # foldMap :: Monoid m0 => (a > m0) > Const m a > m0 # foldr :: (a > b > b) > b > Const m a > b # foldr' :: (a > b > b) > b > Const m a > b # foldl :: (b > a > b) > b > Const m a > b # foldl' :: (b > a > b) > b > Const m a > b # foldr1 :: (a > a > a) > Const m a > a # foldl1 :: (a > a > a) > Const m a > a # elem :: Eq a => a > Const m a > Bool # maximum :: Ord a => Const m a > a # minimum :: Ord a => Const m a > a #  
Foldable f => Foldable (IdentityT f)  
Defined in Control.Monad.Trans.Identity fold :: Monoid m => IdentityT f m > m # foldMap :: Monoid m => (a > m) > IdentityT f a > m # foldr :: (a > b > b) > b > IdentityT f a > b # foldr' :: (a > b > b) > b > IdentityT f a > b # foldl :: (b > a > b) > b > IdentityT f a > b # foldl' :: (b > a > b) > b > IdentityT f a > b # foldr1 :: (a > a > a) > IdentityT f a > a # foldl1 :: (a > a > a) > IdentityT f a > a # toList :: IdentityT f a > [a] # null :: IdentityT f a > Bool # length :: IdentityT f a > Int # elem :: Eq a => a > IdentityT f a > Bool # maximum :: Ord a => IdentityT f a > a # minimum :: Ord a => IdentityT f a > a #  
Foldable f => Foldable (ErrorT e f)  
Defined in Control.Monad.Trans.Error fold :: Monoid m => ErrorT e f m > m # foldMap :: Monoid m => (a > m) > ErrorT e f a > m # foldr :: (a > b > b) > b > ErrorT e f a > b # foldr' :: (a > b > b) > b > ErrorT e f a > b # foldl :: (b > a > b) > b > ErrorT e f a > b # foldl' :: (b > a > b) > b > ErrorT e f a > b # foldr1 :: (a > a > a) > ErrorT e f a > a # foldl1 :: (a > a > a) > ErrorT e f a > a # toList :: ErrorT e f a > [a] # null :: ErrorT e f a > Bool # length :: ErrorT e f a > Int # elem :: Eq a => a > ErrorT e f a > Bool # maximum :: Ord a => ErrorT e f a > a # minimum :: Ord a => ErrorT e f a > a #  
Foldable f => Foldable (ExceptT e f)  
Defined in Control.Monad.Trans.Except fold :: Monoid m => ExceptT e f m > m # foldMap :: Monoid m => (a > m) > ExceptT e f a > m # foldr :: (a > b > b) > b > ExceptT e f a > b # foldr' :: (a > b > b) > b > ExceptT e f a > b # foldl :: (b > a > b) > b > ExceptT e f a > b # foldl' :: (b > a > b) > b > ExceptT e f a > b # foldr1 :: (a > a > a) > ExceptT e f a > a # foldl1 :: (a > a > a) > ExceptT e f a > a # toList :: ExceptT e f a > [a] # null :: ExceptT e f a > Bool # length :: ExceptT e f a > Int # elem :: Eq a => a > ExceptT e f a > Bool # maximum :: Ord a => ExceptT e f a > a # minimum :: Ord a => ExceptT e f a > a #  
Foldable f => Foldable (WriterT w f)  
Defined in Control.Monad.Trans.Writer.Lazy fold :: Monoid m => WriterT w f m > m # foldMap :: Monoid m => (a > m) > WriterT w f a > m # foldr :: (a > b > b) > b > WriterT w f a > b # foldr' :: (a > b > b) > b > WriterT w f a > b # foldl :: (b > a > b) > b > WriterT w f a > b # foldl' :: (b > a > b) > b > WriterT w f a > b # foldr1 :: (a > a > a) > WriterT w f a > a # foldl1 :: (a > a > a) > WriterT w f a > a # toList :: WriterT w f a > [a] # null :: WriterT w f a > Bool # length :: WriterT w f a > Int # elem :: Eq a => a > WriterT w f a > Bool # maximum :: Ord a => WriterT w f a > a # minimum :: Ord a => WriterT w f a > a #  
Foldable f => Foldable (WriterT w f)  
Defined in Control.Monad.Trans.Writer.Strict fold :: Monoid m => WriterT w f m > m # foldMap :: Monoid m => (a > m) > WriterT w f a > m # foldr :: (a > b > b) > b > WriterT w f a > b # foldr' :: (a > b > b) > b > WriterT w f a > b # foldl :: (b > a > b) > b > WriterT w f a > b # foldl' :: (b > a > b) > b > WriterT w f a > b # foldr1 :: (a > a > a) > WriterT w f a > a # foldl1 :: (a > a > a) > WriterT w f a > a # toList :: WriterT w f a > [a] # null :: WriterT w f a > Bool # length :: WriterT w f a > Int # elem :: Eq a => a > WriterT w f a > Bool # maximum :: Ord a => WriterT w f a > a # minimum :: Ord a => WriterT w f a > a #  
Foldable (Constant a :: * > *)  
Defined in Data.Functor.Constant fold :: Monoid m => Constant a m > m # foldMap :: Monoid m => (a0 > m) > Constant a a0 > m # foldr :: (a0 > b > b) > b > Constant a a0 > b # foldr' :: (a0 > b > b) > b > Constant a a0 > b # foldl :: (b > a0 > b) > b > Constant a a0 > b # foldl' :: (b > a0 > b) > b > Constant a a0 > b # foldr1 :: (a0 > a0 > a0) > Constant a a0 > a0 # foldl1 :: (a0 > a0 > a0) > Constant a a0 > a0 # toList :: Constant a a0 > [a0] # null :: Constant a a0 > Bool # length :: Constant a a0 > Int # elem :: Eq a0 => a0 > Constant a a0 > Bool # maximum :: Ord a0 => Constant a a0 > a0 # minimum :: Ord a0 => Constant a a0 > a0 #  
Foldable f => Foldable (Cxt h f) #  
Defined in Data.Comp.Term fold :: Monoid m => Cxt h f m > m # foldMap :: Monoid m => (a > m) > Cxt h f a > m # foldr :: (a > b > b) > b > Cxt h f a > b # foldr' :: (a > b > b) > b > Cxt h f a > b # foldl :: (b > a > b) > b > Cxt h f a > b # foldl' :: (b > a > b) > b > Cxt h f a > b # foldr1 :: (a > a > a) > Cxt h f a > a # foldl1 :: (a > a > a) > Cxt h f a > a # elem :: Eq a => a > Cxt h f a > Bool # maximum :: Ord a => Cxt h f a > a # minimum :: Ord a => Cxt h f a > a #  
Foldable (K1 i c :: * > *)  
Defined in Data.Foldable fold :: Monoid m => K1 i c m > m # foldMap :: Monoid m => (a > m) > K1 i c a > m # foldr :: (a > b > b) > b > K1 i c a > b # foldr' :: (a > b > b) > b > K1 i c a > b # foldl :: (b > a > b) > b > K1 i c a > b # foldl' :: (b > a > b) > b > K1 i c a > b # foldr1 :: (a > a > a) > K1 i c a > a # foldl1 :: (a > a > a) > K1 i c a > a # elem :: Eq a => a > K1 i c a > Bool # maximum :: Ord a => K1 i c a > a # minimum :: Ord a => K1 i c a > a #  
(Foldable f, Foldable g) => Foldable (f :+: g)  
Defined in Data.Foldable fold :: Monoid m => (f :+: g) m > m # foldMap :: Monoid m => (a > m) > (f :+: g) a > m # foldr :: (a > b > b) > b > (f :+: g) a > b # foldr' :: (a > b > b) > b > (f :+: g) a > b # foldl :: (b > a > b) > b > (f :+: g) a > b # foldl' :: (b > a > b) > b > (f :+: g) a > b # foldr1 :: (a > a > a) > (f :+: g) a > a # foldl1 :: (a > a > a) > (f :+: g) a > a # toList :: (f :+: g) a > [a] # length :: (f :+: g) a > Int # elem :: Eq a => a > (f :+: g) a > Bool # maximum :: Ord a => (f :+: g) a > a # minimum :: Ord a => (f :+: g) a > a #  
(Foldable f, Foldable g) => Foldable (f :*: g)  
Defined in Data.Foldable fold :: Monoid m => (f :*: g) m > m # foldMap :: Monoid m => (a > m) > (f :*: g) a > m # foldr :: (a > b > b) > b > (f :*: g) a > b # foldr' :: (a > b > b) > b > (f :*: g) a > b # foldl :: (b > a > b) > b > (f :*: g) a > b # foldl' :: (b > a > b) > b > (f :*: g) a > b # foldr1 :: (a > a > a) > (f :*: g) a > a # foldl1 :: (a > a > a) > (f :*: g) a > a # toList :: (f :*: g) a > [a] # length :: (f :*: g) a > Int # elem :: Eq a => a > (f :*: g) a > Bool # maximum :: Ord a => (f :*: g) a > a # minimum :: Ord a => (f :*: g) a > a #  
(Foldable f, Foldable g) => Foldable (Product f g)  Since: base4.9.0.0 
Defined in Data.Functor.Product fold :: Monoid m => Product f g m > m # foldMap :: Monoid m => (a > m) > Product f g a > m # foldr :: (a > b > b) > b > Product f g a > b # foldr' :: (a > b > b) > b > Product f g a > b # foldl :: (b > a > b) > b > Product f g a > b # foldl' :: (b > a > b) > b > Product f g a > b # foldr1 :: (a > a > a) > Product f g a > a # foldl1 :: (a > a > a) > Product f g a > a # toList :: Product f g a > [a] # null :: Product f g a > Bool # length :: Product f g a > Int # elem :: Eq a => a > Product f g a > Bool # maximum :: Ord a => Product f g a > a # minimum :: Ord a => Product f g a > a #  
(Foldable f, Foldable g) => Foldable (Sum f g)  Since: base4.9.0.0 
Defined in Data.Functor.Sum fold :: Monoid m => Sum f g m > m # foldMap :: Monoid m => (a > m) > Sum f g a > m # foldr :: (a > b > b) > b > Sum f g a > b # foldr' :: (a > b > b) > b > Sum f g a > b # foldl :: (b > a > b) > b > Sum f g a > b # foldl' :: (b > a > b) > b > Sum f g a > b # foldr1 :: (a > a > a) > Sum f g a > a # foldl1 :: (a > a > a) > Sum f g a > a # elem :: Eq a => a > Sum f g a > Bool # maximum :: Ord a => Sum f g a > a # minimum :: Ord a => Sum f g a > a #  
Foldable f => Foldable (f :&: a) #  
Defined in Data.Comp.Ops fold :: Monoid m => (f :&: a) m > m # foldMap :: Monoid m => (a0 > m) > (f :&: a) a0 > m # foldr :: (a0 > b > b) > b > (f :&: a) a0 > b # foldr' :: (a0 > b > b) > b > (f :&: a) a0 > b # foldl :: (b > a0 > b) > b > (f :&: a) a0 > b # foldl' :: (b > a0 > b) > b > (f :&: a) a0 > b # foldr1 :: (a0 > a0 > a0) > (f :&: a) a0 > a0 # foldl1 :: (a0 > a0 > a0) > (f :&: a) a0 > a0 # toList :: (f :&: a) a0 > [a0] # null :: (f :&: a) a0 > Bool # length :: (f :&: a) a0 > Int # elem :: Eq a0 => a0 > (f :&: a) a0 > Bool # maximum :: Ord a0 => (f :&: a) a0 > a0 # minimum :: Ord a0 => (f :&: a) a0 > a0 #  
(Foldable f, Foldable g) => Foldable (f :*: g) #  
Defined in Data.Comp.Ops fold :: Monoid m => (f :*: g) m > m # foldMap :: Monoid m => (a > m) > (f :*: g) a > m # foldr :: (a > b > b) > b > (f :*: g) a > b # foldr' :: (a > b > b) > b > (f :*: g) a > b # foldl :: (b > a > b) > b > (f :*: g) a > b # foldl' :: (b > a > b) > b > (f :*: g) a > b # foldr1 :: (a > a > a) > (f :*: g) a > a # foldl1 :: (a > a > a) > (f :*: g) a > a # toList :: (f :*: g) a > [a] # length :: (f :*: g) a > Int # elem :: Eq a => a > (f :*: g) a > Bool # maximum :: Ord a => (f :*: g) a > a # minimum :: Ord a => (f :*: g) a > a #  
(Foldable f, Foldable g) => Foldable (f :+: g) #  
Defined in Data.Comp.Ops fold :: Monoid m => (f :+: g) m > m # foldMap :: Monoid m => (a > m) > (f :+: g) a > m # foldr :: (a > b > b) > b > (f :+: g) a > b # foldr' :: (a > b > b) > b > (f :+: g) a > b # foldl :: (b > a > b) > b > (f :+: g) a > b # foldl' :: (b > a > b) > b > (f :+: g) a > b # foldr1 :: (a > a > a) > (f :+: g) a > a # foldl1 :: (a > a > a) > (f :+: g) a > a # toList :: (f :+: g) a > [a] # length :: (f :+: g) a > Int # elem :: Eq a => a > (f :+: g) a > Bool # maximum :: Ord a => (f :+: g) a > a # minimum :: Ord a => (f :+: g) a > a #  
Foldable f => Foldable (M1 i c f)  
Defined in Data.Foldable fold :: Monoid m => M1 i c f m > m # foldMap :: Monoid m => (a > m) > M1 i c f a > m # foldr :: (a > b > b) > b > M1 i c f a > b # foldr' :: (a > b > b) > b > M1 i c f a > b # foldl :: (b > a > b) > b > M1 i c f a > b # foldl' :: (b > a > b) > b > M1 i c f a > b # foldr1 :: (a > a > a) > M1 i c f a > a # foldl1 :: (a > a > a) > M1 i c f a > a # elem :: Eq a => a > M1 i c f a > Bool # maximum :: Ord a => M1 i c f a > a # minimum :: Ord a => M1 i c f a > a #  
(Foldable f, Foldable g) => Foldable (f :.: g)  
Defined in Data.Foldable fold :: Monoid m => (f :.: g) m > m # foldMap :: Monoid m => (a > m) > (f :.: g) a > m # foldr :: (a > b > b) > b > (f :.: g) a > b # foldr' :: (a > b > b) > b > (f :.: g) a > b # foldl :: (b > a > b) > b > (f :.: g) a > b # foldl' :: (b > a > b) > b > (f :.: g) a > b # foldr1 :: (a > a > a) > (f :.: g) a > a # foldl1 :: (a > a > a) > (f :.: g) a > a # toList :: (f :.: g) a > [a] # length :: (f :.: g) a > Int # elem :: Eq a => a > (f :.: g) a > Bool # maximum :: Ord a => (f :.: g) a > a # minimum :: Ord a => (f :.: g) a > a #  
(Foldable f, Foldable g) => Foldable (Compose f g)  Since: base4.9.0.0 
Defined in Data.Functor.Compose fold :: Monoid m => Compose f g m > m # foldMap :: Monoid m => (a > m) > Compose f g a > m # foldr :: (a > b > b) > b > Compose f g a > b # foldr' :: (a > b > b) > b > Compose f g a > b # foldl :: (b > a > b) > b > Compose f g a > b # foldl' :: (b > a > b) > b > Compose f g a > b # foldr1 :: (a > a > a) > Compose f g a > a # foldl1 :: (a > a > a) > Compose f g a > a # toList :: Compose f g a > [a] # null :: Compose f g a > Bool # length :: Compose f g a > Int # elem :: Eq a => a > Compose f g a > Bool # maximum :: Ord a => Compose f g a > a # minimum :: Ord a => Compose f g a > a # 
makeFoldable :: Name > Q [Dec] Source #
Derive an instance of Foldable
for a type constructor of any firstorder
kind taking at least one argument.
Traversable
class (Functor t, Foldable t) => Traversable (t :: * > *) #
Functors representing data structures that can be traversed from left to right.
A definition of traverse
must satisfy the following laws:
 naturality
t .
for every applicative transformationtraverse
f =traverse
(t . f)t
 identity
traverse
Identity = Identity composition
traverse
(Compose .fmap
g . f) = Compose .fmap
(traverse
g) .traverse
f
A definition of sequenceA
must satisfy the following laws:
 naturality
t .
for every applicative transformationsequenceA
=sequenceA
.fmap
tt
 identity
sequenceA
.fmap
Identity = Identity composition
sequenceA
.fmap
Compose = Compose .fmap
sequenceA
.sequenceA
where an applicative transformation is a function
t :: (Applicative f, Applicative g) => f a > g a
preserving the Applicative
operations, i.e.
and the identity functor Identity
and composition of functors Compose
are defined as
newtype Identity a = Identity a instance Functor Identity where fmap f (Identity x) = Identity (f x) instance Applicative Identity where pure x = Identity x Identity f <*> Identity x = Identity (f x) newtype Compose f g a = Compose (f (g a)) instance (Functor f, Functor g) => Functor (Compose f g) where fmap f (Compose x) = Compose (fmap (fmap f) x) instance (Applicative f, Applicative g) => Applicative (Compose f g) where pure x = Compose (pure (pure x)) Compose f <*> Compose x = Compose ((<*>) <$> f <*> x)
(The naturality law is implied by parametricity.)
Instances are similar to Functor
, e.g. given a data type
data Tree a = Empty  Leaf a  Node (Tree a) a (Tree a)
a suitable instance would be
instance Traversable Tree where traverse f Empty = pure Empty traverse f (Leaf x) = Leaf <$> f x traverse f (Node l k r) = Node <$> traverse f l <*> f k <*> traverse f r
This is suitable even for abstract types, as the laws for <*>
imply a form of associativity.
The superclass instances should satisfy the following:
 In the
Functor
instance,fmap
should be equivalent to traversal with the identity applicative functor (fmapDefault
).  In the
Foldable
instance,foldMap
should be equivalent to traversal with a constant applicative functor (foldMapDefault
).
Instances
makeTraversable :: Name > Q [Dec] Source #
Derive an instance of Traversable
for a type constructor of any
firstorder kind taking at least one argument.
HaskellStrict
makeHaskellStrict :: Name > Q [Dec] Source #
Derive an instance of HaskellStrict
for a type constructor of any
firstorder kind taking at least one argument.
haskellStrict' :: (Monad m, HaskellStrict f, f :<: (m :+: g)) => f (TermT m g) > TermT m g Source #
Arbitrary
class ArbitraryF f where Source #
Signature arbitration. An instance ArbitraryF f
gives rise to an instance
Arbitrary (Term f)
.
arbitraryF' :: Arbitrary v => [(Int, Gen (f v))] Source #
arbitraryF :: Arbitrary v => Gen (f v) Source #
Instances
makeArbitraryF :: Name > Q [Dec] Source #
Derive an instance of ArbitraryF
for a type constructor of any
firstorder kind taking at least one argument. It is necessary that
all types that are used by the data type definition are themselves
instances of Arbitrary
.
Random generation and shrinking of values.
QuickCheck provides Arbitrary
instances for most types in base
,
except those which incur extra dependencies.
For a wider range of Arbitrary
instances see the
quickcheckinstances
package.
A generator for values of the given type.
It is worth spending time thinking about what sort of test data
you want  good generators are often the difference between
finding bugs and not finding them. You can use sample
,
label
and classify
to check the quality of your test data.
There is no generic arbitrary
implementation included because we don't
know how to make a highquality one. If you want one, consider using the
testingfeat or
genericrandom packages.
The QuickCheck manual goes into detail on how to write good generators. Make sure to look at it, especially if your type is recursive!
Produces a (possibly) empty list of all the possible immediate shrinks of the given value.
The default implementation returns the empty list, so will not try to
shrink the value. If your data type has no special invariants, you can
enable shrinking by defining shrink =
, but by customising
the behaviour of genericShrink
shrink
you can often get simpler counterexamples.
Most implementations of shrink
should try at least three things:
 Shrink a term to any of its immediate subterms.
You can use
subterms
to do this.  Recursively apply
shrink
to all immediate subterms. You can userecursivelyShrink
to do this.  Typespecific shrinkings such as replacing a constructor by a simpler constructor.
For example, suppose we have the following implementation of binary trees:
data Tree a = Nil  Branch a (Tree a) (Tree a)
We can then define shrink
as follows:
shrink Nil = [] shrink (Branch x l r) =  shrink Branch to Nil [Nil] ++  shrink to subterms [l, r] ++  recursively shrink subterms [Branch x' l' r'  (x', l', r') < shrink (x, l, r)]
There are a couple of subtleties here:
 QuickCheck tries the shrinking candidates in the order they
appear in the list, so we put more aggressive shrinking steps
(such as replacing the whole tree by
Nil
) before smaller ones (such as recursively shrinking the subtrees).  It is tempting to write the last line as
[Branch x' l' r'  x' < shrink x, l' < shrink l, r' < shrink r]
but this is the wrong thing! It will force QuickCheck to shrinkx
,l
andr
in tandem, and shrinking will stop once one of the three is fully shrunk.
There is a fair bit of boilerplate in the code above.
We can avoid it with the help of some generic functions.
The function genericShrink
tries shrinking a term to all of its
subterms and, failing that, recursively shrinks the subterms.
Using it, we can define shrink
as:
shrink x = shrinkToNil x ++ genericShrink x where shrinkToNil Nil = [] shrinkToNil (Branch _ l r) = [Nil]
genericShrink
is a combination of subterms
, which shrinks
a term to any of its subterms, and recursivelyShrink
, which shrinks
all subterms of a term. These may be useful if you need a bit more
control over shrinking than genericShrink
gives you.
A final gotcha: we cannot define shrink
as simply
as this shrinks shrink
x = Nil:genericShrink
xNil
to Nil
, and shrinking will go into an
infinite loop.
If all this leaves you bewildered, you might try
to begin with,
after deriving shrink
= genericShrink
Generic
for your type. However, if your data type has any
special invariants, you will need to check that genericShrink
can't break those invariants.
Instances
A class of types that can be fully evaluated.
Since: deepseq1.1.0.0
rnf
should reduce its argument to normal form (that is, fully
evaluate all subcomponents), and then return '()'.
Generic
NFData
deriving
Starting with GHC 7.2, you can automatically derive instances
for types possessing a Generic
instance.
Note: Generic1
can be autoderived starting with GHC 7.4
{# LANGUAGE DeriveGeneric #} import GHC.Generics (Generic, Generic1) import Control.DeepSeq data Foo a = Foo a String deriving (Eq, Generic, Generic1) instance NFData a => NFData (Foo a) instance NFData1 Foo data Colour = Red  Green  Blue deriving Generic instance NFData Colour
Starting with GHC 7.10, the example above can be written more
concisely by enabling the new DeriveAnyClass
extension:
{# LANGUAGE DeriveGeneric, DeriveAnyClass #} import GHC.Generics (Generic) import Control.DeepSeq data Foo a = Foo a String deriving (Eq, Generic, Generic1, NFData, NFData1) data Colour = Red  Green  Blue deriving (Generic, NFData)
Compatibility with previous deepseq
versions
Prior to version 1.4.0.0, the default implementation of the rnf
method was defined as
rnf
a =seq
a ()
However, starting with deepseq1.4.0.0
, the default
implementation is based on DefaultSignatures
allowing for
more accurate autoderived NFData
instances. If you need the
previously used exact default rnf
method implementation
semantics, use
instance NFData Colour where rnf x = seq x ()
or alternatively
instance NFData Colour where rnf = rwhnf
or
{# LANGUAGE BangPatterns #} instance NFData Colour where rnf !_ = ()
Instances
NFData Bool  
Defined in Control.DeepSeq  
NFData Char  
Defined in Control.DeepSeq  
NFData Double  
Defined in Control.DeepSeq  
NFData Float  
Defined in Control.DeepSeq  
NFData Int  
Defined in Control.DeepSeq  
NFData Int8  
Defined in Control.DeepSeq  
NFData Int16  
Defined in Control.DeepSeq  
NFData Int32  
Defined in Control.DeepSeq  
NFData Int64  
Defined in Control.DeepSeq  
NFData Integer  
Defined in Control.DeepSeq  
NFData Natural  Since: deepseq1.4.0.0 
Defined in Control.DeepSeq  
NFData Ordering  
Defined in Control.DeepSeq  
NFData Word  
Defined in Control.DeepSeq  
NFData Word8  
Defined in Control.DeepSeq  
NFData Word16  
Defined in Control.DeepSeq  
NFData Word32  
Defined in Control.DeepSeq  
NFData Word64  
Defined in Control.DeepSeq  
NFData CallStack  Since: deepseq1.4.2.0 
Defined in Control.DeepSeq  
NFData ()  
Defined in Control.DeepSeq  
NFData TyCon  NOTE: Only defined for Since: deepseq1.4.0.0 
Defined in Control.DeepSeq  
NFData Version  Since: deepseq1.3.0.0 
Defined in Control.DeepSeq  
NFData Void  Since: deepseq1.4.0.0 
Defined in Control.DeepSeq  
NFData Unique  Since: deepseq1.4.0.0 
Defined in Control.DeepSeq  
NFData ThreadId  Since: deepseq1.4.0.0 
Defined in Control.DeepSeq  
NFData ExitCode  Since: deepseq1.4.2.0 
Defined in Control.DeepSeq  
NFData TypeRep  NOTE: Only defined for Since: deepseq1.4.0.0 
Defined in Control.DeepSeq  
NFData All  Since: deepseq1.4.0.0 
Defined in Control.DeepSeq  
NFData Any  Since: deepseq1.4.0.0 
Defined in Control.DeepSeq  
NFData CChar  Since: deepseq1.4.0.0 
Defined in Control.DeepSeq  
NFData CSChar  Since: deepseq1.4.0.0 
Defined in Control.DeepSeq  
NFData CUChar  Since: deepseq1.4.0.0 
Defined in Control.DeepSeq  
NFData CShort  Since: deepseq1.4.0.0 
Defined in Control.DeepSeq  
NFData CUShort  Since: deepseq1.4.0.0 
Defined in Control.DeepSeq  
NFData CInt  Since: deepseq1.4.0.0 
Defined in Control.DeepSeq  
NFData CUInt  Since: deepseq1.4.0.0 
Defined in Control.DeepSeq  
NFData CLong  Since: deepseq1.4.0.0 
Defined in Control.DeepSeq  
NFData CULong  Since: deepseq1.4.0.0 
Defined in Control.DeepSeq  
NFData CLLong  Since: deepseq1.4.0.0 
Defined in Control.DeepSeq  
NFData CULLong  Since: deepseq1.4.0.0 
Defined in Control.DeepSeq  
NFData CBool  Since: deepseq1.4.3.0 
Defined in Control.DeepSeq  
NFData CFloat  Since: deepseq1.4.0.0 
Defined in Control.DeepSeq  
NFData CDouble  Since: deepseq1.4.0.0 
Defined in Control.DeepSeq  
NFData CPtrdiff  Since: deepseq1.4.0.0 
Defined in Control.DeepSeq  
NFData CSize  Since: deepseq1.4.0.0 
Defined in Control.DeepSeq  
NFData CWchar  Since: deepseq1.4.0.0 
Defined in Control.DeepSeq  
NFData CSigAtomic  Since: deepseq1.4.0.0 
Defined in Control.DeepSeq rnf :: CSigAtomic > () #  
NFData CClock  Since: deepseq1.4.0.0 
Defined in Control.DeepSeq  
NFData CTime  Since: deepseq1.4.0.0 
Defined in Control.DeepSeq  
NFData CUSeconds  Since: deepseq1.4.0.0 
Defined in Control.DeepSeq  
NFData CSUSeconds  Since: deepseq1.4.0.0 
Defined in Control.DeepSeq rnf :: CSUSeconds > () #  
NFData CFile  Since: deepseq1.4.0.0 
Defined in Control.DeepSeq  
NFData CFpos  Since: deepseq1.4.0.0 
Defined in Control.DeepSeq  
NFData CJmpBuf  Since: deepseq1.4.0.0 
Defined in Control.DeepSeq  
NFData CIntPtr  Since: deepseq1.4.0.0 
Defined in Control.DeepSeq  
NFData CUIntPtr  Since: deepseq1.4.0.0 
Defined in Control.DeepSeq  
NFData CIntMax  Since: deepseq1.4.0.0 
Defined in Control.DeepSeq  
NFData CUIntMax  Since: deepseq1.4.0.0 
Defined in Control.DeepSeq  
NFData Fingerprint  Since: deepseq1.4.0.0 
Defined in Control.DeepSeq rnf :: Fingerprint > () #  
NFData SrcLoc  Since: deepseq1.4.2.0 
Defined in Control.DeepSeq  
NFData IntSet  
Defined in Data.IntSet.Internal  
NFData Doc  
Defined in Text.PrettyPrint.HughesPJ  
NFData TextDetails  
Defined in Text.PrettyPrint.Annotated.HughesPJ rnf :: TextDetails > () #  
NFData ZonedTime  
Defined in Data.Time.LocalTime.Internal.ZonedTime  
NFData LocalTime  
Defined in Data.Time.LocalTime.Internal.LocalTime  
NFData a => NFData [a]  
Defined in Control.DeepSeq  
NFData a => NFData (Maybe a)  
Defined in Control.DeepSeq  
NFData a => NFData (Ratio a)  
Defined in Control.DeepSeq  
NFData (Ptr a)  Since: deepseq1.4.2.0 
Defined in Control.DeepSeq  
NFData (FunPtr a)  Since: deepseq1.4.2.0 
Defined in Control.DeepSeq  
NFData a => NFData (Complex a)  
Defined in Control.DeepSeq  
NFData (Fixed a)  Since: deepseq1.3.0.0 
Defined in Control.DeepSeq  
NFData a => NFData (Min a)  Since: deepseq1.4.2.0 
Defined in Control.DeepSeq  
NFData a => NFData (Max a)  Since: deepseq1.4.2.0 
Defined in Control.DeepSeq  
NFData a => NFData (First a)  Since: deepseq1.4.2.0 
Defined in Control.DeepSeq  
NFData a => NFData (Last a)  Since: deepseq1.4.2.0 
Defined in Control.DeepSeq  
NFData m => NFData (WrappedMonoid m)  Since: deepseq1.4.2.0 
Defined in Control.DeepSeq rnf :: WrappedMonoid m > () #  
NFData a => NFData (Option a)  Since: deepseq1.4.2.0 
Defined in Control.DeepSeq  
NFData (StableName a)  Since: deepseq1.4.0.0 
Defined in Control.DeepSeq rnf :: StableName a > () #  
NFData a => NFData (ZipList a)  Since: deepseq1.4.0.0 
Defined in Control.DeepSeq  
NFData a => NFData (Identity a)  Since: deepseq1.4.0.0 
Defined in Control.DeepSeq  
NFData (IORef a)  NOTE: Only strict in the reference and not the referenced value. Since: deepseq1.4.2.0 
Defined in Control.DeepSeq  
NFData a => NFData (First a)  Since: deepseq1.4.0.0 
Defined in Control.DeepSeq  
NFData a => NFData (Last a)  Since: deepseq1.4.0.0 
Defined in Control.DeepSeq  
NFData a => NFData (Dual a)  Since: deepseq1.4.0.0 
Defined in Control.DeepSeq  
NFData a => NFData (Sum a)  Since: deepseq1.4.0.0 
Defined in Control.DeepSeq  
NFData a => NFData (Product a)  Since: deepseq1.4.0.0 
Defined in Control.DeepSeq  
NFData a => NFData (Down a)  Since: deepseq1.4.0.0 
Defined in Control.DeepSeq  
NFData (MVar a)  NOTE: Only strict in the reference and not the referenced value. Since: deepseq1.4.2.0 
Defined in Control.DeepSeq  
NFData a => NFData (NonEmpty a)  Since: deepseq1.4.2.0 
Defined in Control.DeepSeq  
NFData a => NFData (IntMap a)  
Defined in Data.IntMap.Internal  
NFData a => NFData (Tree a)  
NFData a => NFData (Seq a)  
Defined in Data.Sequence.Internal  
NFData a => NFData (FingerTree a)  
Defined in Data.Sequence.Internal rnf :: FingerTree a > () #  
NFData a => NFData (Digit a)  
Defined in Data.Sequence.Internal  
NFData a => NFData (Node a)  
Defined in Data.Sequence.Internal  
NFData a => NFData (Elem a)  
Defined in Data.Sequence.Internal  
NFData a => NFData (Set a)  
Defined in Data.Set.Internal  
NFData a => NFData (Doc a)  
Defined in Text.PrettyPrint.Annotated.HughesPJ  
NFData a => NFData (AnnotDetails a)  
Defined in Text.PrettyPrint.Annotated.HughesPJ rnf :: AnnotDetails a > () #  
NFData (a > b)  This instance is for convenience and consistency with Since: deepseq1.3.0.0 
Defined in Control.DeepSeq  
(NFData a, NFData b) => NFData (Either a b)  
Defined in Control.DeepSeq  
(NFData a, NFData b) => NFData (a, b)  
Defined in Control.DeepSeq  
(NFData a, NFData b) => NFData (Array a b)  
Defined in Control.DeepSeq  
(NFData a, NFData b) => NFData (Arg a b)  Since: deepseq1.4.2.0 
Defined in Control.DeepSeq  
NFData (Proxy a)  Since: deepseq1.4.0.0 
Defined in Control.DeepSeq  
NFData (STRef s a)  NOTE: Only strict in the reference and not the referenced value. Since: deepseq1.4.2.0 
Defined in Control.DeepSeq  
(NFData k, NFData a) => NFData (Map k a)  
Defined in Data.Map.Internal  
(NFData a1, NFData a2, NFData a3) => NFData (a1, a2, a3)  
Defined in Control.DeepSeq  
NFData a => NFData (Const a b)  Since: deepseq1.4.0.0 
Defined in Control.DeepSeq  
NFData (a :~: b)  Since: deepseq1.4.3.0 
Defined in Control.DeepSeq  
(NFDataF f, NFData a) => NFData (Cxt h f a) #  
Defined in Data.Comp.DeepSeq  
(NFData a1, NFData a2, NFData a3, NFData a4) => NFData (a1, a2, a3, a4)  
Defined in Control.DeepSeq  
(NFData1 f, NFData1 g, NFData a) => NFData (Product f g a)  Since: deepseq1.4.3.0 
Defined in Control.DeepSeq  
(NFData1 f, NFData1 g, NFData a) => NFData (Sum f g a)  Since: deepseq1.4.3.0 
Defined in Control.DeepSeq  
NFData (a :~~: b)  Since: deepseq1.4.3.0 
Defined in Control.DeepSeq  
(NFData a1, NFData a2, NFData a3, NFData a4, NFData a5) => NFData (a1, a2, a3, a4, a5)  
Defined in Control.DeepSeq  
(NFData1 f, NFData1 g, NFData a) => NFData (Compose f g a)  Since: deepseq1.4.3.0 
Defined in Control.DeepSeq  
(NFData a1, NFData a2, NFData a3, NFData a4, NFData a5, NFData a6) => NFData (a1, a2, a3, a4, a5, a6)  
Defined in Control.DeepSeq  
(NFData a1, NFData a2, NFData a3, NFData a4, NFData a5, NFData a6, NFData a7) => NFData (a1, a2, a3, a4, a5, a6, a7)  
Defined in Control.DeepSeq  
(NFData a1, NFData a2, NFData a3, NFData a4, NFData a5, NFData a6, NFData a7, NFData a8) => NFData (a1, a2, a3, a4, a5, a6, a7, a8)  
Defined in Control.DeepSeq  
(NFData a1, NFData a2, NFData a3, NFData a4, NFData a5, NFData a6, NFData a7, NFData a8, NFData a9) => NFData (a1, a2, a3, a4, a5, a6, a7, a8, a9)  
Defined in Control.DeepSeq 
DeepSeq
class NFDataF f where Source #
Signature normal form. An instance NFDataF f
gives rise to an instance
NFData (Term f)
.
makeNFDataF :: Name > Q [Dec] Source #
Derive an instance of NFDataF
for a type constructor of any firstorder
kind taking at least one argument.
Smart Constructors
smartConstructors :: Name > Q [Dec] Source #
Derive smart constructors for a type constructor of any firstorder kind
taking at least one argument. The smart constructors are similar to the
ordinary constructors, but an inject
is automatically inserted.
Smart Constructors w/ Annotations
smartAConstructors :: Name > Q [Dec] Source #
Derive smart constructors with products for a type constructor of any
parametric kind taking at least one argument. The smart constructors are
similar to the ordinary constructors, but an injectA
is automatically
inserted.