pipes-4.3.13: Compositional pipelines

Safe Haskell | Trustworthy
Language | Haskell2010

Pipes

Contents

- The Proxy Monad Transformer
  - Producers
  - Consumers
  - Pipes
- ListT
- Utilities
- Re-exports

Description

This module is the recommended entry point to the `pipes` library.

Read Pipes.Tutorial if you want a tutorial explaining how to use this library.

Synopsis

- data Proxy a' a b' b m r
- type X = Void
- type Effect = Proxy X () () X
- type Effect' m r = forall x' x y' y. Proxy x' x y' y m r
- runEffect :: Monad m => Effect m r -> m r
- type Producer b = Proxy X () () b
- type Producer' b m r = forall x' x. Proxy x' x () b m r
- yield :: Functor m => a -> Producer' a m ()
- for :: Functor m => Proxy x' x b' b m a' -> (b -> Proxy x' x c' c m b') -> Proxy x' x c' c m a'
- (~>) :: Functor m => (a -> Proxy x' x b' b m a') -> (b -> Proxy x' x c' c m b') -> a -> Proxy x' x c' c m a'
- (<~) :: Functor m => (b -> Proxy x' x c' c m b') -> (a -> Proxy x' x b' b m a') -> a -> Proxy x' x c' c m a'
- type Consumer a = Proxy () a () X
- type Consumer' a m r = forall y' y. Proxy () a y' y m r
- await :: Functor m => Consumer' a m a
- (>~) :: Functor m => Proxy a' a y' y m b -> Proxy () b y' y m c -> Proxy a' a y' y m c
- (~<) :: Functor m => Proxy () b y' y m c -> Proxy a' a y' y m b -> Proxy a' a y' y m c
- type Pipe a b = Proxy () a () b
- cat :: Functor m => Pipe a a m r
- (>->) :: Functor m => Proxy a' a () b m r -> Proxy () b c' c m r -> Proxy a' a c' c m r
- (<-<) :: Functor m => Proxy () b c' c m r -> Proxy a' a () b m r -> Proxy a' a c' c m r
- newtype ListT m a = Select {
  - enumerate :: Producer a m ()
  }
- runListT :: Monad m => ListT m a -> m ()
- class Enumerable t where
- next :: Monad m => Producer a m r -> m (Either r (a, Producer a m r))
- each :: (Functor m, Foldable f) => f a -> Producer' a m ()
- every :: (Monad m, Enumerable t) => t m a -> Producer' a m ()
- discard :: Monad m => a -> m ()
- void :: Functor f => f a -> f ()
- class (Alternative m, Monad m) => MonadPlus (m :: * -> *) where
- class Monad m => MonadIO (m :: * -> *) where
- class MonadTrans (t :: (* -> *) -> * -> *) where
- class MFunctor (t :: (* -> *) -> k -> *) where
- class (MFunctor t, MonadTrans t) => MMonad (t :: (* -> *) -> * -> *) where
- class Foldable (t :: * -> *)

# The Proxy Monad Transformer

data Proxy a' a b' b m r #

A `Proxy` is a monad transformer that receives and sends information on both an upstream and downstream interface.

The type variables signify:

- `a'` and `a` - The upstream interface, where `(a')`s go out and `(a)`s come in
- `b'` and `b` - The downstream interface, where `(b)`s go out and `(b')`s come in
- `m` - The base monad
- `r` - The return value

Instances

MonadWriter w m => MonadWriter w (Proxy a' a b' b m) # |
Instance details Defined in Pipes.Internal Methods writer :: (a0, w) -> Proxy a' a b' b m a0 # tell :: w -> Proxy a' a b' b m () # listen :: Proxy a' a b' b m a0 -> Proxy a' a b' b m (a0, w) # pass :: Proxy a' a b' b m (a0, w -> w) -> Proxy a' a b' b m a0 #
MonadState s m => MonadState s (Proxy a' a b' b m) # |
Instance details Defined in Pipes.Internal Methods get :: Proxy a' a b' b m s # put :: s -> Proxy a' a b' b m () # state :: (s -> (a0, s)) -> Proxy a' a b' b m a0 #
MonadReader r m => MonadReader r (Proxy a' a b' b m) # |
Instance details Defined in Pipes.Internal Methods ask :: Proxy a' a b' b m r # local :: (r -> r) -> Proxy a' a b' b m a0 -> Proxy a' a b' b m a0 # reader :: (r -> a0) -> Proxy a' a b' b m a0 #
MonadError e m => MonadError e (Proxy a' a b' b m) # |
Instance details Defined in Pipes.Internal Methods throwError :: e -> Proxy a' a b' b m a0 # catchError :: Proxy a' a b' b m a0 -> (e -> Proxy a' a b' b m a0) -> Proxy a' a b' b m a0 #
MFunctor (Proxy a' a b' b :: (* -> *) -> * -> *) # |
Instance details Defined in Pipes.Internal Methods hoist :: Monad m => (forall a0. m a0 -> n a0) -> Proxy a' a b' b m b0 -> Proxy a' a b' b n b0 #
MMonad (Proxy a' a b' b) # |
Instance details Defined in Pipes.Internal Methods embed :: Monad n => (forall a0. m a0 -> Proxy a' a b' b n a0) -> Proxy a' a b' b m b0 -> Proxy a' a b' b n b0 #
MonadTrans (Proxy a' a b' b) # |
Instance details Defined in Pipes.Internal Methods lift :: Monad m => m a0 -> Proxy a' a b' b m a0 #
Functor m => Monad (Proxy a' a b' b m) # |
Instance details Defined in Pipes.Internal Methods (>>=) :: Proxy a' a b' b m a0 -> (a0 -> Proxy a' a b' b m b0) -> Proxy a' a b' b m b0 # (>>) :: Proxy a' a b' b m a0 -> Proxy a' a b' b m b0 -> Proxy a' a b' b m b0 # return :: a0 -> Proxy a' a b' b m a0 # fail :: String -> Proxy a' a b' b m a0 #
Functor m => Functor (Proxy a' a b' b m) # |
Instance details Defined in Pipes.Internal Methods fmap :: (a0 -> b0) -> Proxy a' a b' b m a0 -> Proxy a' a b' b m b0 # (<$) :: a0 -> Proxy a' a b' b m b0 -> Proxy a' a b' b m a0 #
MonadFail m => MonadFail (Proxy a' a b' b m) # |
Instance details Defined in Pipes.Internal Methods fail :: String -> Proxy a' a b' b m a0 #
Functor m => Applicative (Proxy a' a b' b m) # |
Instance details Defined in Pipes.Internal Methods pure :: a0 -> Proxy a' a b' b m a0 # (<*>) :: Proxy a' a b' b m (a0 -> b0) -> Proxy a' a b' b m a0 -> Proxy a' a b' b m b0 # liftA2 :: (a0 -> b0 -> c) -> Proxy a' a b' b m a0 -> Proxy a' a b' b m b0 -> Proxy a' a b' b m c # (*>) :: Proxy a' a b' b m a0 -> Proxy a' a b' b m b0 -> Proxy a' a b' b m b0 # (<*) :: Proxy a' a b' b m a0 -> Proxy a' a b' b m b0 -> Proxy a' a b' b m a0 #
MonadIO m => MonadIO (Proxy a' a b' b m) # |
Instance details Defined in Pipes.Internal Methods liftIO :: IO a0 -> Proxy a' a b' b m a0 #
MonadThrow m => MonadThrow (Proxy a' a b' b m) # |
Instance details Defined in Pipes.Internal Methods throwM :: Exception e => e -> Proxy a' a b' b m a0 #
MonadCatch m => MonadCatch (Proxy a' a b' b m) # |
Instance details Defined in Pipes.Internal Methods catch :: Exception e => Proxy a' a b' b m a0 -> (e -> Proxy a' a b' b m a0) -> Proxy a' a b' b m a0 #
(Functor m, Semigroup r) => Semigroup (Proxy a' a b' b m r) # |
Instance details Defined in Pipes.Internal Methods (<>) :: Proxy a' a b' b m r -> Proxy a' a b' b m r -> Proxy a' a b' b m r # sconcat :: NonEmpty (Proxy a' a b' b m r) -> Proxy a' a b' b m r # stimes :: Integral b0 => b0 -> Proxy a' a b' b m r -> Proxy a' a b' b m r #
(Functor m, Monoid r, Semigroup r) => Monoid (Proxy a' a b' b m r) # |
Instance details Defined in Pipes.Internal Methods mempty :: Proxy a' a b' b m r # mappend :: Proxy a' a b' b m r -> Proxy a' a b' b m r -> Proxy a' a b' b m r # mconcat :: [Proxy a' a b' b m r] -> Proxy a' a b' b m r #

