Generics.Deriving.Foldable

generic-deriving-1.11: Generic programming library for generalised deriving.

Safe Haskell | Safe
Language | Haskell98

Generics.Deriving.Foldable

Contents

- Generic Foldable class
- Default method
- Derived functions
- Internal Foldable class

Synopsis

- class GFoldable t where
- gfoldMapdefault :: (Generic1 t, GFoldable' (Rep1 t), Monoid m) => (a -> m) -> t a -> m
- gtoList :: GFoldable t => t a -> [a]
- gconcat :: GFoldable t => t [a] -> [a]
- gconcatMap :: GFoldable t => (a -> [b]) -> t a -> [b]
- gand :: GFoldable t => t Bool -> Bool
- gor :: GFoldable t => t Bool -> Bool
- gany :: GFoldable t => (a -> Bool) -> t a -> Bool
- gall :: GFoldable t => (a -> Bool) -> t a -> Bool
- gsum :: (GFoldable t, Num a) => t a -> a
- gproduct :: (GFoldable t, Num a) => t a -> a
- gmaximum :: (GFoldable t, Ord a) => t a -> a
- gmaximumBy :: GFoldable t => (a -> a -> Ordering) -> t a -> a
- gminimum :: (GFoldable t, Ord a) => t a -> a
- gminimumBy :: GFoldable t => (a -> a -> Ordering) -> t a -> a
- gelem :: (GFoldable t, Eq a) => a -> t a -> Bool
- gnotElem :: (GFoldable t, Eq a) => a -> t a -> Bool
- gfind :: GFoldable t => (a -> Bool) -> t a -> Maybe a
- class GFoldable' t where

# Generic Foldable class

class GFoldable t where #

Methods

gfoldMap :: Monoid m => (a -> m) -> t a -> m #

gfoldMap :: (Generic1 t, GFoldable' (Rep1 t), Monoid m) => (a -> m) -> t a -> m #

gfold :: Monoid m => t m -> m #

gfoldr :: (a -> b -> b) -> b -> t a -> b #

gfoldr' :: (a -> b -> b) -> b -> t a -> b #

gfoldl :: (a -> b -> a) -> a -> t b -> a #

gfoldl' :: (a -> b -> a) -> a -> t b -> a #

gfoldr1 :: (a -> a -> a) -> t a -> a #

gfoldl1 :: (a -> a -> a) -> t a -> a #

Instances

GFoldable [] # |
Methods gfoldMap :: Monoid m => (a -> m) -> [a] -> m # gfold :: Monoid m => [m] -> m # gfoldr :: (a -> b -> b) -> b -> [a] -> b # gfoldr' :: (a -> b -> b) -> b -> [a] -> b # gfoldl :: (a -> b -> a) -> a -> [b] -> a # gfoldl' :: (a -> b -> a) -> a -> [b] -> a # gfoldr1 :: (a -> a -> a) -> [a] -> a # gfoldl1 :: (a -> a -> a) -> [a] -> a #
GFoldable Maybe # |
Methods gfoldMap :: Monoid m => (a -> m) -> Maybe a -> m # gfold :: Monoid m => Maybe m -> m # gfoldr :: (a -> b -> b) -> b -> Maybe a -> b # gfoldr' :: (a -> b -> b) -> b -> Maybe a -> b # gfoldl :: (a -> b -> a) -> a -> Maybe b -> a # gfoldl' :: (a -> b -> a) -> a -> Maybe b -> a # gfoldr1 :: (a -> a -> a) -> Maybe a -> a # gfoldl1 :: (a -> a -> a) -> Maybe a -> a #
GFoldable Identity # |
Methods gfoldMap :: Monoid m => (a -> m) -> Identity a -> m # gfold :: Monoid m => Identity m -> m # gfoldr :: (a -> b -> b) -> b -> Identity a -> b # gfoldr' :: (a -> b -> b) -> b -> Identity a -> b # gfoldl :: (a -> b -> a) -> a -> Identity b -> a # gfoldl' :: (a -> b -> a) -> a -> Identity b -> a # gfoldr1 :: (a -> a -> a) -> Identity a -> a # gfoldl1 :: (a -> a -> a) -> Identity a -> a #
GFoldable Min # |
Methods gfoldMap :: Monoid m => (a -> m) -> Min a -> m # gfold :: Monoid m => Min m -> m # gfoldr :: (a -> b -> b) -> b -> Min a -> b # gfoldr' :: (a -> b -> b) -> b -> Min a -> b # gfoldl :: (a -> b -> a) -> a -> Min b -> a # gfoldl' :: (a -> b -> a) -> a -> Min b -> a # gfoldr1 :: (a -> a -> a) -> Min a -> a # gfoldl1 :: (a -> a -> a) -> Min a -> a #
GFoldable Max # |
Methods gfoldMap :: Monoid m => (a -> m) -> Max a -> m # gfold :: Monoid m => Max m -> m # gfoldr :: (a -> b -> b) -> b -> Max a -> b # gfoldr' :: (a -> b -> b) -> b -> Max a -> b # gfoldl :: (a -> b -> a) -> a -> Max b -> a # gfoldl' :: (a -> b -> a) -> a -> Max b -> a # gfoldr1 :: (a -> a -> a) -> Max a -> a # gfoldl1 :: (a -> a -> a) -> Max a -> a #
GFoldable First # |
Methods gfoldMap :: Monoid m => (a -> m) -> First a -> m # gfold :: Monoid m => First m -> m # gfoldr :: (a -> b -> b) -> b -> First a -> b # gfoldr' :: (a -> b -> b) -> b -> First a -> b # gfoldl :: (a -> b -> a) -> a -> First b -> a # gfoldl' :: (a -> b -> a) -> a -> First b -> a # gfoldr1 :: (a -> a -> a) -> First a -> a # gfoldl1 :: (a -> a -> a) -> First a -> a #
GFoldable Last # |
Methods gfoldMap :: Monoid m => (a -> m) -> Last a -> m # gfold :: Monoid m => Last m -> m # gfoldr :: (a -> b -> b) -> b -> Last a -> b # gfoldr' :: (a -> b -> b) -> b -> Last a -> b # gfoldl :: (a -> b -> a) -> a -> Last b -> a # gfoldl' :: (a -> b -> a) -> a -> Last b -> a # gfoldr1 :: (a -> a -> a) -> Last a -> a # gfoldl1 :: (a -> a -> a) -> Last a -> a #
GFoldable WrappedMonoid # |
Methods gfoldMap :: Monoid m => (a -> m) -> WrappedMonoid a -> m # gfold :: Monoid m => WrappedMonoid m -> m # gfoldr :: (a -> b -> b) -> b -> WrappedMonoid a -> b # gfoldr' :: (a -> b -> b) -> b -> WrappedMonoid a -> b # gfoldl :: (a -> b -> a) -> a -> WrappedMonoid b -> a # gfoldl' :: (a -> b -> a) -> a -> WrappedMonoid b -> a # gfoldr1 :: (a -> a -> a) -> WrappedMonoid a -> a # gfoldl1 :: (a -> a -> a) -> WrappedMonoid a -> a #
GFoldable Option # |
Methods gfoldMap :: Monoid m => (a -> m) -> Option a -> m # gfold :: Monoid m => Option m -> m # gfoldr :: (a -> b -> b) -> b -> Option a -> b # gfoldr' :: (a -> b -> b) -> b -> Option a -> b # gfoldl :: (a -> b -> a) -> a -> Option b -> a # gfoldl' :: (a -> b -> a) -> a -> Option b -> a # gfoldr1 :: (a -> a -> a) -> Option a -> a # gfoldl1 :: (a -> a -> a) -> Option a -> a #
GFoldable NonEmpty # |
Methods gfoldMap :: Monoid m => (a -> m) -> NonEmpty a -> m # gfold :: Monoid m => NonEmpty m -> m # gfoldr :: (a -> b -> b) -> b -> NonEmpty a -> b # gfoldr' :: (a -> b -> b) -> b -> NonEmpty a -> b # gfoldl :: (a -> b -> a) -> a -> NonEmpty b -> a # gfoldl' :: (a -> b -> a) -> a -> NonEmpty b -> a # gfoldr1 :: (a -> a -> a) -> NonEmpty a -> a # gfoldl1 :: (a -> a -> a) -> NonEmpty a -> a #
GFoldable Complex # |
Methods gfoldMap :: Monoid m => (a -> m) -> Complex a -> m # gfold :: Monoid m => Complex m -> m # gfoldr :: (a -> b -> b) -> b -> Complex a -> b # gfoldr' :: (a -> b -> b) -> b -> Complex a -> b # gfoldl :: (a -> b -> a) -> a -> Complex b -> a # gfoldl' :: (a -> b -> a) -> a -> Complex b -> a # gfoldr1 :: (a -> a -> a) -> Complex a -> a # gfoldl1 :: (a -> a -> a) -> Complex a -> a #
GFoldable ZipList # |
Methods gfoldMap :: Monoid m => (a -> m) -> ZipList a -> m # gfold :: Monoid m => ZipList m -> m # gfoldr :: (a -> b -> b) -> b -> ZipList a -> b # gfoldr' :: (a -> b -> b) -> b -> ZipList a -> b # gfoldl :: (a -> b -> a) -> a -> ZipList b -> a # gfoldl' :: (a -> b -> a) -> a -> ZipList b -> a # gfoldr1 :: (a -> a -> a) -> ZipList a -> a # gfoldl1 :: (a -> a -> a) -> ZipList a -> a #
GFoldable Dual # |
Methods gfoldMap :: Monoid m => (a -> m) -> Dual a -> m # gfold :: Monoid m => Dual m -> m # gfoldr :: (a -> b -> b) -> b -> Dual a -> b # gfoldr' :: (a -> b -> b) -> b -> Dual a -> b # gfoldl :: (a -> b -> a) -> a -> Dual b -> a # gfoldl' :: (a -> b -> a) -> a -> Dual b -> a # gfoldr1 :: (a -> a -> a) -> Dual a -> a # gfoldl1 :: (a -> a -> a) -> Dual a -> a #
GFoldable Sum # |
Methods gfoldMap :: Monoid m => (a -> m) -> Sum a -> m # gfold :: Monoid m => Sum m -> m # gfoldr :: (a -> b -> b) -> b -> Sum a -> b # gfoldr' :: (a -> b -> b) -> b -> Sum a -> b # gfoldl :: (a -> b -> a) -> a -> Sum b -> a # gfoldl' :: (a -> b -> a) -> a -> Sum b -> a # gfoldr1 :: (a -> a -> a) -> Sum a -> a # gfoldl1 :: (a -> a -> a) -> Sum a -> a #
GFoldable Product # |
Methods gfoldMap :: Monoid m => (a -> m) -> Product a -> m # gfold :: Monoid m => Product m -> m # gfoldr :: (a -> b -> b) -> b -> Product a -> b # gfoldr' :: (a -> b -> b) -> b -> Product a -> b # gfoldl :: (a -> b -> a) -> a -> Product b -> a # gfoldl' :: (a -> b -> a) -> a -> Product b -> a # gfoldr1 :: (a -> a -> a) -> Product a -> a # gfoldl1 :: (a -> a -> a) -> Product a -> a #
GFoldable First # |
Methods gfoldMap :: Monoid m => (a -> m) -> First a -> m # gfold :: Monoid m => First m -> m # gfoldr :: (a -> b -> b) -> b -> First a -> b # gfoldr' :: (a -> b -> b) -> b -> First a -> b # gfoldl :: (a -> b -> a) -> a -> First b -> a # gfoldl' :: (a -> b -> a) -> a -> First b -> a # gfoldr1 :: (a -> a -> a) -> First a -> a # gfoldl1 :: (a -> a -> a) -> First a -> a #
GFoldable Last # |
Methods gfoldMap :: Monoid m => (a -> m) -> Last a -> m # gfold :: Monoid m => Last m -> m # gfoldr :: (a -> b -> b) -> b -> Last a -> b # gfoldr' :: (a -> b -> b) -> b -> Last a -> b # gfoldl :: (a -> b -> a) -> a -> Last b -> a # gfoldl' :: (a -> b -> a) -> a -> Last b -> a # gfoldr1 :: (a -> a -> a) -> Last a -> a # gfoldl1 :: (a -> a -> a) -> Last a -> a #
GFoldable (Either a) # |
Methods gfoldMap :: Monoid m => (a -> m) -> Either a a -> m # gfold :: Monoid m => Either a m -> m # gfoldr :: (a -> b -> b) -> b -> Either a a -> b # gfoldr' :: (a -> b -> b) -> b -> Either a a -> b # gfoldl :: (a -> b -> a) -> a -> Either a b -> a # gfoldl' :: (a -> b -> a) -> a -> Either a b -> a # gfoldr1 :: (a -> a -> a) -> Either a a -> a # gfoldl1 :: (a -> a -> a) -> Either a a -> a #
GFoldable ((,) a) # |
Methods gfoldMap :: Monoid m => (a -> m) -> (a, a) -> m # gfold :: Monoid m => (a, m) -> m # gfoldr :: (a -> b -> b) -> b -> (a, a) -> b # gfoldr' :: (a -> b -> b) -> b -> (a, a) -> b # gfoldl :: (a -> b -> a) -> a -> (a, b) -> a # gfoldl' :: (a -> b -> a) -> a -> (a, b) -> a # gfoldr1 :: (a -> a -> a) -> (a, a) -> a # gfoldl1 :: (a -> a -> a) -> (a, a) -> a #
GFoldable (Arg a) # |
Methods gfoldMap :: Monoid m => (a -> m) -> Arg a a -> m # gfold :: Monoid m => Arg a m -> m # gfoldr :: (a -> b -> b) -> b -> Arg a a -> b # gfoldr' :: (a -> b -> b) -> b -> Arg a a -> b # gfoldl :: (a -> b -> a) -> a -> Arg a b -> a # gfoldl' :: (a -> b -> a) -> a -> Arg a b -> a # gfoldr1 :: (a -> a -> a) -> Arg a a -> a # gfoldl1 :: (a -> a -> a) -> Arg a a -> a #
GFoldable (Proxy *) # |
Methods gfoldMap :: Monoid m => (a -> m) -> Proxy * a -> m # gfold :: Monoid m => Proxy * m -> m # gfoldr :: (a -> b -> b) -> b -> Proxy * a -> b # gfoldr' :: (a -> b -> b) -> b -> Proxy * a -> b # gfoldl :: (a -> b -> a) -> a -> Proxy * b -> a # gfoldl' :: (a -> b -> a) -> a -> Proxy * b -> a # gfoldr1 :: (a -> a -> a) -> Proxy * a -> a # gfoldl1 :: (a -> a -> a) -> Proxy * a -> a #
GFoldable (Const * m) # |
Methods gfoldMap :: Monoid m => (a -> m) -> Const * m a -> m # gfold :: Monoid m => Const * m m -> m # gfoldr :: (a -> b -> b) -> b -> Const * m a -> b # gfoldr' :: (a -> b -> b) -> b -> Const * m a -> b # gfoldl :: (a -> b -> a) -> a -> Const * m b -> a # gfoldl' :: (a -> b -> a) -> a -> Const * m b -> a # gfoldr1 :: (a -> a -> a) -> Const * m a -> a # gfoldl1 :: (a -> a -> a) -> Const * m a -> a #
(GFoldable f, GFoldable g) => GFoldable (Sum * f g) # |
Methods gfoldMap :: Monoid m => (a -> m) -> Sum * f g a -> m # gfold :: Monoid m => Sum * f g m -> m # gfoldr :: (a -> b -> b) -> b -> Sum * f g a -> b # gfoldr' :: (a -> b -> b) -> b -> Sum * f g a -> b # gfoldl :: (a -> b -> a) -> a -> Sum * f g b -> a # gfoldl' :: (a -> b -> a) -> a -> Sum * f g b -> a # gfoldr1 :: (a -> a -> a) -> Sum * f g a -> a # gfoldl1 :: (a -> a -> a) -> Sum * f g a -> a #
(GFoldable f, GFoldable g) => GFoldable (Product * f g) # |
Methods gfoldMap :: Monoid m => (a -> m) -> Product * f g a -> m # gfold :: Monoid m => Product * f g m -> m # gfoldr :: (a -> b -> b) -> b -> Product * f g a -> b # gfoldr' :: (a -> b -> b) -> b -> Product * f g a -> b # gfoldl :: (a -> b -> a) -> a -> Product * f g b -> a # gfoldl' :: (a -> b -> a) -> a -> Product * f g b -> a # gfoldr1 :: (a -> a -> a) -> Product * f g a -> a # gfoldl1 :: (a -> a -> a) -> Product * f g a -> a #

# Default method

gfoldMapdefault :: (Generic1 t, GFoldable' (Rep1 t), Monoid m) => (a -> m) -> t a -> m #

# Derived functions

gtoList :: GFoldable t => t a -> [a] #

gconcat :: GFoldable t => t [a] -> [a] #

gconcatMap :: GFoldable t => (a -> [b]) -> t a -> [b] #

gand :: GFoldable t => t Bool -> Bool #

gor :: GFoldable t => t Bool -> Bool #

gany :: GFoldable t => (a -> Bool) -> t a -> Bool #

gall :: GFoldable t => (a -> Bool) -> t a -> Bool #

gsum :: (GFoldable t, Num a) => t a -> a #

gproduct :: (GFoldable t, Num a) => t a -> a #

gmaximum :: (GFoldable t, Ord a) => t a -> a #

gmaximumBy :: GFoldable t => (a -> a -> Ordering) -> t a -> a #

gminimum :: (GFoldable t, Ord a) => t a -> a #

gminimumBy :: GFoldable t => (a -> a -> Ordering) -> t a -> a #

gelem :: (GFoldable t, Eq a) => a -> t a -> Bool #

gnotElem :: (GFoldable t, Eq a) => a -> t a -> Bool #

gfind :: GFoldable t => (a -> Bool) -> t a -> Maybe a #

# Internal Foldable class

class GFoldable' t where #

Minimal complete definition

gfoldMap'

Methods

gfoldMap' :: Monoid m => (a -> m) -> t a -> m #

Instances

GFoldable' U1 # |
Methods gfoldMap' :: Monoid m => (a -> m) -> U1 a -> m #
GFoldable' Par1 # |
Methods gfoldMap' :: Monoid m => (a -> m) -> Par1 a -> m #
GFoldable' UAddr # |
Methods gfoldMap' :: Monoid m => (a -> m) -> UAddr a -> m #
GFoldable' UChar # |
Methods gfoldMap' :: Monoid m => (a -> m) -> UChar a -> m #
GFoldable' UDouble # |
Methods gfoldMap' :: Monoid m => (a -> m) -> UDouble a -> m #
GFoldable' UFloat # |
Methods gfoldMap' :: Monoid m => (a -> m) -> UFloat a -> m #
GFoldable' UInt # |
Methods gfoldMap' :: Monoid m => (a -> m) -> UInt a -> m #
GFoldable' UWord # |
Methods gfoldMap' :: Monoid m => (a -> m) -> UWord a -> m #
GFoldable f => GFoldable' (Rec1 f) # |
Methods gfoldMap' :: Monoid m => (a -> m) -> Rec1 f a -> m #
GFoldable' (K1 i c) # |
Methods gfoldMap' :: Monoid m => (a -> m) -> K1 i c a -> m #
(GFoldable' f, GFoldable' g) => GFoldable' ((:+:) f g) # |
Methods gfoldMap' :: Monoid m => (a -> m) -> (f :+: g) a -> m #
(GFoldable' f, GFoldable' g) => GFoldable' ((:*:) f g) # |
Methods gfoldMap' :: Monoid m => (a -> m) -> (f :*: g) a -> m #
(GFoldable f, GFoldable' g) => GFoldable' ((:.:) f g) # |
Methods gfoldMap' :: Monoid m => (a -> m) -> (f :.: g) a -> m #
GFoldable' f => GFoldable' (M1 i c f) # |
Methods gfoldMap' :: Monoid m => (a -> m) -> M1 i c f a -> m #