foldl-1.4.14: Composable, streaming, and efficient left folds
Safe Haskell Safe-Inferred
Language Haskell2010

Control.Foldl.Text

Description

Folds for text streams

Synopsis

Folding

fold :: Fold Text a -> Text -> a Source #

Apply a strict left Fold to lazy text

foldM :: Monad m => FoldM m Text a -> Text -> m a Source #

Apply a strict monadic left FoldM to lazy text

Folds

head :: Fold Text ( Maybe Char ) Source #

Get the first character of a text stream or return Nothing if the stream is empty

last :: Fold Text ( Maybe Char ) Source #

Get the last character of a text stream or return Nothing if the text stream is empty

null :: Fold Text Bool Source #

Returns True if the text stream is empty, False otherwise

length :: Num n => Fold Text n Source #

Return the length of the text stream in characters

any :: ( Char -> Bool ) -> Fold Text Bool Source #

(any predicate) returns True if any character satisfies the predicate, False otherwise

all :: ( Char -> Bool ) -> Fold Text Bool Source #

(all predicate) returns True if all characters satisfy the predicate, False otherwise

maximum :: Fold Text ( Maybe Char ) Source #

Computes the maximum character

minimum :: Fold Text ( Maybe Char ) Source #

Computes the minimum character

elem :: Char -> Fold Text Bool Source #

(elem c) returns True if the text stream has a character equal to c , False otherwise

notElem :: Char -> Fold Text Bool Source #

(notElem c) returns False if the text stream has a character equal to c , True otherwise

find :: ( Char -> Bool ) -> Fold Text ( Maybe Char ) Source #

(find predicate) returns the first character that satisfies the predicate or Nothing if no character satisfies the predicate

index :: Integral n => n -> Fold Text ( Maybe Char ) Source #

(index n) returns the n th character of the text stream, or Nothing if the stream has an insufficient number of characters

elemIndex :: Num n => Char -> Fold Text ( Maybe n) Source #

(elemIndex c) returns the index of the first character that equals c , or Nothing if no character matches

findIndex :: Num n => ( Char -> Bool ) -> Fold Text ( Maybe n) Source #

(findIndex predicate) returns the index of the first character that satisfies the predicate, or Nothing if no character satisfies the predicate

count :: Num n => Char -> Fold Text n Source #

(count c) returns the number of times c appears

lazy :: Fold Text Text Source #

Combine all the strict Text chunks to build a lazy Text

Re-exports

Control.Foldl re-exports the Fold type

Data.Text re-exports the Text type

class Foldable (t :: Type -> Type ) Source #

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)

Minimal complete definition

foldMap | foldr

Instances

Instances details
Foldable []

Since: base-2.1

Instance details

Defined in Data.Foldable

Methods

fold :: Monoid m => [m] -> m Source #

foldMap :: Monoid m => (a -> m) -> [a] -> m Source #

foldMap' :: Monoid m => (a -> m) -> [a] -> m Source #

foldr :: (a -> b -> b) -> b -> [a] -> b Source #

foldr' :: (a -> b -> b) -> b -> [a] -> b Source #

foldl :: (b -> a -> b) -> b -> [a] -> b Source #

foldl' :: (b -> a -> b) -> b -> [a] -> b Source #

foldr1 :: (a -> a -> a) -> [a] -> a Source #

foldl1 :: (a -> a -> a) -> [a] -> a Source #

toList :: [a] -> [a] Source #

null :: [a] -> Bool Source #

length :: [a] -> Int Source #

elem :: Eq a => a -> [a] -> Bool Source #

maximum :: Ord a => [a] -> a Source #

minimum :: Ord a => [a] -> a Source #

sum :: Num a => [a] -> a Source #

product :: Num a => [a] -> a Source #

Foldable Maybe

Since: base-2.1

Instance details

Defined in Data.Foldable

Foldable Par1

Since: base-4.9.0.0

Instance details

Defined in Data.Foldable

Foldable Complex

Since: base-4.9.0.0

Instance details

Defined in Data.Complex

Foldable Min

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

Foldable Max

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

Foldable First

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

Foldable Last

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

Foldable Option

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

Foldable ZipList

Since: base-4.9.0.0

Instance details

Defined in Control.Applicative

Foldable Identity

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Foldable First

Since: base-4.8.0.0

Instance details

Defined in Data.Foldable

Foldable Last

Since: base-4.8.0.0

Instance details

Defined in Data.Foldable

Foldable Dual

Since: base-4.8.0.0

Instance details

Defined in Data.Foldable

Foldable Sum

Since: base-4.8.0.0

Instance details

Defined in Data.Foldable

Foldable Product

Since: base-4.8.0.0

Instance details

Defined in Data.Foldable

Foldable Down

Since: base-4.12.0.0

Instance details

Defined in Data.Foldable

Foldable NonEmpty

Since: base-4.9.0.0

Instance details

Defined in Data.Foldable

Foldable IntMap

Folds in order of increasing key.

Instance details

Defined in Data.IntMap.Internal

Foldable Tree
Instance details

Defined in Data.Tree

Foldable Seq
Instance details

Defined in Data.Sequence.Internal

Foldable FingerTree
Instance details

Defined in Data.Sequence.Internal

Foldable Digit
Instance details

Defined in Data.Sequence.Internal