type X = Void #

The empty type, used to close output ends

type Effect = Proxy X () () X #

An effect in the base monad

`Effect`s neither `await` nor `yield`

type Effect' m r = forall x' x y' y. Proxy x' x y' y m r #

Like `Effect`, but with a polymorphic type

runEffect :: Monad m => Effect m r -> m r #

Run a self-contained `Effect`, converting it back to the base monad

## Producers

Use `yield` to produce output and (`~>`) / `for` to substitute `yield`s.

`yield` and (`~>`) obey the `Category` laws:

    -- Substituting 'yield' with 'f' gives 'f'
    yield ~> f = f

    -- Substituting every 'yield' with another 'yield' does nothing
    f ~> yield = f

    -- 'yield' substitution is associative
    (f ~> g) ~> h = f ~> (g ~> h)

These are equivalent to the following "for loop laws":

    -- Looping over a single yield simplifies to function application
    for (yield x) f = f x

    -- Re-yielding every element of a stream returns the original stream
    for s yield = s

    -- Nested for loops can become a sequential for loops if the inner loop
    -- body ignores the outer loop variable
    for s (\a -> for (f a) g) = for (for s f) g = for s (f ~> g)

type Producer b = Proxy X () () b #

`Producer`s can only `yield`

type Producer' b m r = forall x' x. Proxy x' x () b m r #

Like `Producer`, but with a polymorphic type

yield :: Functor m => a -> Producer' a m () #

Produce a value

    yield :: Monad m => a -> Pipe x a m ()

for #

Arguments

