Generics.Deriving.Foldable

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

Safe Haskell | Safe
Language | Haskell2010

Generics.Deriving.Foldable

Contents

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

Synopsis

- class GFoldable (t :: Type -> Type) where
  - gfoldMap :: 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
- 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 :: Type -> Type) where
  - gfoldMap' :: Monoid m => (a -> m) -> t a -> m

# Generic Foldable class

class GFoldable (t :: Type -> Type) where #

Minimal complete definition

Nothing

Methods

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

default 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

Instances details

GFoldable Complex # |
Instance details Defined in Generics.Deriving.Foldable 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 First # |
Instance details Defined in Generics.Deriving.Foldable 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 # |
Instance details Defined in Generics.Deriving.Foldable 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 Max # |
Instance details Defined in Generics.Deriving.Foldable 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 Min # |
Instance details Defined in Generics.Deriving.Foldable 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 WrappedMonoid # |
Instance details Defined in Generics.Deriving.Foldable 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 NonEmpty # |
Instance details Defined in Generics.Deriving.Foldable 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 Identity # |
Instance details Defined in Generics.Deriving.Foldable 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 First # |
Instance details Defined in Generics.Deriving.Foldable 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 # |
Instance details Defined in Generics.Deriving.Foldable 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 Down # |
Instance details Defined in Generics.Deriving.Foldable Methods gfoldMap :: Monoid m => (a -> m) -> Down a -> m # gfold :: Monoid m => Down m -> m # gfoldr :: (a -> b -> b) -> b -> Down a -> b # gfoldr' :: (a -> b -> b) -> b -> Down a -> b # gfoldl :: (a -> b -> a) -> a -> Down b -> a # gfoldl' :: (a -> b -> a) -> a -> Down b -> a # gfoldr1 :: (a -> a -> a) -> Down a -> a # gfoldl1 :: (a -> a -> a) -> Down a -> a #
GFoldable Dual # |
Instance details Defined in Generics.Deriving.Foldable 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 Product # |
Instance details Defined in Generics.Deriving.Foldable 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 Sum # |
Instance details Defined in Generics.Deriving.Foldable 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 ZipList # |
Instance details Defined in Generics.Deriving.Foldable 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 Maybe # |
Instance details Defined in Generics.Deriving.Foldable 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 [] # |
Instance details Defined in Generics.Deriving.Foldable 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 (Arg a) # |
Instance details Defined in Generics.Deriving.Foldable Methods gfoldMap :: Monoid m => (a0 -> m) -> Arg a a0 -> m # gfold :: Monoid m => Arg a m -> m # gfoldr :: (a0 -> b -> b) -> b -> Arg a a0 -> b # gfoldr' :: (a0 -> b -> b) -> b -> Arg a a0 -> b # gfoldl :: (a0 -> b -> a0) -> a0 -> Arg a b -> a0 # gfoldl' :: (a0 -> b -> a0) -> a0 -> Arg a b -> a0 # gfoldr1 :: (a0 -> a0 -> a0) -> Arg a a0 -> a0 # gfoldl1 :: (a0 -> a0 -> a0) -> Arg a a0 -> a0 #
(Generic1 t, GFoldable' (Rep1 t)) => GFoldable (Default1 t) # |
Instance details Defined in Generics.Deriving.Default Methods gfoldMap :: Monoid m => (a -> m) -> Default1 t a -> m # gfold :: Monoid m => Default1 t m -> m # gfoldr :: (a -> b -> b) -> b -> Default1 t a -> b # gfoldr' :: (a -> b -> b) -> b -> Default1 t a -> b # gfoldl :: (a -> b -> a) -> a -> Default1 t b -> a # gfoldl' :: (a -> b -> a) -> a -> Default1 t b -> a # gfoldr1 :: (a -> a -> a) -> Default1 t a -> a # gfoldl1 :: (a -> a -> a) -> Default1 t a -> a #
GFoldable (Either a) # |
Instance details Defined in Generics.Deriving.Foldable Methods gfoldMap :: Monoid m => (a0 -> m) -> Either a a0 -> m # gfold :: Monoid m => Either a m -> m # gfoldr :: (a0 -> b -> b) -> b -> Either a a0 -> b # gfoldr' :: (a0 -> b -> b) -> b -> Either a a0 -> b # gfoldl :: (a0 -> b -> a0) -> a0 -> Either a b -> a0 # gfoldl' :: (a0 -> b -> a0) -> a0 -> Either a b -> a0 # gfoldr1 :: (a0 -> a0 -> a0) -> Either a a0 -> a0 # gfoldl1 :: (a0 -> a0 -> a0) -> Either a a0 -> a0 #
GFoldable (Proxy :: Type -> Type) # |
Instance details Defined in Generics.Deriving.Foldable 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 ((,) a) # |
Instance details Defined in Generics.Deriving.Foldable Methods gfoldMap :: Monoid m => (a0 -> m) -> (a, a0) -> m # gfold :: Monoid m => (a, m) -> m # gfoldr :: (a0 -> b -> b) -> b -> (a, a0) -> b # gfoldr' :: (a0 -> b -> b) -> b -> (a, a0) -> b # gfoldl :: (a0 -> b -> a0) -> a0 -> (a, b) -> a0 # gfoldl' :: (a0 -> b -> a0) -> a0 -> (a, b) -> a0 # gfoldr1 :: (a0 -> a0 -> a0) -> (a, a0) -> a0 # gfoldl1 :: (a0 -> a0 -> a0) -> (a, a0) -> a0 #
GFoldable (Const m :: Type -> Type) # |
Instance details Defined in Generics.Deriving.Foldable Methods gfoldMap :: Monoid m0 => (a -> m0) -> Const m a -> m0 # gfold :: Monoid m0 => Const m m0 -> m0 # 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 (Product f g) # |
Instance details Defined in Generics.Deriving.Foldable 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 #
(GFoldable f, GFoldable g) => GFoldable (Sum f g) # |
Instance details Defined in Generics.Deriving.Foldable 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 #

# 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 :: Type -> Type) where #

Methods

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

#### Instances

Instances details

GFoldable' Par1 # |
Instance details Defined in Generics.Deriving.Foldable Methods gfoldMap' :: Monoid m => (a -> m) -> Par1 a -> m #
GFoldable' (U1 :: Type -> Type) # |
Instance details Defined in Generics.Deriving.Foldable Methods gfoldMap' :: Monoid m => (a -> m) -> U1 a -> m #
GFoldable' (UAddr :: Type -> Type) # |
Instance details Defined in Generics.Deriving.Foldable Methods gfoldMap' :: Monoid m => (a -> m) -> UAddr a -> m #
GFoldable' (UChar :: Type -> Type) # |
Instance details Defined in Generics.Deriving.Foldable Methods gfoldMap' :: Monoid m => (a -> m) -> UChar a -> m #
GFoldable' (UDouble :: Type -> Type) # |
Instance details Defined in Generics.Deriving.Foldable Methods gfoldMap' :: Monoid m => (a -> m) -> UDouble a -> m #
GFoldable' (UFloat :: Type -> Type) # |
Instance details Defined in Generics.Deriving.Foldable Methods gfoldMap' :: Monoid m => (a -> m) -> UFloat a -> m #
GFoldable' (UInt :: Type -> Type) # |
Instance details Defined in Generics.Deriving.Foldable Methods gfoldMap' :: Monoid m => (a -> m) -> UInt a -> m #
GFoldable' (UWord :: Type -> Type) # |
Instance details Defined in Generics.Deriving.Foldable Methods gfoldMap' :: Monoid m => (a -> m) -> UWord a -> m #
GFoldable' (V1 :: Type -> Type) # |
Instance details Defined in Generics.Deriving.Foldable Methods gfoldMap' :: Monoid m => (a -> m) -> V1 a -> m #
GFoldable f => GFoldable' (Rec1 f) # |
Instance details Defined in Generics.Deriving.Foldable Methods gfoldMap' :: Monoid m => (a -> m) -> Rec1 f a -> m #
(GFoldable' f, GFoldable' g) => GFoldable' (f :*: g) # |
Instance details Defined in Generics.Deriving.Foldable Methods gfoldMap' :: Monoid m => (a -> m) -> (f :*: g) a -> m #
(GFoldable' f, GFoldable' g) => GFoldable' (f :+: g) # |
Instance details Defined in Generics.Deriving.Foldable Methods gfoldMap' :: Monoid m => (a -> m) -> (f :+: g) a -> m #
GFoldable' (K1 i c :: Type -> Type) # |
Instance details Defined in Generics.Deriving.Foldable Methods gfoldMap' :: Monoid m => (a -> m) -> K1 i c a -> m #
(GFoldable f, GFoldable' g) => GFoldable' (f :.: g) # |
Instance details Defined in Generics.Deriving.Foldable Methods gfoldMap' :: Monoid m => (a -> m) -> (f :.: g) a -> m #
GFoldable' f => GFoldable' (M1 i c f) # |
Instance details Defined in Generics.Deriving.Foldable Methods gfoldMap' :: Monoid m => (a -> m) -> M1 i c f a -> m #