Foldable Node
Instance details

Defined in Data.Sequence.Internal

Foldable Elem
Instance details

Defined in Data.Sequence.Internal

Foldable ViewL
Instance details

Defined in Data.Sequence.Internal

Foldable ViewR
Instance details

Defined in Data.Sequence.Internal

Foldable Set

Folds in order of increasing key.

Instance details

Defined in Data.Set.Internal

Foldable Hashed
Instance details

Defined in Data.Hashable.Class

Foldable HashSet
Instance details

Defined in Data.HashSet.Internal

Foldable ( Either a)

Since: base-4.7.0.0

Instance details

Defined in Data.Foldable

Methods

fold :: Monoid m => Either a m -> m Source #

foldMap :: Monoid m => (a0 -> m) -> Either a a0 -> m Source #

foldMap' :: Monoid m => (a0 -> m) -> Either a a0 -> m Source #

foldr :: (a0 -> b -> b) -> b -> Either a a0 -> b Source #

foldr' :: (a0 -> b -> b) -> b -> Either a a0 -> b Source #

foldl :: (b -> a0 -> b) -> b -> Either a a0 -> b Source #

foldl' :: (b -> a0 -> b) -> b -> Either a a0 -> b Source #

foldr1 :: (a0 -> a0 -> a0) -> Either a a0 -> a0 Source #

foldl1 :: (a0 -> a0 -> a0) -> Either a a0 -> a0 Source #

toList :: Either a a0 -> [a0] Source #

null :: Either a a0 -> Bool Source #

length :: Either a a0 -> Int Source #

elem :: Eq a0 => a0 -> Either a a0 -> Bool Source #

maximum :: Ord a0 => Either a a0 -> a0 Source #

minimum :: Ord a0 => Either a a0 -> a0 Source #

sum :: Num a0 => Either a a0 -> a0 Source #

product :: Num a0 => Either a a0 -> a0 Source #

Foldable ( V1 :: Type -> Type )

Since: base-4.9.0.0

Instance details

Defined in Data.Foldable

Foldable ( U1 :: Type -> Type )

Since: base-4.9.0.0

Instance details

Defined in Data.Foldable

Foldable ( UAddr :: Type -> Type )

Since: base-4.9.0.0

Instance details

Defined in Data.Foldable

Foldable ( UChar :: Type -> Type )

Since: base-4.9.0.0

Instance details

Defined in Data.Foldable

Foldable ( UDouble :: Type -> Type )

Since: base-4.9.0.0

Instance details

Defined in Data.Foldable

Foldable ( UFloat :: Type -> Type )

Since: base-4.9.0.0

Instance details

Defined in Data.Foldable

Foldable ( UInt :: Type -> Type )

Since: base-4.9.0.0

Instance details

Defined in Data.Foldable

Foldable ( UWord :: Type -> Type )

Since: base-4.9.0.0

Instance details

Defined in Data.Foldable

Foldable ( (,) a)

Since: base-4.7.0.0

Instance details

Defined in Data.Foldable

Methods

fold :: Monoid m => (a, m) -> m Source #

foldMap :: Monoid m => (a0 -> m) -> (a, a0) -> m Source #

foldMap' :: Monoid m => (a0 -> m) -> (a, a0) -> m Source #

foldr :: (a0 -> b -> b) -> b -> (a, a0) -> b Source #

foldr' :: (a0 -> b -> b) -> b -> (a, a0) -> b Source #

foldl :: (b -> a0 -> b) -> b -> (a, a0) -> b Source #

foldl' :: (b -> a0 -> b) -> b -> (a, a0) -> b Source #

foldr1 :: (a0 -> a0 -> a0) -> (a, a0) -> a0 Source #

foldl1 :: (a0 -> a0 -> a0) -> (a, a0) -> a0 Source #

toList :: (a, a0) -> [a0] Source #

null :: (a, a0) -> Bool Source #

length :: (a, a0) -> Int Source #

elem :: Eq a0 => a0 -> (a, a0) -> Bool Source #

maximum :: Ord a0 => (a, a0) -> a0 Source #

minimum :: Ord a0 => (a, a0) -> a0 Source #

sum :: Num a0 => (a, a0) -> a0 Source #

product :: Num a0 => (a, a0) -> a0 Source #

Foldable ( Array i)

Since: base-4.8.0.0

Instance details

Defined in Data.Foldable

Foldable ( Arg a)

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

Methods

fold :: Monoid m => Arg a m -> m Source #

foldMap :: Monoid m => (a0 -> m) -> Arg a a0 -> m Source #

foldMap' :: Monoid m => (a0 -> m) -> Arg a a0 -> m Source #

foldr :: (a0 -> b -> b) -> b -> Arg a a0 -> b Source #

foldr' :: (a0 -> b -> b) -> b -> Arg a a0 -> b Source #

foldl :: (b -> a0 -> b) -> b -> Arg a a0 -> b Source #

foldl' :: (b -> a0 -> b) -> b -> Arg a a0 -> b Source #

foldr1 :: (a0 -> a0 -> a0) -> Arg a a0 -> a0 Source #

foldl1 :: (a0 -> a0 -> a0) -> Arg a a0 -> a0 Source #

toList :: Arg a a0 -> [a0] Source #