:: Functor m |
=> Proxy x' x b' b m a' |
-> (b -> Proxy x' x c' c m b') |
-> Proxy x' x c' c m a' |

`(for p body)` loops over `p` replacing each `yield` with `body`.

    for :: Functor m => Producer b m r -> (b -> Effect       m ()) -> Effect       m r
    for :: Functor m => Producer b m r -> (b -> Producer   c m ()) -> Producer   c m r
    for :: Functor m => Pipe   x b m r -> (b -> Consumer x   m ()) -> Consumer x   m r
    for :: Functor m => Pipe   x b m r -> (b -> Pipe     x c m ()) -> Pipe     x c m r

The following diagrams show the flow of information:

                                  .--->   b
                                 /        |
       +-----------+            /   +-----|-----+                 +---------------+
       |           |           /    |     v     |                 |               |
       |           |          /     |           |                 |               |
    x ==>    p    ==> b   ---'   x ==>   body  ==> c     =     x ==> for p body  ==> c
       |           |                |           |                 |               |
       |     |     |                |     |     |                 |       |       |
       +-----|-----+                +-----|-----+                 +-------|-------+
             v                            v                               v
             r                            ()                              r

For a more complete diagram including bidirectional flow, see "Pipes.Core#respond-diagram".

(~>) infixr 4 #

Arguments

:: Functor m |
=> (a -> Proxy x' x b' b m a') |
-> (b -> Proxy x' x c' c m b') |
-> a -> Proxy x' x c' c m a' |

Compose loop bodies

    (~>) :: Functor m => (a -> Producer b m r) -> (b -> Effect       m ()) -> (a -> Effect       m r)
    (~>) :: Functor m => (a -> Producer b m r) -> (b -> Producer   c m ()) -> (a -> Producer   c m r)
    (~>) :: Functor m => (a -> Pipe   x b m r) -> (b -> Consumer x   m ()) -> (a -> Consumer x   m r)
    (~>) :: Functor m => (a -> Pipe   x b m r) -> (b -> Pipe     x c m ()) -> (a -> Pipe     x c m r)

The following diagrams show the flow of information:

             a                    .--->   b                              a
             |                   /        |                              |
       +-----|-----+            /   +-----|-----+                 +------|------+
       |     v     |           /    |     v     |                 |      v      |
       |           |          /     |           |                 |             |
    x ==>    f    ==> b   ---'   x ==>    g    ==> c     =     x ==>   f ~> g  ==> c
       |           |                |           |                 |             |
       |     |     |                |     |     |                 |      |      |
       +-----|-----+                +-----|-----+                 +------|------+
             v                            v                              v
             r                            ()                             r

For a more complete diagram including bidirectional flow, see "Pipes.Core#respond-diagram".

(<~) infixl 4 #

Arguments

:: Functor m |
=> (b -> Proxy x' x c' c m b') |
-> (a -> Proxy x' x b' b m a') |
-> a -> Proxy x' x c' c m a' |

(`~>`) with the arguments flipped

## Consumers

Use `await` to request input and (`>~`) to substitute `await`s.

`await` and (`>~`) obey the `Category` laws:

    -- Substituting every 'await' with another 'await' does nothing
    await >~ f = f

    -- Substituting 'await' with 'f' gives 'f'
    f >~ await = f

    -- 'await' substitution is associative
    (f >~ g) >~ h = f >~ (g >~ h)

type Consumer a = Proxy () a () X #

`Consumer`s can only `await`

type Consumer' a m r = forall y' y. Proxy () a y' y m r #

Like `Consumer`, but with a polymorphic type

await :: Functor m => Consumer' a m a #

Consume a value

    await :: Functor m => Pipe a y m a

(>~) infixr 5 #

Arguments

:: Functor m |
=> Proxy a' a y' y m b |
-> Proxy () b y' y m c |
-> Proxy a' a y' y m c |

`(draw >~ p)` loops over `p` replacing each `await` with `draw`

    (>~) :: Functor m => Effect       m b -> Consumer b   m c -> Effect       m c
    (>~) :: Functor m => Consumer a   m b -> Consumer b   m c -> Consumer a   m c
    (>~) :: Functor m => Producer   y m b -> Pipe     b y m c -> Producer   y m c
    (>~) :: Functor m => Pipe     a y m b -> Pipe     b y m c -> Pipe     a y m c

The following diagrams show the flow of information:

       +-----------+                 +-----------+                 +-------------+
       |           |                 |           |                 |             |
       |           |                 |           |                 |             |
    a ==>    f    ==> y   .--->   b ==>    g    ==> y     =     a ==>   f >~ g  ==> y
       |           |     /           |           |                 |             |
       |     |     |    /            |     |     |                 |      |      |
       +-----|-----+   /             +-----|-----+                 +------|------+
             v        /                    v                              v
             b   ----'                     c                              c

For a more complete diagram including bidirectional flow, see "Pipes.Core#request-diagram".

(~<) infixl 5 #

Arguments

:: Functor m |
=> Proxy () b y' y m c |
-> Proxy a' a y' y m b |
-> Proxy a' a y' y m c |

(`>~`) with the arguments flipped

## Pipes

Use `await` and `yield` to build `Pipe`s and (`>->`) to connect `Pipe`s.

`cat` and (`>->`) obey the `Category` laws:

    -- Useless use of cat
    cat >-> f = f

    -- Redirecting output to cat does nothing
    f >-> cat = f

    -- The pipe operator is associative
    (f >-> g) >-> h = f >-> (g >-> h)

type Pipe a b = Proxy () a () b #

`Pipe`s can both `await` and `yield`

cat :: Functor m => Pipe a a m r #

The identity `Pipe`, analogous to the Unix `cat` program

(>->) infixl 7 #

Arguments

:: Functor m |
=> Proxy a' a () b m r |
-> Proxy () b c' c m r |
-> Proxy a' a c' c m r |

`Pipe` composition, analogous to the Unix pipe operator

    (>->) :: Functor m => Producer b m r -> Consumer b   m r -> Effect       m r
    (>->) :: Functor m => Producer b m r -> Pipe     b c m r -> Producer   c m r
    (>->) :: Functor m => Pipe   a b m r -> Consumer b   m r -> Consumer a   m r
    (>->) :: Functor m => Pipe   a b m r -> Pipe     b c m r -> Pipe     a c m r

The following diagrams show the flow of information:

       +-----------+     +-----------+                 +-------------+
       |           |     |           |                 |             |
       |           |     |           |                 |             |
    a ==>    f    ==> b ==>    g    ==> c     =     a ==>  f >-> g  ==> c
       |           |     |           |                 |             |
       |     |     |     |     |     |                 |      |      |
       +-----|-----+     +-----|-----+                 +------|------+
             v                 v                              v
             r                 r                              r

For a more complete diagram including bidirectional flow, see "Pipes.Core#pull-diagram".

(<-<) infixr 7 #

Arguments

:: Functor m |
=> Proxy () b c' c m r |
-> Proxy a' a () b m r |
-> Proxy a' a c' c m r |

(`>->`) with the arguments flipped

# ListT

newtype ListT m a #

The list monad transformer, which extends a monad with non-determinism

`return` corresponds to `yield`, yielding a single value

(`>>=`) corresponds to `for`, calling the second computation once for each time the first computation `yield`s.

Constructors

Select |
Fields enumerate :: Producer a m ()

Instances

MMonad ListT # |
Instance details Defined in Pipes Methods embed :: Monad n => (forall a. m a -> ListT n a) -> ListT m b -> ListT n b #
MonadTrans ListT # |
Instance details Defined in Pipes Methods lift :: Monad m => m a -> ListT m a #
Enumerable ListT # |
Instance details Defined in Pipes Methods toListT :: Monad m => ListT m a -> ListT m a #
MonadWriter w m => MonadWriter w (ListT m) # |
Instance details Defined in Pipes Methods writer :: (a, w) -> ListT m a # tell :: w -> ListT m () # listen :: ListT m a -> ListT m (a, w) # pass :: ListT m (a, w -> w) -> ListT m a #
MonadState s m => MonadState s (ListT m) # |
Instance details Defined in Pipes Methods get :: ListT m s # put :: s -> ListT m () # state :: (s -> (a, s)) -> ListT m a #
MonadReader i m => MonadReader i (ListT m) # |
Instance details Defined in Pipes Methods ask :: ListT m i # local :: (i -> i) -> ListT m a -> ListT m a # reader :: (i -> a) -> ListT m a #
MonadError e m => MonadError e (ListT m) # |
Instance details Defined in Pipes Methods throwError :: e -> ListT m a # catchError :: ListT m a -> (e -> ListT m a) -> ListT m a #
Monad m => Monad (ListT m) # |
Instance details Defined in Pipes Methods (>>=) :: ListT m a -> (a -> ListT m b) -> ListT m b # (>>) :: ListT m a -> ListT m b -> ListT m b # return :: a -> ListT m a # fail :: String -> ListT m a #
Functor m => Functor (ListT m) # |
Instance details Defined in Pipes Methods fmap :: (a -> b) -> ListT m a -> ListT m b # (<$) :: a -> ListT m b -> ListT m a #
Monad m => MonadFail (ListT m) # |
Instance details Defined in Pipes Methods fail :: String -> ListT m a #
Functor m => Applicative (ListT m) # |
Instance details Defined in Pipes Methods pure :: a -> ListT m a # (<*>) :: ListT m (a -> b) -> ListT m a -> ListT m b # liftA2 :: (a -> b -> c) -> ListT m a -> ListT m b -> ListT m c # (*>) :: ListT m a -> ListT m b -> ListT m b # (<*) :: ListT m a -> ListT m b -> ListT m a #
Foldable m => Foldable (ListT m) # |
Instance details Defined in Pipes Methods fold :: Monoid m0 => ListT m m0 -> m0 # foldMap :: Monoid m0 => (a -> m0) -> ListT m a -> m0 # foldr :: (a -> b -> b) -> b -> ListT m a -> b # foldr' :: (a -> b -> b) -> b -> ListT m a -> b # foldl :: (b -> a -> b) -> b -> ListT m a -> b # foldl' :: (b -> a -> b) -> b -> ListT m a -> b # foldr1 :: (a -> a -> a) -> ListT m a -> a # foldl1 :: (a -> a -> a) -> ListT m a -> a # toList :: ListT m a -> [a] # null :: ListT m a -> Bool # length :: ListT m a -> Int # elem :: Eq a => a -> ListT m a -> Bool # maximum :: Ord a => ListT m a -> a # minimum :: Ord a => ListT m a -> a # sum :: Num a => ListT m a -> a # product :: Num a => ListT m a -> a #
(Functor m, Traversable m) => Traversable (ListT m) # |
Instance details Defined in Pipes Methods traverse :: Applicative f => (a -> f b) -> ListT m a -> f (ListT m b) # sequenceA :: Applicative f => ListT m (f a) -> f (ListT m a) # mapM :: Monad m0 => (a -> m0 b) -> ListT m a -> m0 (ListT m b) # sequence :: Monad m0 => ListT m (m0 a) -> m0 (ListT m a) #
Monad m => MonadZip (ListT m) # |
Instance details Defined in Pipes Methods mzip :: ListT m a -> ListT m b -> ListT m (a, b) # mzipWith :: (a -> b -> c) -> ListT m a -> ListT m b -> ListT m c # munzip :: ListT m (a, b) -> (ListT m a, ListT m b) #
MonadIO m => MonadIO (ListT m) # |
Instance details Defined in Pipes Methods liftIO :: IO a -> ListT m a #
Functor m => Alternative (ListT m) # |
Instance details Defined in Pipes Methods empty :: ListT m a # (<|>) :: ListT m a -> ListT m a -> ListT m a # some :: ListT m a -> ListT m [a] # many :: ListT m a -> ListT m [a] #
Monad m => MonadPlus (ListT m) # |
Instance details Defined in Pipes Methods mzero :: ListT m a # mplus :: ListT m a -> ListT m a -> ListT m a #
MonadThrow m => MonadThrow (ListT m) # |
Instance details Defined in Pipes Methods throwM :: Exception e => e -> ListT m a #
MonadCatch m => MonadCatch (ListT m) # |
Instance details Defined in Pipes Methods catch :: Exception e => ListT m a -> (e -> ListT m a) -> ListT m a #
MFunctor ListT # |
Instance details Defined in Pipes Methods hoist :: Monad m => (forall a. m a -> n a) -> ListT m b -> ListT n b #
Functor m => Semigroup (ListT m a) # |
Instance details Defined in Pipes Methods (<>) :: ListT m a -> ListT m a -> ListT m a # sconcat :: NonEmpty (ListT m a) -> ListT m a # stimes :: Integral b => b -> ListT m a -> ListT m a #
Functor m => Monoid (ListT m a) # |
Instance details Defined in Pipes Methods mempty :: ListT m a # mappend :: ListT m a -> ListT m a -> ListT m a # mconcat :: [ListT m a] -> ListT m a #

runListT :: Monad m => ListT m a -> m () #

Run a self-contained `ListT` computation

class Enumerable t where #

`Enumerable` generalizes `Foldable`, converting effectful containers to `ListT`s.

Instances of `Enumerable` must satisfy these two laws:

    toListT (return r) = return r

    toListT $ do x <- m  =  do x <- toListT m
                 f x           toListT (f x)

In other words, `toListT` is monad morphism.

Minimal complete definition

toListT

Methods

toListT :: Monad m => t m a -> ListT m a #

Instances

Enumerable MaybeT # |
Instance details Defined in Pipes Methods toListT :: Monad m => MaybeT m a -> ListT m a #
Enumerable ListT # |
Instance details Defined in Pipes Methods toListT :: Monad m => ListT m a -> ListT m a #
Enumerable (ExceptT e) # |
Instance details Defined in Pipes Methods toListT :: Monad m => ExceptT e m a -> ListT m a #
Enumerable (IdentityT :: (* -> *) -> * -> *) # |
Instance details Defined in Pipes Methods toListT :: Monad m => IdentityT m a -> ListT m a #

# Utilities

next :: Monad m => Producer a m r -> m (Either r (a, Producer a m r)) #

Consume the first value from a `Producer`

`next` either fails with a `Left` if the `Producer` terminates or succeeds with a `Right` providing the next value and the remainder of the `Producer`.

each :: (Functor m, Foldable f) => f a -> Producer' a m () #

Convert a `Foldable` to a `Producer`

every :: (Monad m, Enumerable t) => t m a -> Producer' a m () #

Convert an `Enumerable` to a `Producer`

discard :: Monad m => a -> m () #

Discards a value

# Re-exports

Control.Monad re-exports `void`

Control.Monad.IO.Class re-exports `MonadIO`.

Control.Monad.Trans.Class re-exports `MonadTrans`.

Control.Monad.Morph re-exports `MFunctor`.

Data.Foldable re-exports `Foldable` (the class name only).

void :: Functor f => f a -> f () #

``void` value` discards or ignores the result of evaluation, such as the return value of an `IO` action.

#### Examples

Expand

Replace the contents of a ``Maybe` `Int`` with unit:

    >>> void Nothing
    Nothing
    >>> void (Just 3)
    Just ()

Replace the contents of an ``Either` `Int` `Int`` with unit, resulting in an ``Either` `Int` '()'`:

    >>> void (Left 8675309)
    Left 8675309
    >>> void (Right 8675309)
    Right ()

Replace every element of a list with unit:

    >>> void [1,2,3]
    [(),(),()]

Replace the second element of a pair with unit:

    >>> void (1,2)
    (1,())

Discard the result of an `IO` action:

    >>> mapM print [1,2]
    1
    2
    [(),()]
    >>> void $ mapM print [1,2]
    1
    2

class (Alternative m, Monad m) => MonadPlus (m :: * -> *) where #

Monads that also support choice and failure.

Methods

mzero :: m a #

The identity of `mplus`. It should also satisfy the equations

    mzero >>= f  =  mzero
    v >> mzero   =  mzero

The default definition is

    mzero = empty

mplus :: m a -> m a -> m a #

An associative operation. The default definition is

    mplus = (<|>)

Instances

MonadPlus [] | Since: base-2.1
Instance details Defined in GHC.Base Methods mzero :: [a] # mplus :: [a] -> [a] -> [a] #
MonadPlus Maybe | Since: base-2.1
Instance details Defined in GHC.Base Methods mzero :: Maybe a # mplus :: Maybe a -> Maybe a -> Maybe a #
MonadPlus IO | Since: base-4.9.0.0
Instance details Defined in GHC.Base Methods mzero :: IO a # mplus :: IO a -> IO a -> IO a #
MonadPlus Option | Since: base-4.9.0.0
Instance details Defined in Data.Semigroup Methods mzero :: Option a # mplus :: Option a -> Option a -> Option a #
MonadPlus STM | Since: base-4.3.0.0
Instance details Defined in GHC.Conc.Sync Methods mzero :: STM a # mplus :: STM a -> STM a -> STM a #
MonadPlus ReadP | Since: base-2.1
Instance details Defined in Text.ParserCombinators.ReadP Methods mzero :: ReadP a # mplus :: ReadP a -> ReadP a -> ReadP a #
MonadPlus P | Since: base-2.1
Instance details Defined in Text.ParserCombinators.ReadP Methods mzero :: P a # mplus :: P a -> P a -> P a #
MonadPlus (U1 :: * -> *) | Since: base-4.9.0.0
Instance details Defined in GHC.Generics Methods mzero :: U1 a # mplus :: U1 a -> U1 a -> U1 a #
(ArrowApply a, ArrowPlus a) => MonadPlus (ArrowMonad a) | Since: base-4.6.0.0
Instance details Defined in Control.Arrow Methods mzero :: ArrowMonad a a0 # mplus :: ArrowMonad a a0 -> ArrowMonad a a0 -> ArrowMonad a a0 #
MonadPlus (Proxy :: * -> *) | Since: base-4.9.0.0
Instance details Defined in Data.Proxy Methods mzero :: Proxy a # mplus :: Proxy a -> Proxy a -> Proxy a #
Monad m => MonadPlus (MaybeT m) |
Instance details Defined in Control.Monad.Trans.Maybe Methods mzero :: MaybeT m a # mplus :: MaybeT m a -> MaybeT m a -> MaybeT m a #
Monad m => MonadPlus (ListT m) |
Instance details Defined in Control.Monad.Trans.List Methods mzero :: ListT m a # mplus :: ListT m a -> ListT m a -> ListT m a #
Monad m => MonadPlus (ListT m) # |
Instance details Defined in Pipes Methods mzero :: ListT m a # mplus :: ListT m a -> ListT m a -> ListT m a #
MonadPlus f => MonadPlus (Rec1 f) | Since: base-4.9.0.0
Instance details Defined in GHC.Generics Methods mzero :: Rec1 f a # mplus :: Rec1 f a -> Rec1 f a -> Rec1 f a #
MonadPlus f => MonadPlus (Alt f) |
Instance details Defined in Data.Semigroup.Internal Methods mzero :: Alt f a # mplus :: Alt f a -> Alt f a -> Alt f a #
(Monad m, Monoid e) => MonadPlus (ExceptT e m) |
Instance details Defined in Control.Monad.Trans.Except Methods mzero :: ExceptT e m a # mplus :: ExceptT e m a -> ExceptT e m a -> ExceptT e m a #
MonadPlus m => MonadPlus (IdentityT m) |
Instance details Defined in Control.Monad.Trans.Identity Methods mzero :: IdentityT m a # mplus :: IdentityT m a -> IdentityT m a -> IdentityT m a #
(Monad m, Error e) => MonadPlus (ErrorT e m) |
Instance details Defined in Control.Monad.Trans.Error Methods mzero :: ErrorT e m a # mplus :: ErrorT e m a -> ErrorT e m a -> ErrorT e m a #
MonadPlus m => MonadPlus (StateT s m) |
Instance details Defined in Control.Monad.Trans.State.Lazy Methods mzero :: StateT s m a # mplus :: StateT s m a -> StateT s m a -> StateT s m a #
MonadPlus m => MonadPlus (StateT s m) |
Instance details Defined in Control.Monad.Trans.State.Strict Methods mzero :: StateT s m a # mplus :: StateT s m a -> StateT s m a -> StateT s m a #
(Monoid w, MonadPlus m) => MonadPlus (WriterT w m) |
Instance details Defined in Control.Monad.Trans.Writer.Lazy Methods mzero :: WriterT w m a # mplus :: WriterT w m a -> WriterT w m a -> WriterT w m a #
(Monoid w, MonadPlus m) => MonadPlus (WriterT w m) |
Instance details Defined in Control.Monad.Trans.Writer.Strict Methods mzero :: WriterT w m a # mplus :: WriterT w m a -> WriterT w m a -> WriterT w m a #
(MonadPlus f, MonadPlus g) => MonadPlus (f :*: g) | Since: base-4.9.0.0
Instance details Defined in GHC.Generics Methods mzero :: (f :*: g) a # mplus :: (f :*: g) a -> (f :*: g) a -> (f :*: g) a #
(MonadPlus f, MonadPlus g) => MonadPlus (Product f g) | Since: base-4.9.0.0
Instance details Defined in Data.Functor.Product Methods mzero :: Product f g a # mplus :: Product f g a -> Product f g a -> Product f g a #
MonadPlus m => MonadPlus (ReaderT r m) |
Instance details Defined in Control.Monad.Trans.Reader Methods mzero :: ReaderT r m a # mplus :: ReaderT r m a -> ReaderT r m a -> ReaderT r m a #
MonadPlus f => MonadPlus (M1 i c f) | Since: base-4.9.0.0
Instance details Defined in GHC.Generics Methods mzero :: M1 i c f a # mplus :: M1 i c f a -> M1 i c f a -> M1 i c f a #
(Monoid w, MonadPlus m) => MonadPlus (RWST r w s m) |
Instance details Defined in Control.Monad.Trans.RWS.Lazy Methods mzero :: RWST r w s m a # mplus :: RWST r w s m a -> RWST r w s m a -> RWST r w s m a #
(Monoid w, MonadPlus m) => MonadPlus (RWST r w s m) |
Instance details Defined in Control.Monad.Trans.RWS.Strict Methods mzero :: RWST r w s m a # mplus :: RWST r w s m a -> RWST r w s m a -> RWST r w s m a #

class Monad m => MonadIO (m :: * -> *) where #

Monads in which `IO` computations may be embedded. Any monad built by applying a sequence of monad transformers to the `IO` monad will be an instance of this class.

Instances should satisfy the following laws, which state that `liftIO` is a transformer of monads:

-     liftIO . return = return

-     liftIO (m >>= f) = liftIO m >>= (liftIO . f)

Minimal complete definition

liftIO

Methods

liftIO :: IO a -> m a #

Lift a computation from the `IO` monad.

Instances

MonadIO IO | Since: base-4.9.0.0
Instance details Defined in Control.Monad.IO.Class Methods liftIO :: IO a -> IO a #
MonadIO Q |
Instance details Defined in Language.Haskell.TH.Syntax Methods liftIO :: IO a -> Q a #
MonadIO m => MonadIO (MaybeT m) |
Instance details Defined in Control.Monad.Trans.Maybe Methods liftIO :: IO a -> MaybeT m a #
MonadIO m => MonadIO (ListT m) |
Instance details Defined in Control.Monad.Trans.List Methods liftIO :: IO a -> ListT m a #
MonadIO m => MonadIO (ListT m) # |
Instance details Defined in Pipes Methods liftIO :: IO a -> ListT m a #
MonadIO m => MonadIO (ExceptT e m) |
Instance details Defined in Control.Monad.Trans.Except Methods liftIO :: IO a -> ExceptT e m a #
MonadIO m => MonadIO (IdentityT m) |
Instance details Defined in Control.Monad.Trans.Identity Methods liftIO :: IO a -> IdentityT m a #
(Error e, MonadIO m) => MonadIO (ErrorT e m) |
Instance details Defined in Control.Monad.Trans.Error Methods liftIO :: IO a -> ErrorT e m a #
MonadIO m => MonadIO (StateT s m) |
Instance details Defined in Control.Monad.Trans.State.Lazy Methods liftIO :: IO a -> StateT s m a #
MonadIO m => MonadIO (StateT s m) |
Instance details Defined in Control.Monad.Trans.State.Strict Methods liftIO :: IO a -> StateT s m a #
(Monoid w, MonadIO m) => MonadIO (WriterT w m) |
Instance details Defined in Control.Monad.Trans.Writer.Lazy Methods liftIO :: IO a -> WriterT w m a #
(Monoid w, MonadIO m) => MonadIO (WriterT w m) |
Instance details Defined in Control.Monad.Trans.Writer.Strict Methods liftIO :: IO a -> WriterT w m a #
MonadIO m => MonadIO (ContT r m) |
Instance details Defined in Control.Monad.Trans.Cont Methods liftIO :: IO a -> ContT r m a #
MonadIO m => MonadIO (ReaderT r m) |
Instance details Defined in Control.Monad.Trans.Reader Methods liftIO :: IO a -> ReaderT r m a #
(Monoid w, MonadIO m) => MonadIO (RWST r w s m) |
Instance details Defined in Control.Monad.Trans.RWS.Lazy Methods liftIO :: IO a -> RWST r w s m a #
(Monoid w, MonadIO m) => MonadIO (RWST r w s m) |
Instance details Defined in Control.Monad.Trans.RWS.Strict Methods liftIO :: IO a -> RWST r w s m a #
MonadIO m => MonadIO (Proxy a' a b' b m) # |
Instance details Defined in Pipes.Internal Methods liftIO :: IO a0 -> Proxy a' a b' b m a0 #

class MonadTrans (t :: (* -> *) -> * -> *) where #

The class of monad transformers. Instances should satisfy the following laws, which state that `lift` is a monad transformation:

-     lift . return = return

-     lift (m >>= f) = lift m >>= (lift . f)

Minimal complete definition

lift

Methods

lift :: Monad m => m a -> t m a #

Lift a computation from the argument monad to the constructed monad.

Instances

MonadTrans MaybeT |
Instance details Defined in Control.Monad.Trans.Maybe Methods lift :: Monad m => m a -> MaybeT m a #
MonadTrans ListT |
Instance details Defined in Control.Monad.Trans.List Methods lift :: Monad m => m a -> ListT m a #
MonadTrans ListT # |
Instance details Defined in Pipes Methods lift :: Monad m => m a -> ListT m a #
MonadTrans (ExceptT e) |
Instance details Defined in Control.Monad.Trans.Except Methods lift :: Monad m => m a -> ExceptT e m a #
MonadTrans (IdentityT :: (* -> *) -> * -> *) |
Instance details Defined in Control.Monad.Trans.Identity Methods lift :: Monad m => m a -> IdentityT m a #
MonadTrans (ErrorT e) |
Instance details Defined in Control.Monad.Trans.Error Methods lift :: Monad m => m a -> ErrorT e m a #
MonadTrans (StateT s) |
Instance details Defined in Control.Monad.Trans.State.Lazy Methods lift :: Monad m => m a -> StateT s m a #
MonadTrans (StateT s) |
Instance details Defined in Control.Monad.Trans.State.Strict Methods lift :: Monad m => m a -> StateT s m a #
Monoid w => MonadTrans (WriterT w) |
Instance details Defined in Control.Monad.Trans.Writer.Lazy Methods lift :: Monad m => m a -> WriterT w m a #
Monoid w => MonadTrans (WriterT w) |
Instance details Defined in Control.Monad.Trans.Writer.Strict Methods lift :: Monad m => m a -> WriterT w m a #
MonadTrans (ContT r) |
Instance details Defined in Control.Monad.Trans.Cont Methods lift :: Monad m => m a -> ContT r m a #
MonadTrans (ReaderT r :: (* -> *) -> * -> *) |
Instance details Defined in Control.Monad.Trans.Reader Methods lift :: Monad m => m a -> ReaderT r m a #
Monoid w => MonadTrans (RWST r w s) |
Instance details Defined in Control.Monad.Trans.RWS.Lazy Methods lift :: Monad m => m a -> RWST r w s m a #
Monoid w => MonadTrans (RWST r w s) |
Instance details Defined in Control.Monad.Trans.RWS.Strict Methods lift :: Monad m => m a -> RWST r w s m a #
MonadTrans (Proxy a' a b' b) # |
Instance details Defined in Pipes.Internal Methods lift :: Monad m => m a0 -> Proxy a' a b' b m a0 #

class MFunctor (t :: (* -> *) -> k -> *) where #

A functor in the category of monads, using `hoist` as the analog of `fmap`:

    hoist (f . g) = hoist f . hoist g

    hoist id = id

Minimal complete definition

hoist

Methods

hoist :: Monad m => (forall a. m a -> n a) -> t m b -> t n b #

Lift a monad morphism from `m` to `n` into a monad morphism from `(t m)` to `(t n)`

The first argument to `hoist` must be a monad morphism, even though the type system does not enforce this

Instances

MFunctor MaybeT |
Instance details Defined in Control.Monad.Morph Methods hoist :: Monad m => (forall a. m a -> n a) -> MaybeT m b -> MaybeT n b #
MFunctor ListT |
Instance details Defined in Control.Monad.Morph Methods hoist :: Monad m => (forall a. m a -> n a) -> ListT m b -> ListT n b #
MFunctor Lift |
Instance details Defined in Control.Monad.Morph Methods hoist :: Monad m => (forall a. m a -> n a) -> Lift m b -> Lift n b #
MFunctor ListT # |
Instance details Defined in Pipes Methods hoist :: Monad m => (forall a. m a -> n a) -> ListT m b -> ListT n b #
MFunctor (ExceptT e :: (* -> *) -> * -> *) |
Instance details Defined in Control.Monad.Morph Methods hoist :: Monad m => (forall a. m a -> n a) -> ExceptT e m b -> ExceptT e n b #
MFunctor (IdentityT :: (* -> *) -> * -> *) |
Instance details Defined in Control.Monad.Morph Methods hoist :: Monad m => (forall a. m a -> n a) -> IdentityT m b -> IdentityT n b #
MFunctor (ErrorT e :: (* -> *) -> * -> *) |
Instance details Defined in Control.Monad.Morph Methods hoist :: Monad m => (forall a. m a -> n a) -> ErrorT e m b -> ErrorT e n b #
MFunctor (StateT s :: (* -> *) -> * -> *) |
Instance details Defined in Control.Monad.Morph Methods hoist :: Monad m => (forall a. m a -> n a) -> StateT s m b -> StateT s n b #
MFunctor (StateT s :: (* -> *) -> * -> *) |
Instance details Defined in Control.Monad.Morph Methods hoist :: Monad m => (forall a. m a -> n a) -> StateT s m b -> StateT s n b #
MFunctor (WriterT w :: (* -> *) -> * -> *) |
Instance details Defined in Control.Monad.Morph Methods hoist :: Monad m => (forall a. m a -> n a) -> WriterT w m b -> WriterT w n b #
MFunctor (WriterT w :: (* -> *) -> * -> *) |
Instance details Defined in Control.Monad.Morph Methods hoist :: Monad m => (forall a. m a -> n a) -> WriterT w m b -> WriterT w n b #
MFunctor (Backwards :: (* -> *) -> * -> *) |
Instance details Defined in Control.Monad.Morph Methods hoist :: Monad m => (forall a. m a -> n a) -> Backwards m b -> Backwards n b #
MFunctor (Product f :: (* -> *) -> * -> *) |
Instance details Defined in Control.Monad.Morph Methods hoist :: Monad m => (forall a. m a -> n a) -> Product f m b -> Product f n b #
MFunctor (ReaderT r :: (* -> *) -> * -> *) |
Instance details Defined in Control.Monad.Morph Methods hoist :: Monad m => (forall a. m a -> n a) -> ReaderT r m b -> ReaderT r n b #
Functor f => MFunctor (Compose f :: (* -> *) -> * -> *) |
Instance details Defined in Control.Monad.Morph Methods hoist :: Monad m => (forall a. m a -> n a) -> Compose f m b -> Compose f n b #
MFunctor (RWST r w s :: (* -> *) -> * -> *) |
Instance details Defined in Control.Monad.Morph Methods hoist :: Monad m => (forall a. m a -> n a) -> RWST r w s m b -> RWST r w s n b #
MFunctor (RWST r w s :: (* -> *) -> * -> *) |
Instance details Defined in Control.Monad.Morph Methods hoist :: Monad m => (forall a. m a -> n a) -> RWST r w s m b -> RWST r w s n b #
MFunctor (Proxy a' a b' b :: (* -> *) -> * -> *) # |
Instance details Defined in Pipes.Internal Methods hoist :: Monad m => (forall a0. m a0 -> n a0) -> Proxy a' a b' b m b0 -> Proxy a' a b' b n b0 #

class (MFunctor t, MonadTrans t) => MMonad (t :: (* -> *) -> * -> *) where #

A monad in the category of monads, using `lift` from `MonadTrans` as the analog of `return` and `embed` as the analog of (`=<<`):

    embed lift = id

    embed f (lift m) = f m

    embed g (embed f t) = embed (\m -> embed g (f m)) t

Minimal complete definition

embed

Methods

embed :: Monad n => (forall a. m a -> t n a) -> t m b -> t n b #

Embed a newly created `MMonad` layer within an existing layer

`embed` is analogous to (`=<<`)

Instances

MMonad MaybeT |
Instance details Defined in Control.Monad.Morph Methods embed :: Monad n => (forall a. m a -> MaybeT n a) -> MaybeT m b -> MaybeT n b #
MMonad ListT |
Instance details Defined in Control.Monad.Morph Methods embed :: Monad n => (forall a. m a -> ListT n a) -> ListT m b -> ListT n b #
MMonad ListT # |
Instance details Defined in Pipes Methods embed :: Monad n => (forall a. m a -> ListT n a) -> ListT m b -> ListT n b #
MMonad (ExceptT e) |
Instance details Defined in Control.Monad.Morph Methods embed :: Monad n => (forall a. m a -> ExceptT e n a) -> ExceptT e m b -> ExceptT e n b #
MMonad (IdentityT :: (* -> *) -> * -> *) |
Instance details Defined in Control.Monad.Morph Methods embed :: Monad n => (forall a. m a -> IdentityT n a) -> IdentityT m b -> IdentityT n b #
Error e => MMonad (ErrorT e) |
Instance details Defined in Control.Monad.Morph Methods embed :: Monad n => (forall a. m a -> ErrorT e n a) -> ErrorT e m b -> ErrorT e n b #
Monoid w => MMonad (WriterT w) |
Instance details Defined in Control.Monad.Morph Methods embed :: Monad n => (forall a. m a -> WriterT w n a) -> WriterT w m b -> WriterT w n b #
Monoid w => MMonad (WriterT w) |
Instance details Defined in Control.Monad.Morph Methods embed :: Monad n => (forall a. m a -> WriterT w n a) -> WriterT w m b -> WriterT w n b #
MMonad (ReaderT r :: (* -> *) -> * -> *) |
Instance details Defined in Control.Monad.Morph Methods embed :: Monad n => (forall a. m a -> ReaderT r n a) -> ReaderT r m b -> ReaderT r n b #
MMonad (Proxy a' a b' b) # |
Instance details Defined in Pipes.Internal Methods embed :: Monad n => (forall a0. m a0 -> Proxy a' a b' b n a0) -> Proxy a' a b' b m b0 -> Proxy a' a b' b n b0 #

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)

Minimal complete definition

foldMap | foldr

Instances

Foldable [] | Since: base-2.1
Instance details Defined in Data.Foldable Methods 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 # toList :: [a] -> [a] # null :: [a] -> Bool # length :: [a] -> Int # elem :: Eq a => a -> [a] -> Bool # maximum :: Ord a => [a] -> a # minimum :: Ord a => [a] -> a # sum :: Num a => [a] -> a # product :: Num a => [a] -> a #
Foldable Maybe | Since: base-2.1
Instance details Defined in Data.Foldable Methods 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 # toList :: Maybe a -> [a] # null :: Maybe a -> Bool # length :: Maybe a -> Int # elem :: Eq a => a -> Maybe a -> Bool # maximum :: Ord a => Maybe a -> a # minimum :: Ord a => Maybe a -> a # sum :: Num a => Maybe a -> a # product :: Num a => Maybe a -> a #
Foldable Par1 |
Instance details Defined in Data.Foldable Methods 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 # toList :: Par1 a -> [a] # null :: Par1 a -> Bool # length :: Par1 a -> Int # elem :: Eq a => a -> Par1 a -> Bool # maximum :: Ord a => Par1 a -> a # minimum :: Ord a => Par1 a -> a # sum :: Num a => Par1 a -> a # product :: Num a => Par1 a -> a #
Foldable Min | Since: base-4.9.0.0
Instance details Defined in Data.Semigroup Methods 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 # toList :: Min a -> [a] # null :: Min a -> Bool # length :: Min a -> Int # elem :: Eq a => a -> Min a -> Bool # maximum :: Ord a => Min a -> a # minimum :: Ord a => Min a -> a # sum :: Num a => Min a -> a # product :: Num a => Min a -> a #
Foldable Max | Since: base-4.9.0.0
Instance details Defined in Data.Semigroup Methods 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 # toList :: Max a -> [a] # null :: Max a -> Bool # length :: Max a -> Int # elem :: Eq a => a -> Max a -> Bool # maximum :: Ord a => Max a -> a # minimum :: Ord a => Max a -> a # sum :: Num a => Max a -> a # product :: Num a => Max a -> a #
Foldable First | Since: base-4.9.0.0
Instance details Defined in Data.Semigroup Methods 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 # toList :: First a -> [a] # null :: First a -> Bool # length :: First a -> Int # elem :: Eq a => a -> First a -> Bool # maximum :: Ord a => First a -> a # minimum :: Ord a => First a -> a # sum :: Num a => First a -> a # product :: Num a => First a -> a #
Foldable Last | Since: base-4.9.0.0
Instance details Defined in Data.Semigroup Methods 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 # toList :: Last a -> [a] # null :: Last a -> Bool # length :: Last a -> Int # elem :: Eq a => a -> Last a -> Bool # maximum :: Ord a => Last a -> a # minimum :: Ord a => Last a -> a # sum :: Num a => Last a -> a # product :: Num a => Last a -> a #
Foldable Option | Since: base-4.9.0.0
Instance details Defined in Data.Semigroup Methods 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 # toList :: Option a -> [a] # null :: Option a -> Bool # length :: Option a -> Int # elem :: Eq a => a -> Option a -> Bool # maximum :: Ord a => Option a -> a # minimum :: Ord a => Option a -> a # sum :: Num a => Option a -> a # product :: Num a => Option a -> a #
Foldable ZipList |
Instance details Defined in Control.Applicative Methods 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 # toList :: ZipList a -> [a] # null :: ZipList a -> Bool # length :: ZipList a -> Int # elem :: Eq a => a -> ZipList a -> Bool # maximum :: Ord a => ZipList a -> a # minimum :: Ord a => ZipList a -> a # sum :: Num a => ZipList a -> a # product :: Num a => ZipList a -> a #
Foldable Identity | Since: base-4.8.0.0
Instance details Defined in Data.Functor.Identity Methods 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 # toList :: Identity a -> [a] # null :: Identity a -> Bool # length :: Identity a -> Int # elem :: Eq a => a -> Identity a -> Bool # maximum :: Ord a => Identity a -> a # minimum :: Ord a => Identity a -> a # sum :: Num a => Identity a -> a # product :: Num a => Identity a -> a #
Foldable First | Since: base-4.8.0.0
Instance details Defined in Data.Foldable Methods 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 # toList :: First a -> [a] # null :: First a -> Bool # length :: First a -> Int # elem :: Eq a => a -> First a -> Bool # maximum :: Ord a => First a -> a # minimum :: Ord a => First a -> a # sum :: Num a => First a -> a # product :: Num a => First a -> a #
Foldable Last | Since: base-4.8.0.0
Instance details Defined in Data.Foldable Methods 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 # toList :: Last a -> [a] # null :: Last a -> Bool # length :: Last a -> Int # elem :: Eq a => a -> Last a -> Bool # maximum :: Ord a => Last a -> a # minimum :: Ord a => Last a -> a # sum :: Num a => Last a -> a # product :: Num a => Last a -> a #
Foldable Dual | Since: base-4.8.0.0
Instance details Defined in Data.Foldable Methods 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 # toList :: Dual a -> [a] # null :: Dual a -> Bool # length :: Dual a -> Int # elem :: Eq a => a -> Dual a -> Bool # maximum :: Ord a => Dual a -> a # minimum :: Ord a => Dual a -> a # sum :: Num a => Dual a -> a # product :: Num a => Dual a -> a #
Foldable Sum | Since: base-4.8.0.0
Instance details Defined in Data.Foldable Methods 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 # toList :: Sum a -> [a] # null :: Sum a -> Bool # length :: Sum a -> Int # elem :: Eq a => a -> Sum a -> Bool # maximum :: Ord a => Sum a -> a # minimum :: Ord a => Sum a -> a # sum :: Num a => Sum a -> a # product :: Num a => Sum a -> a #
Foldable Product | Since: base-4.8.0.0
Instance details Defined in Data.Foldable Methods 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 # toList :: Product a -> [a] # null :: Product a -> Bool # length :: Product a -> Int # elem :: Eq a => a -> Product a -> Bool # maximum :: Ord a => Product a -> a # minimum :: Ord a => Product a -> a # sum :: Num a => Product a -> a # product :: Num a => Product a -> a #
Foldable NonEmpty | Since: base-4.9.0.0
Instance details Defined in Data.Foldable Methods 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 # toList :: NonEmpty a -> [a] # null :: NonEmpty a -> Bool # length :: NonEmpty a -> Int # elem :: Eq a => a -> NonEmpty a -> Bool # maximum :: Ord a => NonEmpty a -> a # minimum :: Ord a => NonEmpty a -> a # sum :: Num a => NonEmpty a -> a # product :: Num a => NonEmpty a -> a #
Foldable (Either a) | Since: base-4.7.0.0
Instance details Defined in Data.Foldable Methods 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] # null :: Either a a0 -> Bool # 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 # sum :: Num a0 => Either a a0 -> a0 # product :: Num a0 => Either a a0 -> a0 #
Foldable (V1 :: * -> *) |
Instance details Defined in Data.Foldable Methods 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 # toList :: V1 a -> [a] # null :: V1 a -> Bool # length :: V1 a -> Int # elem :: Eq a => a -> V1 a -> Bool # maximum :: Ord a => V1 a -> a # minimum :: Ord a => V1 a -> a # sum :: Num a => V1 a -> a # product :: Num a => V1 a -> a #
Foldable (U1 :: * -> *) | Since: base-4.9.0.0
Instance details Defined in Data.Foldable Methods 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 # toList :: U1 a -> [a] # null :: U1 a -> Bool # length :: U1 a -> Int # elem :: Eq a => a -> U1 a -> Bool # maximum :: Ord a => U1 a -> a # minimum :: Ord a => U1 a -> a # sum :: Num a => U1 a -> a # product :: Num a => U1 a -> a #
Foldable ((,) a) | Since: base-4.7.0.0
Instance details Defined in Data.Foldable Methods 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 # toList :: (a, a0) -> [a0] # null :: (a, a0) -> Bool # length :: (a, a0) -> Int # elem :: Eq a0 => a0 -> (a, a0) -> Bool # maximum :: Ord a0 => (a, a0) -> a0 # minimum :: Ord a0 => (a, a0) -> a0 # sum :: Num a0 => (a, a0) -> a0 # product :: Num a0 => (a, a0) -> a0 #
Foldable (Array i) | Since: base-4.8.0.0
Instance details Defined in Data.Foldable Methods 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 # toList :: Array i a -> [a] # null :: Array i a -> Bool # length :: Array i a -> Int # elem :: Eq a => a -> Array i a -> Bool # maximum :: Ord a => Array i a -> a # minimum :: Ord a => Array i a -> a # sum :: Num a => Array i a -> a # product :: Num a => Array i a -> a #
Foldable (Arg a) | Since: base-4.9.0.0
Instance details Defined in Data.Semigroup Methods 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 # toList :: Arg a a0 -> [a0] # null :: Arg a a0 -> Bool # length :: Arg a a0 -> Int # elem :: Eq a0 => a0 -> Arg a a0 -> Bool # maximum :: Ord a0 => Arg a a0 -> a0 # minimum :: Ord a0 => Arg a a0 -> a0 # sum :: Num a0 => Arg a a0 -> a0 # product :: Num a0 => Arg a a0 -> a0 #
Foldable (Proxy :: * -> *) | Since: base-4.7.0.0
Instance details Defined in Data.Foldable Methods 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 # toList :: Proxy a -> [a] # null :: Proxy a -> Bool # length :: Proxy a -> Int # elem :: Eq a => a -> Proxy a -> Bool # maximum :: Ord a => Proxy a -> a # minimum :: Ord a => Proxy a -> a # sum :: Num a => Proxy a -> a # product :: Num a => Proxy a -> a #
Foldable f => Foldable (MaybeT f) |
Instance details Defined in Control.Monad.Trans.Maybe Methods 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 # toList :: MaybeT f a -> [a] # null :: MaybeT f a -> Bool # length :: MaybeT f a -> Int # elem :: Eq a => a -> MaybeT f a -> Bool # maximum :: Ord a => MaybeT f a -> a # minimum :: Ord a => MaybeT f a -> a # sum :: Num a => MaybeT f a -> a # product :: Num a => MaybeT f a -> a #
Foldable f => Foldable (ListT f) |
Instance details Defined in Control.Monad.Trans.List Methods 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 # toList :: ListT f a -> [a] # null :: ListT f a -> Bool # length :: ListT f a -> Int # elem :: Eq a => a -> ListT f a -> Bool # maximum :: Ord a => ListT f a -> a # minimum :: Ord a => ListT f a -> a # sum :: Num a => ListT f a -> a # product :: Num a => ListT f a -> a #
Foldable f => Foldable (Lift f) |
Instance details Defined in Control.Applicative.Lift Methods fold :: Monoid m => Lift f m -> m # foldMap :: Monoid m => (a -> m) -> Lift f a -> m # foldr :: (a -> b -> b) -> b -> Lift f a -> b # foldr' :: (a -> b -> b) -> b -> Lift f a -> b # foldl :: (b -> a -> b) -> b -> Lift f a -> b # foldl' :: (b -> a -> b) -> b -> Lift f a -> b # foldr1 :: (a -> a -> a) -> Lift f a -> a # foldl1 :: (a -> a -> a) -> Lift f a -> a # toList :: Lift f a -> [a] # null :: Lift f a -> Bool # length :: Lift f a -> Int # elem :: Eq a => a -> Lift f a -> Bool # maximum :: Ord a => Lift f a -> a # minimum :: Ord a => Lift f a -> a # sum :: Num a => Lift f a -> a # product :: Num a => Lift f a -> a #
Foldable m => Foldable (ListT m) # |
Instance details Defined in Pipes Methods fold :: Monoid m0 => ListT m m0 -> m0 # foldMap :: Monoid m0 => (a -> m0) -> ListT m a -> m0 # foldr :: (a -> b -> b) -> b -> ListT m a -> b # foldr' :: (a -> b -> b) -> b -> ListT m a -> b # foldl :: (b -> a -> b) -> b -> ListT m a -> b # foldl' :: (b -> a -> b) -> b -> ListT m a -> b # foldr1 :: (a -> a -> a) -> ListT m a -> a # foldl1 :: (a -> a -> a) -> ListT m a -> a # toList :: ListT m a -> [a] # null :: ListT m a -> Bool # length :: ListT m a -> Int # elem :: Eq a => a -> ListT m a -> Bool # maximum :: Ord a => ListT m a -> a # minimum :: Ord a => ListT m a -> a # sum :: Num a => ListT m a -> a # product :: Num a => ListT m a -> a #
Foldable f => Foldable (Rec1 f) |
Instance details Defined in Data.Foldable Methods 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 # toList :: Rec1 f a -> [a] # null :: Rec1 f a -> Bool # length :: Rec1 f a -> Int # elem :: Eq a => a -> Rec1 f a -> Bool # maximum :: Ord a => Rec1 f a -> a # minimum :: Ord a => Rec1 f a -> a # sum :: Num a => Rec1 f a -> a # product :: Num a => Rec1 f a -> a #
Foldable (URec Char :: * -> *) |
Instance details Defined in Data.Foldable Methods 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] # null :: URec Char a -> Bool # 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 # sum :: Num a => URec Char a -> a # product :: Num a => URec Char a -> a #
Foldable (URec Double :: * -> *) |
Instance details Defined in Data.Foldable Methods 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 # sum :: Num a => URec Double a -> a # product :: Num a => URec Double a -> a #
Foldable (URec Float :: * -> *) |
Instance details Defined in Data.Foldable Methods 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 # sum :: Num a => URec Float a -> a # product :: Num a => URec Float a -> a #
Foldable (URec Int :: * -> *) |
Instance details Defined in Data.Foldable Methods 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 # toList :: URec Int a -> [a] # null :: URec Int a -> Bool # length :: URec Int a -> Int # elem :: Eq a => a -> URec Int a -> Bool # maximum :: Ord a => URec Int a -> a # minimum :: Ord a => URec Int a -> a # sum :: Num a => URec Int a -> a # product :: Num a => URec Int a -> a #
Foldable (URec Word :: * -> *) |
Instance details Defined in Data.Foldable Methods 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] # null :: URec Word a -> Bool # 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 # sum :: Num a => URec Word a -> a # product :: Num a => URec Word a -> a #
Foldable (URec (Ptr ()) :: * -> *) |
Instance details Defined in Data.Foldable Methods 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 # sum :: Num a => URec (Ptr ()) a -> a # product :: Num a => URec (Ptr ()) a -> a #
Foldable (Const m :: * -> *) | Since: base-4.7.0.0
Instance details Defined in Data.Functor.Const Methods 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 # toList :: Const m a -> [a] # null :: Const m a -> Bool # length :: Const m a -> Int # elem :: Eq a => a -> Const m a -> Bool # maximum :: Ord a => Const m a -> a # minimum :: Ord a => Const m a -> a # sum :: Num a => Const m a -> a # product :: Num a => Const m a -> a #
Foldable f => Foldable (ExceptT e f) |
Instance details Defined in Control.Monad.Trans.Except Methods 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 # sum :: Num a => ExceptT e f a -> a # product :: Num a => ExceptT e f a -> a #
Foldable f => Foldable (IdentityT f) |
Instance details Defined in Control.Monad.Trans.Identity Methods 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 # sum :: Num a => IdentityT f a -> a # product :: Num a => IdentityT f a -> a #
Foldable f => Foldable (ErrorT e f) |
Instance details Defined in Control.Monad.Trans.Error Methods 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 # sum :: Num a => ErrorT e f a -> a # product :: Num a => ErrorT e f a -> a #
Foldable f => Foldable (WriterT w f) |
Instance details Defined in Control.Monad.Trans.Writer.Lazy Methods 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 # sum :: Num a => WriterT w f a -> a # product :: Num a => WriterT w f a -> a #
Foldable f => Foldable (WriterT w f) |
Instance details Defined in Control.Monad.Trans.Writer.Strict Methods 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 # sum :: Num a => WriterT w f a -> a # product :: Num a => WriterT w f a -> a #
Foldable f => Foldable (Backwards f) | Derived instance.
Instance details Defined in Control.Applicative.Backwards Methods fold :: Monoid m => Backwards f m -> m # foldMap :: Monoid m => (a -> m) -> Backwards f a -> m # foldr :: (a -> b -> b) -> b -> Backwards f a -> b # foldr' :: (a -> b -> b) -> b -> Backwards f a -> b # foldl :: (b -> a -> b) -> b -> Backwards f a -> b # foldl' :: (b -> a -> b) -> b -> Backwards f a -> b # foldr1 :: (a -> a -> a) -> Backwards f a -> a # foldl1 :: (a -> a -> a) -> Backwards f a -> a # toList :: Backwards f a -> [a] # null :: Backwards f a -> Bool # length :: Backwards f a -> Int # elem :: Eq a => a -> Backwards f a -> Bool # maximum :: Ord a => Backwards f a -> a # minimum :: Ord a => Backwards f a -> a # sum :: Num a => Backwards f a -> a # product :: Num a => Backwards f a -> a #
Foldable (K1 i c :: * -> *) |
Instance details Defined in Data.Foldable Methods 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 # toList :: K1 i c a -> [a] # null :: K1 i c a -> Bool # length :: K1 i c a -> Int # 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 # sum :: Num a => K1 i c a -> a # product :: Num a => K1 i c a -> a #
(Foldable f, Foldable g) => Foldable (f :+: g) |
Instance details Defined in Data.Foldable Methods 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] # null :: (f :+: g) a -> Bool # 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 # sum :: Num a => (f :+: g) a -> a # product :: Num a => (f :+: g) a -> a #
(Foldable f, Foldable g) => Foldable (f :*: g) |
Instance details Defined in Data.Foldable Methods 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] # null :: (f :*: g) a -> Bool # 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 # sum :: Num a => (f :*: g) a -> a # product :: Num a => (f :*: g) a -> a #
(Foldable f, Foldable g) => Foldable (Product f g) | Since: base-4.9.0.0
Instance details Defined in Data.Functor.Product Methods 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 # sum :: Num a => Product f g a -> a # product :: Num a => Product f g a -> a #
Foldable f => Foldable (M1 i c f) |
Instance details Defined in Data.Foldable Methods 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 # toList :: M1 i c f a -> [a] # null :: M1 i c f a -> Bool # length :: M1 i c f a -> Int # 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 # sum :: Num a => M1 i c f a -> a # product :: Num a => M1 i c f a -> a #
(Foldable f, Foldable g) => Foldable (f :.: g) |
Instance details Defined in Data.Foldable Methods 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] # null :: (f :.: g) a -> Bool # 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 # sum :: Num a => (f :.: g) a -> a # product :: Num a => (f :.: g) a -> a #
(Foldable f, Foldable g) => Foldable (Compose f g) | Since: base-4.9.0.0
Instance details Defined in Data.Functor.Compose Methods 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 # sum :: Num a => Compose f g a -> a # product :: Num a => Compose f g a -> a #