null :: Arg a a0 -> Bool Source #

length :: Arg a a0 -> Int Source #

elem :: Eq a0 => a0 -> Arg a a0 -> Bool Source #

maximum :: Ord a0 => Arg a a0 -> a0 Source #

minimum :: Ord a0 => Arg a a0 -> a0 Source #

sum :: Num a0 => Arg a a0 -> a0 Source #

product :: Num a0 => Arg a a0 -> a0 Source #

Foldable ( Proxy :: Type -> Type )

Since: base-4.7.0.0

Instance details

Defined in Data.Foldable

Foldable ( Map k)

Folds in order of increasing key.

Instance details

Defined in Data.Map.Internal

Methods

fold :: Monoid m => Map k m -> m Source #

foldMap :: Monoid m => (a -> m) -> Map k a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Map k a -> m Source #

foldr :: (a -> b -> b) -> b -> Map k a -> b Source #

foldr' :: (a -> b -> b) -> b -> Map k a -> b Source #

foldl :: (b -> a -> b) -> b -> Map k a -> b Source #

foldl' :: (b -> a -> b) -> b -> Map k a -> b Source #

foldr1 :: (a -> a -> a) -> Map k a -> a Source #

foldl1 :: (a -> a -> a) -> Map k a -> a Source #

toList :: Map k a -> [a] Source #

null :: Map k a -> Bool Source #

length :: Map k a -> Int Source #

elem :: Eq a => a -> Map k a -> Bool Source #

maximum :: Ord a => Map k a -> a Source #

minimum :: Ord a => Map k a -> a Source #

sum :: Num a => Map k a -> a Source #

product :: Num a => Map k a -> a Source #

Foldable f => Foldable ( ListT f)
Instance details

Defined in Control.Monad.Trans.List

Foldable f => Foldable ( Lift f)
Instance details

Defined in Control.Applicative.Lift

Foldable f => Foldable ( MaybeT f)
Instance details

Defined in Control.Monad.Trans.Maybe

Foldable ( HashMap k)
Instance details

Defined in Data.HashMap.Internal

Foldable f => Foldable ( Rec1 f)

Since: base-4.9.0.0

Instance details

Defined in Data.Foldable

Foldable ( Const m :: Type -> Type )

Since: base-4.7.0.0

Instance details

Defined in Data.Functor.Const

Foldable f => Foldable ( Ap f)

Since: base-4.12.0.0

Instance details

Defined in Data.Foldable

Methods

fold :: Monoid m => Ap f m -> m Source #

foldMap :: Monoid m => (a -> m) -> Ap f a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Ap f a -> m Source #

foldr :: (a -> b -> b) -> b -> Ap f a -> b Source #

foldr' :: (a -> b -> b) -> b -> Ap f a -> b Source #

foldl :: (b -> a -> b) -> b -> Ap f a -> b Source #

foldl' :: (b -> a -> b) -> b -> Ap f a -> b Source #

foldr1 :: (a -> a -> a) -> Ap f a -> a Source #

foldl1 :: (a -> a -> a) -> Ap f a -> a Source #

toList :: Ap f a -> [a] Source #

null :: Ap f a -> Bool Source #

length :: Ap f a -> Int Source #

elem :: Eq a => a -> Ap f a -> Bool Source #

maximum :: Ord a => Ap f a -> a Source #

minimum :: Ord a => Ap f a -> a Source #

sum :: Num a => Ap f a -> a Source #

product :: Num a => Ap f a -> a Source #

Foldable f => Foldable ( Alt f)

Since: base-4.12.0.0

Instance details

Defined in Data.Foldable

Methods

fold :: Monoid m => Alt f m -> m Source #

foldMap :: Monoid m => (a -> m) -> Alt f a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Alt f a -> m Source #

foldr :: (a -> b -> b) -> b -> Alt f a -> b Source #

foldr' :: (a -> b -> b) -> b -> Alt f a -> b Source #

foldl :: (b -> a -> b) -> b -> Alt f a -> b Source #

foldl' :: (b -> a -> b) -> b -> Alt f a -> b Source #

foldr1 :: (a -> a -> a) -> Alt f a -> a Source #

foldl1 :: (a -> a -> a) -> Alt f a -> a Source #

toList :: Alt f a -> [a] Source #

null :: Alt f a -> Bool Source #

length :: Alt f a -> Int Source #

elem :: Eq a => a -> Alt f a -> Bool Source #

maximum :: Ord a => Alt f a -> a Source #

minimum :: Ord a => Alt f a -> a Source #

sum :: Num a => Alt f a -> a Source #

product :: Num a => Alt f a -> a Source #

Bifoldable p => Foldable ( Join p)
Instance details

Defined in Data.Bifunctor.Join

Foldable f => Foldable ( IdentityT f)
Instance details

Defined in Control.Monad.Trans.Identity

Foldable f => Foldable ( ErrorT e f)
Instance details

Defined in Control.Monad.Trans.Error

Methods

fold :: Monoid m => ErrorT e f m -> m Source #

foldMap :: Monoid m => (a -> m) -> ErrorT e f a -> m Source #

foldMap' :: Monoid m => (a -> m) -> ErrorT e f a -> m Source #

foldr :: (a -> b -> b) -> b -> ErrorT e f a -> b Source #

foldr' :: (a -> b -> b) -> b -> ErrorT e f a -> b Source #

foldl :: (b -> a -> b) -> b -> ErrorT e f a -> b Source #

foldl' :: (b -> a -> b) -> b -> ErrorT e f a -> b Source #

foldr1 :: (a -> a -> a) -> ErrorT e f a -> a Source #

foldl1 :: (a -> a -> a) -> ErrorT e f a -> a Source #

toList :: ErrorT e f a -> [a] Source #

null :: ErrorT e f a -> Bool Source #

length :: ErrorT e f a -> Int Source #

elem :: Eq a => a -> ErrorT e f a -> Bool Source #

maximum :: Ord a => ErrorT e f a -> a Source #

minimum :: Ord a => ErrorT e f a -> a Source #

sum :: Num a => ErrorT e f a -> a Source #

product :: Num a => ErrorT e f a -> a Source #

Foldable f => Foldable ( ExceptT e f)
Instance details

Defined in Control.Monad.Trans.Except

Foldable f => Foldable ( WriterT w f)
Instance details

Defined in Control.Monad.Trans.Writer.Lazy

Foldable f => Foldable ( WriterT w f)
Instance details

Defined in Control.Monad.Trans.Writer.Strict

Foldable ( Tagged s)
Instance details

Defined in Data.Tagged

Foldable f => Foldable ( Reverse f)

Fold from right to left.

Instance details

Defined in Data.Functor.Reverse

Foldable f => Foldable ( Backwards f)

Derived instance.

Instance details

Defined in Control.Applicative.Backwards

Foldable ( K1 i c :: Type -> Type )

Since: base-4.9.0.0

Instance details

Defined in Data.Foldable

Methods

fold :: Monoid m => K1 i c m -> m Source #

foldMap :: Monoid m => (a -> m) -> K1 i c a -> m Source #

foldMap' :: Monoid m => (a -> m) -> K1 i c a -> m Source #

foldr :: (a -> b -> b) -> b -> K1 i c a -> b Source #

foldr' :: (a -> b -> b) -> b -> K1 i c a -> b Source #

foldl :: (b -> a -> b) -> b -> K1 i c a -> b Source #

foldl' :: (b -> a -> b) -> b -> K1 i c a -> b Source #

foldr1 :: (a -> a -> a) -> K1 i c a -> a Source #

foldl1 :: (a -> a -> a) -> K1 i c a -> a Source #

toList :: K1 i c a -> [a] Source #

null :: K1 i c a -> Bool Source #

length :: K1 i c a -> Int Source #

elem :: Eq a => a -> K1 i c a -> Bool Source #

maximum :: Ord a => K1 i c a -> a Source #

minimum :: Ord a => K1 i c a -> a Source #

sum :: Num a => K1 i c a -> a Source #

product :: Num a => K1 i c a -> a Source #

( Foldable f, Foldable g) => Foldable (f :+: g)

Since: base-4.9.0.0

Instance details

Defined in Data.Foldable

Methods

fold :: Monoid m => (f :+: g) m -> m Source #

foldMap :: Monoid m => (a -> m) -> (f :+: g) a -> m Source #

foldMap' :: Monoid m => (a -> m) -> (f :+: g) a -> m Source #

foldr :: (a -> b -> b) -> b -> (f :+: g) a -> b Source #

foldr' :: (a -> b -> b) -> b -> (f :+: g) a -> b Source #

foldl :: (b -> a -> b) -> b -> (f :+: g) a -> b Source #

foldl' :: (b -> a -> b) -> b -> (f :+: g) a -> b Source #

foldr1 :: (a -> a -> a) -> (f :+: g) a -> a Source #

foldl1 :: (a -> a -> a) -> (f :+: g) a -> a Source #

toList :: (f :+: g) a -> [a] Source #

null :: (f :+: g) a -> Bool Source #

length :: (f :+: g) a -> Int Source #

elem :: Eq a => a -> (f :+: g) a -> Bool Source #

maximum :: Ord a => (f :+: g) a -> a Source #

minimum :: Ord a => (f :+: g) a -> a Source #

sum :: Num a => (f :+: g) a -> a Source #

product :: Num a => (f :+: g) a -> a Source #

( Foldable f, Foldable g) => Foldable (f :*: g)

Since: base-4.9.0.0

Instance details

Defined in Data.Foldable

Methods

fold :: Monoid m => (f :*: g) m -> m Source #

foldMap :: Monoid m => (a -> m) -> (f :*: g) a -> m Source #

foldMap' :: Monoid m => (a -> m) -> (f :*: g) a -> m Source #

foldr :: (a -> b -> b) -> b -> (f :*: g) a -> b Source #

foldr' :: (a -> b -> b) -> b -> (f :*: g) a -> b Source #

foldl :: (b -> a -> b) -> b -> (f :*: g) a -> b Source #

foldl' :: (b -> a -> b) -> b -> (f :*: g) a -> b Source #

foldr1 :: (a -> a -> a) -> (f :*: g) a -> a Source #

foldl1 :: (a -> a -> a) -> (f :*: g) a -> a Source #

toList :: (f :*: g) a -> [a] Source #

null :: (f :*: g) a -> Bool Source #

length :: (f :*: g) a -> Int Source #

elem :: Eq a => a -> (f :*: g) a -> Bool Source #

maximum :: Ord a => (f :*: g) a -> a Source #

minimum :: Ord a => (f :*: g) a -> a Source #

sum :: Num a => (f :*: g) a -> a Source #

product :: Num a => (f :*: g) a -> a Source #

( Foldable f, Foldable g) => Foldable ( Product f g)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Product

( Foldable f, Foldable g) => Foldable ( Sum f g)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Sum

Methods

fold :: Monoid m => Sum f g m -> m Source #

foldMap :: Monoid m => (a -> m) -> Sum f g a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Sum f g a -> m Source #

foldr :: (a -> b -> b) -> b -> Sum f g a -> b Source #

foldr' :: (a -> b -> b) -> b -> Sum f g a -> b Source #

foldl :: (b -> a -> b) -> b -> Sum f g a -> b Source #

foldl' :: (b -> a -> b) -> b -> Sum f g a -> b Source #

foldr1 :: (a -> a -> a) -> Sum f g a -> a Source #

foldl1 :: (a -> a -> a) -> Sum f g a -> a Source #

toList :: Sum f g a -> [a] Source #

null :: Sum f g a -> Bool Source #

length :: Sum f g a -> Int Source #

elem :: Eq a => a -> Sum f g a -> Bool Source #

maximum :: Ord a => Sum f g a -> a Source #

minimum :: Ord a => Sum f g a -> a Source #

sum :: Num a => Sum f g a -> a Source #

product :: Num a => Sum f g a -> a Source #

Foldable ( Forget r a :: Type -> Type )
Instance details

Defined in Data.Profunctor.Types

Methods

fold :: Monoid m => Forget r a m -> m Source #

foldMap :: Monoid m => (a0 -> m) -> Forget r a a0 -> m Source #

foldMap' :: Monoid m => (a0 -> m) -> Forget r a a0 -> m Source #

foldr :: (a0 -> b -> b) -> b -> Forget r a a0 -> b Source #

foldr' :: (a0 -> b -> b) -> b -> Forget r a a0 -> b Source #

foldl :: (b -> a0 -> b) -> b -> Forget r a a0 -> b Source #

foldl' :: (b -> a0 -> b) -> b -> Forget r a a0 -> b Source #

foldr1 :: (a0 -> a0 -> a0) -> Forget r a a0 -> a0 Source #

foldl1 :: (a0 -> a0 -> a0) -> Forget r a a0 -> a0 Source #

toList :: Forget r a a0 -> [a0] Source #

null :: Forget r a a0 -> Bool Source #

length :: Forget r a a0 -> Int Source #

elem :: Eq a0 => a0 -> Forget r a a0 -> Bool Source #

maximum :: Ord a0 => Forget r a a0 -> a0 Source #

minimum :: Ord a0 => Forget r a a0 -> a0 Source #

sum :: Num a0 => Forget r a a0 -> a0 Source #

product :: Num a0 => Forget r a a0 -> a0 Source #

Foldable f => Foldable ( M1 i c f)

Since: base-4.9.0.0

Instance details

Defined in Data.Foldable

Methods

fold :: Monoid m => M1 i c f m -> m Source #

foldMap :: Monoid m => (a -> m) -> M1 i c f a -> m Source #

foldMap' :: Monoid m => (a -> m) -> M1 i c f a -> m Source #

foldr :: (a -> b -> b) -> b -> M1 i c f a -> b Source #

foldr' :: (a -> b -> b) -> b -> M1 i c f a -> b Source #

foldl :: (b -> a -> b) -> b -> M1 i c f a -> b Source #

foldl' :: (b -> a -> b) -> b -> M1 i c f a -> b Source #

foldr1 :: (a -> a -> a) -> M1 i c f a -> a Source #

foldl1 :: (a -> a -> a) -> M1 i c f a -> a Source #

toList :: M1 i c f a -> [a] Source #

null :: M1 i c f a -> Bool Source #

length :: M1 i c f a -> Int Source #

elem :: Eq a => a -> M1 i c f a -> Bool Source #

maximum :: Ord a => M1 i c f a -> a Source #

minimum :: Ord a => M1 i c f a -> a Source #

sum :: Num a => M1 i c f a -> a Source #

product :: Num a => M1 i c f a -> a Source #

( Foldable f, Foldable g) => Foldable (f :.: g)

Since: base-4.9.0.0

Instance details

Defined in Data.Foldable

Methods

fold :: Monoid m => (f :.: g) m -> m Source #

foldMap :: Monoid m => (a -> m) -> (f :.: g) a -> m Source #

foldMap' :: Monoid m => (a -> m) -> (f :.: g) a -> m Source #

foldr :: (a -> b -> b) -> b -> (f :.: g) a -> b Source #

foldr' :: (a -> b -> b) -> b -> (f :.: g) a -> b Source #

foldl :: (b -> a -> b) -> b -> (f :.: g) a -> b Source #

foldl' :: (b -> a -> b) -> b -> (f :.: g) a -> b Source #

foldr1 :: (a -> a -> a) -> (f :.: g) a -> a Source #

foldl1 :: (a -> a -> a) -> (f :.: g) a -> a Source #

toList :: (f :.: g) a -> [a] Source #

null :: (f :.: g) a -> Bool Source #

length :: (f :.: g) a -> Int Source #

elem :: Eq a => a -> (f :.: g) a -> Bool Source #

maximum :: Ord a => (f :.: g) a -> a Source #

minimum :: Ord a => (f :.: g) a -> a Source #

sum :: Num a => (f :.: g) a -> a Source #

product :: Num a => (f :.: g) a -> a Source #

( Foldable f, Foldable g) => Foldable ( Compose f g)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Compose

Bifoldable p => Foldable ( WrappedBifunctor p a)
Instance details

Defined in Data.Bifunctor.Wrapped

Foldable g => Foldable ( Joker g a)
Instance details

Defined in Data.Bifunctor.Joker

Methods

fold :: Monoid m => Joker g a m -> m Source #

foldMap :: Monoid m => (a0 -> m) -> Joker g a a0 -> m Source #

foldMap' :: Monoid m => (a0 -> m) -> Joker g a a0 -> m Source #

foldr :: (a0 -> b -> b) -> b -> Joker g a a0 -> b Source #

foldr' :: (a0 -> b -> b) -> b -> Joker g a a0 -> b Source #

foldl :: (b -> a0 -> b) -> b -> Joker g a a0 -> b Source #

foldl' :: (b -> a0 -> b) -> b -> Joker g a a0 -> b Source #

foldr1 :: (a0 -> a0 -> a0) -> Joker g a a0 -> a0 Source #

foldl1 :: (a0 -> a0 -> a0) -> Joker g a a0 -> a0 Source #

toList :: Joker g a a0 -> [a0] Source #

null :: Joker g a a0 -> Bool Source #

length :: Joker g a a0 -> Int Source #

elem :: Eq a0 => a0 -> Joker g a a0 -> Bool Source #

maximum :: Ord a0 => Joker g a a0 -> a0 Source #

minimum :: Ord a0 => Joker g a a0 -> a0 Source #

sum :: Num a0 => Joker g a a0 -> a0 Source #

product :: Num a0 => Joker g a a0 -> a0 Source #

Bifoldable p => Foldable ( Flip p a)
Instance details

Defined in Data.Bifunctor.Flip

Methods

fold :: Monoid m => Flip p a m -> m Source #

foldMap :: Monoid m => (a0 -> m) -> Flip p a a0 -> m Source #

foldMap' :: Monoid m => (a0 -> m) -> Flip p a a0 -> m Source #

foldr :: (a0 -> b -> b) -> b -> Flip p a a0 -> b Source #

foldr' :: (a0 -> b -> b) -> b -> Flip p a a0 -> b Source #

foldl :: (b -> a0 -> b) -> b -> Flip p a a0 -> b Source #

foldl' :: (b -> a0 -> b) -> b -> Flip p a a0 -> b Source #

foldr1 :: (a0 -> a0 -> a0) -> Flip p a a0 -> a0 Source #

foldl1 :: (a0 -> a0 -> a0) -> Flip p a a0 -> a0 Source #

toList :: Flip p a a0 -> [a0] Source #

null :: Flip p a a0 -> Bool Source #

length :: Flip p a a0 -> Int Source #

elem :: Eq a0 => a0 -> Flip p a a0 -> Bool Source #

maximum :: Ord a0 => Flip p a a0 -> a0 Source #

minimum :: Ord a0 => Flip p a a0 -> a0 Source #

sum :: Num a0 => Flip p a a0 -> a0 Source #

product :: Num a0 => Flip p a a0 -> a0 Source #

Foldable ( Clown f a :: Type -> Type )
Instance details

Defined in Data.Bifunctor.Clown

Methods

fold :: Monoid m => Clown f a m -> m Source #

foldMap :: Monoid m => (a0 -> m) -> Clown f a a0 -> m Source #

foldMap' :: Monoid m => (a0 -> m) -> Clown f a a0 -> m Source #

foldr :: (a0 -> b -> b) -> b -> Clown f a a0 -> b Source #

foldr' :: (a0 -> b -> b) -> b -> Clown f a a0 -> b Source #

foldl :: (b -> a0 -> b) -> b -> Clown f a a0 -> b Source #

foldl' :: (b -> a0 -> b) -> b -> Clown f a a0 -> b Source #

foldr1 :: (a0 -> a0 -> a0) -> Clown f a a0 -> a0 Source #

foldl1 :: (a0 -> a0 -> a0) -> Clown f a a0 -> a0 Source #

toList :: Clown f a a0 -> [a0] Source #

null :: Clown f a a0 -> Bool Source #

length :: Clown f a a0 -> Int Source #

elem :: Eq a0 => a0 -> Clown f a a0 -> Bool Source #

maximum :: Ord a0 => Clown f a a0 -> a0 Source #

minimum :: Ord a0 => Clown f a a0 -> a0 Source #

sum :: Num a0 => Clown f a a0 -> a0 Source #

product :: Num a0 => Clown f a a0 -> a0 Source #

( Foldable (f a), Foldable (g a)) => Foldable ( Sum f g a)
Instance details

Defined in Data.Bifunctor.Sum

Methods

fold :: Monoid m => Sum f g a m -> m Source #

foldMap :: Monoid m => (a0 -> m) -> Sum f g a a0 -> m Source #

foldMap' :: Monoid m => (a0 -> m) -> Sum f g a a0 -> m Source #

foldr :: (a0 -> b -> b) -> b -> Sum f g a a0 -> b Source #

foldr' :: (a0 -> b -> b) -> b -> Sum f g a a0 -> b Source #

foldl :: (b -> a0 -> b) -> b -> Sum f g a a0 -> b Source #

foldl' :: (b -> a0 -> b) -> b -> Sum f g a a0 -> b Source #

foldr1 :: (a0 -> a0 -> a0) -> Sum f g a a0 -> a0 Source #

foldl1 :: (a0 -> a0 -> a0) -> Sum f g a a0 -> a0 Source #

toList :: Sum f g a a0 -> [a0] Source #

null :: Sum f g a a0 -> Bool Source #

length :: Sum f g a a0 -> Int Source #

elem :: Eq a0 => a0 -> Sum f g a a0 -> Bool Source #

maximum :: Ord a0 => Sum f g a a0 -> a0 Source #

minimum :: Ord a0 => Sum f g a a0 -> a0 Source #

sum :: Num a0 => Sum f g a a0 -> a0 Source #

product :: Num a0 => Sum f g a a0 -> a0 Source #

( Foldable (f a), Foldable (g a)) => Foldable ( Product f g a)
Instance details

Defined in Data.Bifunctor.Product

Methods

fold :: Monoid m => Product f g a m -> m Source #

foldMap :: Monoid m => (a0 -> m) -> Product f g a a0 -> m Source #

foldMap' :: Monoid m => (a0 -> m) -> Product f g a a0 -> m Source #

foldr :: (a0 -> b -> b) -> b -> Product f g a a0 -> b Source #

foldr' :: (a0 -> b -> b) -> b -> Product f g a a0 -> b Source #

foldl :: (b -> a0 -> b) -> b -> Product f g a a0 -> b Source #

foldl' :: (b -> a0 -> b) -> b -> Product f g a a0 -> b Source #

foldr1 :: (a0 -> a0 -> a0) -> Product f g a a0 -> a0 Source #

foldl1 :: (a0 -> a0 -> a0) -> Product f g a a0 -> a0 Source #

toList :: Product f g a a0 -> [a0] Source #

null :: Product f g a a0 -> Bool Source #

length :: Product f g a a0 -> Int Source #

elem :: Eq a0 => a0 -> Product f g a a0 -> Bool Source #

maximum :: Ord a0 => Product f g a a0 -> a0 Source #

minimum :: Ord a0 => Product f g a a0 -> a0 Source #

sum :: Num a0 => Product f g a a0 -> a0 Source #

product :: Num a0 => Product f g a a0 -> a0 Source #

( Foldable f, Bifoldable p) => Foldable ( Tannen f p a)
Instance details

Defined in Data.Bifunctor.Tannen

Methods

fold :: Monoid m => Tannen f p a m -> m Source #

foldMap :: Monoid m => (a0 -> m) -> Tannen f p a a0 -> m Source #

foldMap' :: Monoid m => (a0 -> m) -> Tannen f p a a0 -> m Source #

foldr :: (a0 -> b -> b) -> b -> Tannen f p a a0 -> b Source #

foldr' :: (a0 -> b -> b) -> b -> Tannen f p a a0 -> b Source #

foldl :: (b -> a0 -> b) -> b -> Tannen f p a a0 -> b Source #

foldl' :: (b -> a0 -> b) -> b -> Tannen f p a a0 -> b Source #

foldr1 :: (a0 -> a0 -> a0) -> Tannen f p a a0 -> a0 Source #

foldl1 :: (a0 -> a0 -> a0) -> Tannen f p a a0 -> a0 Source #

toList :: Tannen f p a a0 -> [a0] Source #

null :: Tannen f p a a0 -> Bool Source #

length :: Tannen f p a a0 -> Int Source #

elem :: Eq a0 => a0 -> Tannen f p a a0 -> Bool Source #

maximum :: Ord a0 => Tannen f p a a0 -> a0 Source #

minimum :: Ord a0 => Tannen f p a a0 -> a0 Source #

sum :: Num a0 => Tannen f p a a0 -> a0 Source #

product :: Num a0 => Tannen f p a a0 -> a0 Source #

( Bifoldable p, Foldable g) => Foldable ( Biff p f g a)
Instance details

Defined in Data.Bifunctor.Biff

Methods

fold :: Monoid m => Biff p f g a m -> m Source #

foldMap :: Monoid m => (a0 -> m) -> Biff p f g a a0 -> m Source #

foldMap' :: Monoid m => (a0 -> m) -> Biff p f g a a0 -> m Source #

foldr :: (a0 -> b -> b) -> b -> Biff p f g a a0 -> b Source #

foldr' :: (a0 -> b -> b) -> b -> Biff p f g a a0 -> b Source #

foldl :: (b -> a0 -> b) -> b -> Biff p f g a a0 -> b Source #

foldl' :: (b -> a0 -> b) -> b -> Biff p f g a a0 -> b Source #

foldr1 :: (a0 -> a0 -> a0) -> Biff p f g a a0 -> a0 Source #

foldl1 :: (a0 -> a0 -> a0) -> Biff p f g a a0 -> a0 Source #

toList :: Biff p f g a a0 -> [a0] Source #

null :: Biff p f g a a0 -> Bool Source #

length :: Biff p f g a a0 -> Int Source #

elem :: Eq a0 => a0 -> Biff p f g a a0 -> Bool Source #

maximum :: Ord a0 => Biff p f g a a0 -> a0 Source #

minimum :: Ord a0 => Biff p f g a a0 -> a0 Source #

sum :: Num a0 => Biff p f g a a0 -> a0 Source #

product :: Num a0 => Biff p f g a a0 -> a0 Source #

data FoldM m a b Source #

Like Fold , but monadic.

A ' FoldM m a b' processes elements of type a and results in a monadic value of type m b .

Instances

Instances details
Functor m => Profunctor ( FoldM m) Source #
Instance details

Defined in Control.Foldl

Methods

dimap :: (a -> b) -> (c -> d) -> FoldM m b c -> FoldM m a d Source #

lmap :: (a -> b) -> FoldM m b c -> FoldM m a c Source #

rmap :: (b -> c) -> FoldM m a b -> FoldM m a c Source #

(#.) :: forall a b c q. Coercible c b => q b c -> FoldM m a b -> FoldM m a c Source #

(.#) :: forall a b c q. Coercible b a => FoldM m b c -> q a b -> FoldM m a c Source #

Functor m => Functor ( FoldM m a) Source #
Instance details

Defined in Control.Foldl

Methods

fmap :: (a0 -> b) -> FoldM m a a0 -> FoldM m a b Source #

(<$) :: a0 -> FoldM m a b -> FoldM m a a0 Source #

Applicative m => Applicative ( FoldM m a) Source #
Instance details

Defined in Control.Foldl

Methods

pure :: a0 -> FoldM m a a0 Source #

(<*>) :: FoldM m a (a0 -> b) -> FoldM m a a0 -> FoldM m a b Source #

liftA2 :: (a0 -> b -> c) -> FoldM m a a0 -> FoldM m a b -> FoldM m a c Source #

(*>) :: FoldM m a a0 -> FoldM m a b -> FoldM m a b Source #

(<*) :: FoldM m a a0 -> FoldM m a b -> FoldM m a a0 Source #

Monad m => Extend ( FoldM m a) Source #
Instance details

Defined in Control.Foldl

Methods

duplicated :: FoldM m a a0 -> FoldM m a ( FoldM m a a0) Source #

extended :: ( FoldM m a a0 -> b) -> FoldM m a a0 -> FoldM m a b Source #

( Monad m, Floating b) => Floating ( FoldM m a b) Source #
Instance details

Defined in Control.Foldl

( Monad m, Fractional b) => Fractional ( FoldM m a b) Source #
Instance details

Defined in Control.Foldl

( Monad m, Num b) => Num ( FoldM m a b) Source #
Instance details

Defined in Control.Foldl

( Semigroup b, Monad m) => Semigroup ( FoldM m a b) Source #
Instance details

Defined in Control.Foldl

( Monoid b, Monad m) => Monoid ( FoldM m a b) Source #
Instance details

Defined in Control.Foldl

data Fold a b Source #

Efficient representation of a left fold that preserves the fold's step function, initial accumulator, and extraction function

This allows the Applicative instance to assemble derived folds that traverse the container only once

A ' Fold a b' processes elements of type a and results in a value of type b .

Instances

Instances details
Choice Fold Source #
Instance details

Defined in Control.Foldl

Profunctor Fold Source #
Instance details

Defined in Control.Foldl

Methods

dimap :: (a -> b) -> (c -> d) -> Fold b c -> Fold a d Source #

lmap :: (a -> b) -> Fold b c -> Fold a c Source #

rmap :: (b -> c) -> Fold a b -> Fold a c Source #

(#.) :: forall a b c q. Coercible c b => q b c -> Fold a b -> Fold a c Source #

(.#) :: forall a b c q. Coercible b a => Fold b c -> q a b -> Fold a c Source #

Functor ( Fold a) Source #
Instance details

Defined in Control.Foldl

Methods

fmap :: (a0 -> b) -> Fold a a0 -> Fold a b Source #

(<$) :: a0 -> Fold a b -> Fold a a0 Source #

Applicative ( Fold a) Source #
Instance details

Defined in Control.Foldl

Comonad ( Fold a) Source #
Instance details

Defined in Control.Foldl

Extend ( Fold a) Source #
Instance details

Defined in Control.Foldl

Semigroupoid Fold Source #
Instance details

Defined in Control.Foldl

Methods

o :: forall (j :: k) (k1 :: k) (i :: k). Fold j k1 -> Fold i j -> Fold i k1 Source #

Floating b => Floating ( Fold a b) Source #
Instance details

Defined in Control.Foldl

Fractional b => Fractional ( Fold a b) Source #
Instance details

Defined in Control.Foldl

Num b => Num ( Fold a b) Source #
Instance details

Defined in Control.Foldl

Semigroup b => Semigroup ( Fold a b) Source #
Instance details

Defined in Control.Foldl

Monoid b => Monoid ( Fold a b) Source #
Instance details

Defined in Control.Foldl

data Text Source #

A space efficient, packed, unboxed Unicode text type.

Instances

Instances details
Hashable Text
Instance details

Defined in Data.Hashable.Class

type Item Text
Instance details

Defined in Data.Text