Conduit

conduit-combinators-1.0.5: Commonly used conduit functions, for both chunked and unchunked data

Safe Haskell | None
Language | Haskell98

Conduit

Contents

- Core conduit library
- Commonly used combinators
  - Producers
    - Pure
    - Monadic
    - I/O
    - Random numbers
    - Filesystem
  - Consumers
    - Pure
    - Monadic
    - I/O
  - Transformers
    - Pure
      - Binary base encoding
    - Monadic
    - Textual
  - Special
- Monadic lifting
- ResourceT
- Acquire
- Pure pipelines

Description

Your intended one-stop-shop for conduit functionality. This re-exports functions from many commonly used modules. When there is a conflict with standard functions, functions in this module are disambiguated by adding a trailing C (or for chunked functions, replacing a trailing E with CE). This means that the Conduit module can be imported unqualified without causing naming conflicts.

For more information on the naming scheme and intended usages of the combinators, please see the Data.Conduit.Combinators documentation.

Synopsis

- module Data.Conduit
- module Data.Conduit.Lift
- yieldMany :: (Monad m, MonoFoldable mono) => mono -> Producer m (Element mono)
- unfoldC :: Monad m => (b -> Maybe (a, b)) -> b -> Producer m a
- enumFromToC :: (Monad m, Enum a, Ord a) => a -> a -> Producer m a
- iterateC :: Monad m => (a -> a) -> a -> Producer m a
- repeatC :: Monad m => a -> Producer m a
- replicateC :: Monad m => Int -> a -> Producer m a
- sourceLazy :: (Monad m, LazySequence lazy strict) => lazy -> Producer m strict
- repeatMC :: Monad m => m a -> Producer m a
- repeatWhileMC :: Monad m => m a -> (a -> Bool) -> Producer m a
- replicateMC :: Monad m => Int -> m a -> Producer m a
- sourceFile :: (MonadResource m, IOData a, MonoFoldable a) => FilePath -> Producer m a
- sourceHandle :: (MonadIO m, IOData a, MonoFoldable a) => Handle -> Producer m a
- sourceIOHandle :: (MonadResource m, IOData a, MonoFoldable a) => IO Handle -> Producer m a
- stdinC :: (MonadIO m, IOData a, MonoFoldable a) => Producer m a
- sourceRandom :: (Variate a, MonadIO m) => Producer m a
- sourceRandomN :: (Variate a, MonadIO m) => Int -> Producer m a
- sourceRandomGen :: (Variate a, MonadBase base m, PrimMonad base) => Gen (PrimState base) -> Producer m a
- sourceRandomNGen :: (Variate a, MonadBase base m, PrimMonad base) => Gen (PrimState base) -> Int -> Producer m a
- sourceRandomWith :: (Variate a, MonadIO m) => (GenIO -> IO a) -> Producer m a
- sourceRandomNWith :: (Variate a, MonadIO m) => Int -> (GenIO -> IO a) -> Producer m a
- sourceRandomGenWith :: (Variate a, MonadBase base m, PrimMonad base) => Gen (PrimState base) -> (Gen (PrimState base) -> base a) -> Producer m a
- sourceRandomNGenWith :: (Variate a, MonadBase base m, PrimMonad base) => Gen (PrimState base) -> Int -> (Gen (PrimState base) -> base a) -> Producer m a
- sourceDirectory :: MonadResource m => FilePath -> Producer m FilePath
- sourceDirectoryDeep :: MonadResource m => Bool -> FilePath -> Producer m FilePath
- dropC :: Monad m => Int -> Consumer a m ()
- dropCE :: (Monad m, IsSequence seq) => Index seq -> Consumer seq m ()
- dropWhileC :: Monad m => (a -> Bool) -> Consumer a m ()
- dropWhileCE :: (Monad m, IsSequence seq) => (Element seq -> Bool) -> Consumer seq m ()
- foldC :: (Monad m, Monoid a) => Consumer a m a
- foldCE :: (Monad m, MonoFoldable mono, Monoid (Element mono)) => Consumer mono m (Element mono)
- foldlC :: Monad m => (a -> b -> a) -> a -> Consumer b m a
- foldlCE :: (Monad m, MonoFoldable mono) => (a -> Element mono -> a) -> a -> Consumer mono m a
- foldMapC :: (Monad m, Monoid b) => (a -> b) -> Consumer a m b
- foldMapCE :: (Monad m, MonoFoldable mono, Monoid w) => (Element mono -> w) -> Consumer mono m w
- allC :: Monad m => (a -> Bool) -> Consumer a m Bool
- allCE :: (Monad m, MonoFoldable mono) => (Element mono -> Bool) -> Consumer mono m Bool
- anyC :: Monad m => (a -> Bool) -> Consumer a m Bool
- anyCE :: (Monad m, MonoFoldable mono) => (Element mono -> Bool) -> Consumer mono m Bool
- andC :: Monad m => Consumer Bool m Bool
- andCE :: (Monad m, MonoFoldable mono, Element mono ~ Bool) => Consumer mono m Bool
- orC :: Monad m => Consumer Bool m Bool
- orCE :: (Monad m, MonoFoldable mono, Element mono ~ Bool) => Consumer mono m Bool
- elemC :: (Monad m, Eq a) => a -> Consumer a m Bool
- elemCE :: (Monad m, IsSequence seq, Eq (Element seq)) => Element seq -> Consumer seq m Bool
- notElemC :: (Monad m, Eq a) => a -> Consumer a m Bool
- notElemCE :: (Monad m, IsSequence seq, Eq (Element seq)) => Element seq -> Consumer seq m Bool
- sinkLazy :: (Monad m, LazySequence lazy strict) => Consumer strict m lazy
- sinkList :: Monad m => Consumer a m [a]
- sinkVector :: (MonadBase base m, Vector v a, PrimMonad base) => Consumer a m (v a)
- sinkVectorN :: (MonadBase base m, Vector v a, PrimMonad base) => Int -> Consumer a m (v a)
- sinkBuilder :: (Monad m, Monoid builder, ToBuilder a builder) => Consumer a m builder
- sinkLazyBuilder :: (Monad m, Monoid builder, ToBuilder a builder, Builder builder lazy) => Consumer a m lazy
- sinkNull :: Monad m => Consumer a m ()
- awaitNonNull :: (Monad m, MonoFoldable a) => Consumer a m (Maybe (NonNull a))
- headC :: Monad m => Consumer a m (Maybe a)
- headDefC :: Monad m => a -> Consumer a m a
- headCE :: (Monad m, IsSequence seq) => Consumer seq m (Maybe (Element seq))
- peekC :: Monad m => Consumer a m (Maybe a)
- peekCE :: (Monad m, MonoFoldable mono) => Consumer mono m (Maybe (Element mono))
- lastC :: Monad m => Consumer a m (Maybe a)
- lastDefC :: Monad m => a -> Consumer a m a
- lastCE :: (Monad m, IsSequence seq) => Consumer seq m (Maybe (Element seq))
- lengthC :: (Monad m, Num len) => Consumer a m len
- lengthCE :: (Monad m, Num len, MonoFoldable mono) => Consumer mono m len
- lengthIfC :: (Monad m, Num len) => (a -> Bool) -> Consumer a m len
- lengthIfCE :: (Monad m, Num len, MonoFoldable mono) => (Element mono -> Bool) -> Consumer mono m len
- maximumC :: (Monad m, Ord a) => Consumer a m (Maybe a)
- maximumCE :: (Monad m, IsSequence seq, Ord (Element seq)) => Consumer seq m (Maybe (Element seq))
- minimumC :: (Monad m, Ord a) => Consumer a m (Maybe a)
- minimumCE :: (Monad m, IsSequence seq, Ord (Element seq)) => Consumer seq m (Maybe (Element seq))
- nullC :: Monad m => Consumer a m Bool
- nullCE :: (Monad m, MonoFoldable mono) => Consumer mono m Bool
- sumC :: (Monad m, Num a) => Consumer a m a
- sumCE :: (Monad m, MonoFoldable mono, Num (Element mono)) => Consumer mono m (Element mono)
- productC :: (Monad m, Num a) => Consumer a m a
- productCE :: (Monad m, MonoFoldable mono, Num (Element mono)) => Consumer mono m (Element mono)
- findC :: Monad m => (a -> Bool) -> Consumer a m (Maybe a)
- mapM_C :: Monad m => (a -> m ()) -> Consumer a m ()
- mapM_CE :: (Monad m, MonoFoldable mono) => (Element mono -> m ()) -> Consumer mono m ()
- foldMC :: Monad m => (a -> b -> m a) -> a -> Consumer b m a
- foldMCE :: (Monad m, MonoFoldable mono) => (a -> Element mono -> m a) -> a -> Consumer mono m a
- foldMapMC :: (Monad m, Monoid w) => (a -> m w) -> Consumer a m w
- foldMapMCE :: (Monad m, MonoFoldable mono, Monoid w) => (Element mono -> m w) -> Consumer mono m w
- sinkFile :: (MonadResource m, IOData a) => FilePath -> Consumer a m ()
- sinkHandle :: (MonadIO m, IOData a) => Handle -> Consumer a m ()
- sinkIOHandle :: (MonadResource m, IOData a) => IO Handle -> Consumer a m ()
- printC :: (Show a, MonadIO m) => Consumer a m ()
- stdoutC :: (MonadIO m, IOData a) => Consumer a m ()
- stderrC :: (MonadIO m, IOData a) => Consumer a m ()
- mapC :: Monad m => (a -> b) -> Conduit a m b
- mapCE :: (Monad m, Functor f) => (a -> b) -> Conduit (f a) m (f b)
- omapCE :: (Monad m, MonoFunctor mono) => (Element mono -> Element mono) -> Conduit mono m mono
- concatMapC :: (Monad m, MonoFoldable mono) => (a -> mono) -> Conduit a m (Element mono)
- concatMapCE :: (Monad m, MonoFoldable mono, Monoid w) => (Element mono -> w) -> Conduit mono m w
- takeC :: Monad m => Int -> Conduit a m a
- takeCE :: (Monad m, IsSequence seq) => Index seq -> Conduit seq m seq
- takeWhileC :: Monad m => (a -> Bool) -> Conduit a m a
- takeWhileCE :: (Monad m, IsSequence seq) => (Element seq -> Bool) -> Conduit seq m seq
- takeExactlyC :: Monad m => Int -> ConduitM a b m r -> ConduitM a b m r
- takeExactlyCE :: (Monad m, IsSequence a) => Index a -> ConduitM a b m r -> ConduitM a b m r
- concatC :: (Monad m, MonoFoldable mono) => Conduit mono m (Element mono)
- filterC :: Monad m => (a -> Bool) -> Conduit a m a
- filterCE :: (IsSequence seq, Monad m) => (Element seq -> Bool) -> Conduit seq m seq
- mapWhileC :: Monad m => (a -> Maybe b) -> Conduit a m b
- conduitVector :: (MonadBase base m, Vector v a, PrimMonad base) => Int -> Conduit a m (v a)
- scanlC :: Monad m => (a -> b -> a) -> a -> Conduit b m a
- mapAccumWhileC :: Monad m => (a -> s -> Either s (s, b)) -> s -> ConduitM a b m s
- concatMapAccumC :: Monad m => (a -> accum -> (accum, [b])) -> accum -> Conduit a m b
- intersperseC :: Monad m => a -> Conduit a m a
- slidingWindowC :: (Monad m, IsSequence seq, Element seq ~ a) => Int -> Conduit a m seq
- encodeBase64C :: Monad m => Conduit ByteString m ByteString
- decodeBase64C :: Monad m => Conduit ByteString m ByteString
- encodeBase64URLC :: Monad m => Conduit ByteString m ByteString
- decodeBase64URLC :: Monad m => Conduit ByteString m ByteString
- encodeBase16C :: Monad m => Conduit ByteString m ByteString
- decodeBase16C :: Monad m => Conduit ByteString m ByteString
- mapMC :: Monad m => (a -> m b) -> Conduit a m b
- mapMCE :: (Monad m, Traversable f) => (a -> m b) -> Conduit (f a) m (f b)
- omapMCE :: (Monad m, MonoTraversable mono) => (Element mono -> m (Element mono)) -> Conduit mono m mono
- concatMapMC :: (Monad m, MonoFoldable mono) => (a -> m mono) -> Conduit a m (Element mono)
- filterMC :: Monad m => (a -> m Bool) -> Conduit a m a
- filterMCE :: (Monad m, IsSequence seq) => (Element seq -> m Bool) -> Conduit seq m seq
- iterMC :: Monad m => (a -> m ()) -> Conduit a m a
- scanlMC :: Monad m => (a -> b -> m a) -> a -> Conduit b m a
- mapAccumWhileMC :: Monad m => (a -> s -> m (Either s (s, b))) -> s -> ConduitM a b m s
- concatMapAccumMC :: Monad m => (a -> accum -> m (accum, [b])) -> accum -> Conduit a m b
- encodeUtf8C :: (Monad m, Utf8 text binary) => Conduit text m binary
- decodeUtf8C :: MonadThrow m => Conduit ByteString m Text
- decodeUtf8LenientC :: MonadThrow m => Conduit ByteString m Text
- lineC :: (Monad m, IsSequence seq, Element seq ~ Char) => ConduitM seq o m r -> ConduitM seq o m r
- lineAsciiC :: (Monad m, IsSequence seq, Element seq ~ Word8) => ConduitM seq o m r -> ConduitM seq o m r
- unlinesC :: (Monad m, IsSequence seq, Element seq ~ Char) => Conduit seq m seq
- unlinesAsciiC :: (Monad m, IsSequence seq, Element seq ~ Word8) => Conduit seq m seq
- linesUnboundedC :: (Monad m, IsSequence seq, Element seq ~ Char) => Conduit seq m seq
- linesUnboundedAsciiC :: (Monad m, IsSequence seq, Element seq ~ Word8) => Conduit seq m seq
- vectorBuilderC :: (PrimMonad base, MonadBase base m, Vector v e, MonadBase base n) => Int -> ((e -> n ()) -> Sink i m r) -> ConduitM i (v e) m r
- mapAccumS :: Monad m => (a -> s -> Sink b m s) -> s -> Source m b -> Sink a m s
- peekForever :: Monad m => ConduitM i o m () -> ConduitM i o m ()
- class Monad m => MonadIO m where
  - liftIO :: IO a -> m a
- class MonadTrans t where
  - lift :: Monad m => m a -> t m a
- class (Applicative b, Applicative m, Monad b, Monad m) => MonadBase b m | m -> b where
  - liftBase :: b α -> m α
- class Monad m => MonadThrow m where
  - throwM :: Exception e => e -> m a
- class MonadBase b m => MonadBaseControl b m | m -> b
- class (MonadThrow m, MonadIO m, Applicative m, MonadBase IO m) => MonadResource m
- data ResourceT m a :: (* -> *) -> * -> *
- runResourceT :: MonadBaseControl IO m => ResourceT m a -> m a
- module Data.Acquire
- withAcquire :: MonadBaseControl IO m => Acquire a -> (a -> m b) -> m b
- newtype Identity a :: * -> * = Identity {
  - runIdentity :: a
  }

# Core conduit library

module Data.Conduit

module Data.Conduit.Lift

# Commonly used combinators

## Producers

### Pure

yieldMany :: (Monad m, MonoFoldable mono) => mono -> Producer m (Element mono) #

Yield each of the values contained by the given `MonoFoldable`.

This will work on many data structures, including lists, `ByteString`s, and `Vector`s.

Since 1.0.0

unfoldC :: Monad m => (b -> Maybe (a, b)) -> b -> Producer m a #

Generate a producer from a seed value.

Since 1.0.0

enumFromToC :: (Monad m, Enum a, Ord a) => a -> a -> Producer m a #

Enumerate from a value to a final value, inclusive, via `succ`.

This is generally more efficient than using `Prelude`'s `enumFromTo` and combining with `sourceList` since this avoids any intermediate data structures.

Since 1.0.0

iterateC :: Monad m => (a -> a) -> a -> Producer m a #

Produces an infinite stream of repeated applications of f to x.

Since 1.0.0

repeatC :: Monad m => a -> Producer m a #

Produce an infinite stream consisting entirely of the given value.

Since 1.0.0

replicateC :: Monad m => Int -> a -> Producer m a #

Produce a finite stream consisting of n copies of the given value.

Since 1.0.0

sourceLazy :: (Monad m, LazySequence lazy strict) => lazy -> Producer m strict #

Generate a producer by yielding each of the strict chunks in a `LazySequence`.

For more information, see `toChunks`.

Since 1.0.0

### Monadic

repeatMC :: Monad m => m a -> Producer m a #

Repeatedly run the given action and yield all values it produces.

Since 1.0.0

repeatWhileMC :: Monad m => m a -> (a -> Bool) -> Producer m a #

Repeatedly run the given action and yield all values it produces, until the provided predicate returns `False`.

Since 1.0.0

replicateMC :: Monad m => Int -> m a -> Producer m a #

Perform the given action n times, yielding each result.

Since 1.0.0

### I/O

sourceFile :: (MonadResource m, IOData a, MonoFoldable a) => FilePath -> Producer m a #

Read all data from the given file.

This function automatically opens and closes the file handle, and ensures exception safety via `MonadResource. It works for all instances of` IOData`, including` ByteString`and` Text@.

Since 1.0.0

sourceHandle :: (MonadIO m, IOData a, MonoFoldable a) => Handle -> Producer m a #

Read all data from the given `Handle`.

Does not close the `Handle` at any point.

Since 1.0.0

sourceIOHandle :: (MonadResource m, IOData a, MonoFoldable a) => IO Handle -> Producer m a #

Open a `Handle` using the given function and stream data from it.

Automatically closes the file at completion.

Since 1.0.0

stdinC :: (MonadIO m, IOData a, MonoFoldable a) => Producer m a #

`sourceHandle` applied to `stdin`.

Since 1.0.0

### Random numbers

sourceRandom :: (Variate a, MonadIO m) => Producer m a #

Create an infinite stream of random values, seeding from the system random number.

Since 1.0.0

sourceRandomN #

Arguments

:: (Variate a, MonadIO m) |
=> Int | count
-> Producer m a |

Create a stream of random values of length n, seeding from the system random number.

Since 1.0.0

sourceRandomGen :: (Variate a, MonadBase base m, PrimMonad base) => Gen (PrimState base) -> Producer m a #

Create an infinite stream of random values, using the given random number generator.

Since 1.0.0

sourceRandomNGen #

Arguments

:: (Variate a, MonadBase base m, PrimMonad base) |
=> Gen (PrimState base) |
-> Int | count
-> Producer m a |

Create a stream of random values of length n, seeding from the system random number.

Since 1.0.0

sourceRandomWith :: (Variate a, MonadIO m) => (GenIO -> IO a) -> Producer m a #

Create an infinite stream of random values from an arbitrary distribution, seeding from the system random number.

Subject to fusion

Since 1.0.3

sourceRandomNWith #

Arguments

:: (Variate a, MonadIO m) |
=> Int | count
-> (GenIO -> IO a) |
-> Producer m a |

Create a stream of random values of length n from an arbitrary distribution, seeding from the system random number.

Subject to fusion

Since 1.0.3

sourceRandomGenWith :: (Variate a, MonadBase base m, PrimMonad base) => Gen (PrimState base) -> (Gen (PrimState base) -> base a) -> Producer m a #

Create an infinite stream of random values from an arbitrary distribution, using the given random number generator.

Subject to fusion

Since 1.0.3

sourceRandomNGenWith #

Arguments

:: (Variate a, MonadBase base m, PrimMonad base) |
=> Gen (PrimState base) |
-> Int | count
-> (Gen (PrimState base) -> base a) |
-> Producer m a |

Create a stream of random values of length n from an arbitrary distribution, seeding from the system random number.

Subject to fusion

Since 1.0.3

### Filesystem

sourceDirectory :: MonadResource m => FilePath -> Producer m FilePath #

Stream the contents of the given directory, without traversing deeply.

This function will return all of the contents of the directory, whether they be files, directories, etc.

Note that the generated filepaths will be the complete path, not just the filename. In other words, if you have a directory `foo` containing files `bar` and `baz`, and you use `sourceDirectory` on `foo`, the results will be `foo/bar` and `foo/baz`.

Since 1.0.0

sourceDirectoryDeep #

Arguments

:: MonadResource m |
=> Bool | Follow directory symlinks
-> FilePath | Root directory
-> Producer m FilePath |

Deeply stream the contents of the given directory.

This works the same as `sourceDirectory`, but will not return directories at all. This function also takes an extra parameter to indicate whether symlinks will be followed.

Since 1.0.0

## Consumers

### Pure

dropC :: Monad m => Int -> Consumer a m () #

Ignore a certain number of values in the stream.

Since 1.0.0

dropCE :: (Monad m, IsSequence seq) => Index seq -> Consumer seq m () #

Drop a certain number of elements from a chunked stream.

Since 1.0.0

dropWhileC :: Monad m => (a -> Bool) -> Consumer a m () #

Drop all values which match the given predicate.

Since 1.0.0

dropWhileCE :: (Monad m, IsSequence seq) => (Element seq -> Bool) -> Consumer seq m () #

Drop all elements in the chunked stream which match the given predicate.

Since 1.0.0

foldC :: (Monad m, Monoid a) => Consumer a m a #

Monoidally combine all values in the stream.

Since 1.0.0

foldCE :: (Monad m, MonoFoldable mono, Monoid (Element mono)) => Consumer mono m (Element mono) #

Monoidally combine all elements in the chunked stream.

Since 1.0.0

foldlC :: Monad m => (a -> b -> a) -> a -> Consumer b m a #

A strict left fold.

Since 1.0.0

foldlCE :: (Monad m, MonoFoldable mono) => (a -> Element mono -> a) -> a -> Consumer mono m a #

A strict left fold on a chunked stream.

Since 1.0.0

foldMapC :: (Monad m, Monoid b) => (a -> b) -> Consumer a m b #

Apply the provided mapping function and monoidal combine all values.

Since 1.0.0

foldMapCE :: (Monad m, MonoFoldable mono, Monoid w) => (Element mono -> w) -> Consumer mono m w #

Apply the provided mapping function and monoidal combine all elements of the chunked stream.

Since 1.0.0

allC :: Monad m => (a -> Bool) -> Consumer a m Bool #

Check that all values in the stream return True.

Subject to shortcut logic: at the first False, consumption of the stream will stop.

Since 1.0.0

allCE :: (Monad m, MonoFoldable mono) => (Element mono -> Bool) -> Consumer mono m Bool #

Check that all elements in the chunked stream return True.

Subject to shortcut logic: at the first False, consumption of the stream will stop.

Since 1.0.0

anyC :: Monad m => (a -> Bool) -> Consumer a m Bool #

Check that at least one value in the stream returns True.

Subject to shortcut logic: at the first True, consumption of the stream will stop.

Since 1.0.0

anyCE :: (Monad m, MonoFoldable mono) => (Element mono -> Bool) -> Consumer mono m Bool #

Check that at least one element in the chunked stream returns True.

Subject to shortcut logic: at the first True, consumption of the stream will stop.

Since 1.0.0

andC :: Monad m => Consumer Bool m Bool #

Are all values in the stream True?

Consumption stops once the first False is encountered.

Since 1.0.0

andCE :: (Monad m, MonoFoldable mono, Element mono ~ Bool) => Consumer mono m Bool #

Are all elements in the chunked stream True?

Consumption stops once the first False is encountered.

Since 1.0.0

orC :: Monad m => Consumer Bool m Bool #

Are any values in the stream True?

Consumption stops once the first True is encountered.

Since 1.0.0

orCE :: (Monad m, MonoFoldable mono, Element mono ~ Bool) => Consumer mono m Bool #

Are any elements in the chunked stream True?

Consumption stops once the first True is encountered.

Since 1.0.0

elemC :: (Monad m, Eq a) => a -> Consumer a m Bool #

Are any values in the stream equal to the given value?

Stops consuming as soon as a match is found.

Since 1.0.0

elemCE :: (Monad m, IsSequence seq, Eq (Element seq)) => Element seq -> Consumer seq m Bool #

Are any elements in the chunked stream equal to the given element?

Stops consuming as soon as a match is found.

Since 1.0.0

notElemC :: (Monad m, Eq a) => a -> Consumer a m Bool #

Are no values in the stream equal to the given value?

Stops consuming as soon as a match is found.

Since 1.0.0

notElemCE :: (Monad m, IsSequence seq, Eq (Element seq)) => Element seq -> Consumer seq m Bool #

Are no elements in the chunked stream equal to the given element?

Stops consuming as soon as a match is found.

Since 1.0.0

sinkLazy :: (Monad m, LazySequence lazy strict) => Consumer strict m lazy #

Consume all incoming strict chunks into a lazy sequence. Note that the entirety of the sequence will be resident at memory.

This can be used to consume a stream of strict ByteStrings into a lazy ByteString, for example.

Since 1.0.0

sinkList :: Monad m => Consumer a m [a] #

Consume all values from the stream and return as a list. Note that this will pull all values into memory.

Since 1.0.0

sinkVector :: (MonadBase base m, Vector v a, PrimMonad base) => Consumer a m (v a) #

Sink incoming values into a vector, growing the vector as necessary to fit more elements.

Note that using this function is more memory efficient than `sinkList` and then converting to a `Vector`, as it avoids intermediate list constructors.

Since 1.0.0

sinkVectorN #

Arguments

:: (MonadBase base m, Vector v a, PrimMonad base) |
=> Int | maximum allowed size
-> Consumer a m (v a) |

Sink incoming values into a vector, up until size `maxSize`. Subsequent values will be left in the stream. If there are less than `maxSize` values present, returns a `Vector` of smaller size.

Note that using this function is more memory efficient than `sinkList` and then converting to a `Vector`, as it avoids intermediate list constructors.

Since 1.0.0

sinkBuilder :: (Monad m, Monoid builder, ToBuilder a builder) => Consumer a m builder #

Convert incoming values to a builder and fold together all builder values.

Defined as: `foldMap toBuilder`.

Since 1.0.0

sinkLazyBuilder :: (Monad m, Monoid builder, ToBuilder a builder, Builder builder lazy) => Consumer a m lazy #

Same as `sinkBuilder`, but afterwards convert the builder to its lazy representation.

Alternatively, this could be considered an alternative to `sinkLazy`, with the following differences:

- This function will allow multiple input types, not just the strict version of the lazy structure.
- Some buffer copying may occur in this version.

Since 1.0.0

sinkNull :: Monad m => Consumer a m () #

Consume and discard all remaining values in the stream.

Since 1.0.0

awaitNonNull :: (Monad m, MonoFoldable a) => Consumer a m (Maybe (NonNull a)) #

Same as `await`, but discards any leading `onull` values.

Since 1.0.0

headC :: Monad m => Consumer a m (Maybe a) #

Take a single value from the stream, if available.

Since 1.0.5

headDefC :: Monad m => a -> Consumer a m a #

Same as `headC`, but returns a default value if none are available from the stream.

Since 1.0.5

headCE :: (Monad m, IsSequence seq) => Consumer seq m (Maybe (Element seq)) #

Get the next element in the chunked stream.

Since 1.0.0

peekC :: Monad m => Consumer a m (Maybe a) #

View the next value in the stream without consuming it.

Since 1.0.0

peekCE :: (Monad m, MonoFoldable mono) => Consumer mono m (Maybe (Element mono)) #

View the next element in the chunked stream without consuming it.

Since 1.0.0

lastC :: Monad m => Consumer a m (Maybe a) #

Retrieve the last value in the stream, if present.

Since 1.0.0

lastDefC :: Monad m => a -> Consumer a m a #

Same as `lastC`, but returns a default value if none are available from the stream.

Since 1.0.5

lastCE :: (Monad m, IsSequence seq) => Consumer seq m (Maybe (Element seq)) #

Retrieve the last element in the chunked stream, if present.

Since 1.0.0

lengthC :: (Monad m, Num len) => Consumer a m len #

Count how many values are in the stream.

Since 1.0.0

lengthCE :: (Monad m, Num len, MonoFoldable mono) => Consumer mono m len #

Count how many elements are in the chunked stream.

Since 1.0.0

lengthIfC :: (Monad m, Num len) => (a -> Bool) -> Consumer a m len #

Count how many values in the stream pass the given predicate.

Since 1.0.0

lengthIfCE :: (Monad m, Num len, MonoFoldable mono) => (Element mono -> Bool) -> Consumer mono m len #

Count how many elements in the chunked stream pass the given predicate.

Since 1.0.0

maximumC :: (Monad m, Ord a) => Consumer a m (Maybe a) #

Get the largest value in the stream, if present.

Since 1.0.0

maximumCE :: (Monad m, IsSequence seq, Ord (Element seq)) => Consumer seq m (Maybe (Element seq)) #

Get the largest element in the chunked stream, if present.

Since 1.0.0

minimumC :: (Monad m, Ord a) => Consumer a m (Maybe a) #

Get the smallest value in the stream, if present.

Since 1.0.0

minimumCE :: (Monad m, IsSequence seq, Ord (Element seq)) => Consumer seq m (Maybe (Element seq)) #

Get the smallest element in the chunked stream, if present.

Since 1.0.0

nullC :: Monad m => Consumer a m Bool #

True if there are no values in the stream.

This function does not modify the stream.

Since 1.0.0

nullCE :: (Monad m, MonoFoldable mono) => Consumer mono m Bool #

True if there are no elements in the chunked stream.

This function may remove empty leading chunks from the stream, but otherwise will not modify it.

Since 1.0.0

sumC :: (Monad m, Num a) => Consumer a m a #

Get the sum of all values in the stream.

Since 1.0.0

sumCE :: (Monad m, MonoFoldable mono, Num (Element mono)) => Consumer mono m (Element mono) #

Get the sum of all elements in the chunked stream.

Since 1.0.0

productC :: (Monad m, Num a) => Consumer a m a #

Get the product of all values in the stream.

Since 1.0.0

productCE :: (Monad m, MonoFoldable mono, Num (Element mono)) => Consumer mono m (Element mono) #

Get the product of all elements in the chunked stream.

Since 1.0.0

findC :: Monad m => (a -> Bool) -> Consumer a m (Maybe a) #

Find the first matching value.

Since 1.0.0

### Monadic

mapM_C :: Monad m => (a -> m ()) -> Consumer a m () #

Apply the action to all values in the stream.

Since 1.0.0

mapM_CE :: (Monad m, MonoFoldable mono) => (Element mono -> m ()) -> Consumer mono m () #

Apply the action to all elements in the chunked stream.

Since 1.0.0

foldMC :: Monad m => (a -> b -> m a) -> a -> Consumer b m a #

A monadic strict left fold.

Since 1.0.0

foldMCE :: (Monad m, MonoFoldable mono) => (a -> Element mono -> m a) -> a -> Consumer mono m a #

A monadic strict left fold on a chunked stream.

Since 1.0.0

foldMapMC :: (Monad m, Monoid w) => (a -> m w) -> Consumer a m w #

Apply the provided monadic mapping function and monoidal combine all values.

Since 1.0.0

foldMapMCE :: (Monad m, MonoFoldable mono, Monoid w) => (Element mono -> m w) -> Consumer mono m w #

Apply the provided monadic mapping function and monoidal combine all elements in the chunked stream.

Since 1.0.0

### I/O

sinkFile :: (MonadResource m, IOData a) => FilePath -> Consumer a m () #

Write all data to the given file.

This function automatically opens and closes the file handle, and ensures exception safety via `MonadResource. It works for all instances of` IOData`, including` ByteString`and` Text@.

Since 1.0.0

sinkHandle :: (MonadIO m, IOData a) => Handle -> Consumer a m () #

Write all data to the given `Handle`.

Does not close the `Handle` at any point.

Since 1.0.0

sinkIOHandle :: (MonadResource m, IOData a) => IO Handle -> Consumer a m () #

Open a `Handle` using the given function and stream data to it.

Automatically closes the file at completion.

Since 1.0.0

printC :: (Show a, MonadIO m) => Consumer a m () #

Print all incoming values to stdout.

Since 1.0.0

stdoutC :: (MonadIO m, IOData a) => Consumer a m () #

`sinkHandle` applied to `stdout`.

Since 1.0.0

stderrC :: (MonadIO m, IOData a) => Consumer a m () #

`sinkHandle` applied to `stderr`.

Since 1.0.0

## Transformers

### Pure

mapC :: Monad m => (a -> b) -> Conduit a m b #

Apply a transformation to all values in a stream.

Since 1.0.0

mapCE :: (Monad m, Functor f) => (a -> b) -> Conduit (f a) m (f b) #

Apply a transformation to all elements in a chunked stream.

Since 1.0.0

omapCE :: (Monad m, MonoFunctor mono) => (Element mono -> Element mono) -> Conduit mono m mono #

Apply a monomorphic transformation to all elements in a chunked stream.

Unlike `mapE`, this will work on types like `ByteString` and `Text` which are `MonoFunctor` but not `Functor`.

Since 1.0.0

concatMapC :: (Monad m, MonoFoldable mono) => (a -> mono) -> Conduit a m (Element mono) #

Apply the function to each value in the stream, resulting in a foldable value (e.g., a list). Then yield each of the individual values in that foldable value separately.

Generalizes concatMap, mapMaybe, and mapFoldable.

Since 1.0.0

concatMapCE :: (Monad m, MonoFoldable mono, Monoid w) => (Element mono -> w) -> Conduit mono m w #

Apply the function to each element in the chunked stream, resulting in a foldable value (e.g., a list). Then yield each of the individual values in that foldable value separately.

Generalizes concatMap, mapMaybe, and mapFoldable.

Since 1.0.0

takeC :: Monad m => Int -> Conduit a m a #

Stream up to n number of values downstream.

Note that, if downstream terminates early, not all values will be consumed. If you want to force exactly the given number of values to be consumed, see `takeExactly`.

Since 1.0.0

takeCE :: (Monad m, IsSequence seq) => Index seq -> Conduit seq m seq #

Stream up to n number of elements downstream in a chunked stream.

Note that, if downstream terminates early, not all values will be consumed. If you want to force exactly the given number of values to be consumed, see `takeExactlyE`.

Since 1.0.0

takeWhileC :: Monad m => (a -> Bool) -> Conduit a m a #

Stream all values downstream that match the given predicate.

Same caveats regarding downstream termination apply as with `take`.

Since 1.0.0

takeWhileCE :: (Monad m, IsSequence seq) => (Element seq -> Bool) -> Conduit seq m seq #

Stream all elements downstream that match the given predicate in a chunked stream.

Same caveats regarding downstream termination apply as with `takeE`.

Since 1.0.0

takeExactlyC :: Monad m => Int -> ConduitM a b m r -> ConduitM a b m r #

Consume precisely the given number of values and feed them downstream.

This function is in contrast to `take`, which will only consume up to the given number of values, and will terminate early if downstream terminates early. This function will discard any additional values in the stream if they are unconsumed.

Note that this function takes a downstream `ConduitM` as a parameter, as opposed to working with normal fusion. For more information, see http://www.yesodweb.com/blog/2013/10/core-flaw-pipes-conduit, the section titled "pipes and conduit: isolate".

Since 1.0.0

takeExactlyCE :: (Monad m, IsSequence a) => Index a -> ConduitM a b m r -> ConduitM a b m r #

Same as `takeExactly`, but for chunked streams.

Since 1.0.0

concatC :: (Monad m, MonoFoldable mono) => Conduit mono m (Element mono) #

Flatten out a stream by yielding the values contained in an incoming `MonoFoldable` as individually yielded values.

Since 1.0.0

filterC :: Monad m => (a -> Bool) -> Conduit a m a #

Keep only values in the stream passing a given predicate.

Since 1.0.0

filterCE :: (IsSequence seq, Monad m) => (Element seq -> Bool) -> Conduit seq m seq #

Keep only elements in the chunked stream passing a given predicate.

Since 1.0.0

mapWhileC :: Monad m => (a -> Maybe b) -> Conduit a m b #

Map values as long as the result is `Just`.

Since 1.0.0

conduitVector #

Arguments

:: (MonadBase base m, Vector v a, PrimMonad base) |
=> Int | maximum allowed size
-> Conduit a m (v a) |

Break up a stream of values into vectors of size n. The final vector may be smaller than n if the total number of values is not a strict multiple of n. No empty vectors will be yielded.

Since 1.0.0

scanlC :: Monad m => (a -> b -> a) -> a -> Conduit b m a #

Analog of `scanl` for lists.

Since 1.0.6

mapAccumWhileC :: Monad m => (a -> s -> Either s (s, b)) -> s -> ConduitM a b m s #

`mapWhileC` with a break condition dependent on a strict accumulator. Equivalently, `mapAccum` as long as the result is `Right`. Instead of producing a leftover, the breaking input determines the resulting accumulator via `Left`.

concatMapAccumC :: Monad m => (a -> accum -> (accum, [b])) -> accum -> Conduit a m b #

`concatMap` with an accumulator.

Since 1.0.0

intersperseC :: Monad m => a -> Conduit a m a #

Insert the given value between each two values in the stream.

Since 1.0.0

slidingWindowC :: (Monad m, IsSequence seq, Element seq ~ a) => Int -> Conduit a m seq #

Sliding window of values 1,2,3,4,5 with window size 2 gives [1,2],[2,3],[3,4],[4,5]

Best used with structures that support O(1) snoc.

Since 1.0.0

#### Binary base encoding

encodeBase64C :: Monad m => Conduit ByteString m ByteString #

Apply base64-encoding to the stream.

Since 1.0.0

decodeBase64C :: Monad m => Conduit ByteString m ByteString #

Apply base64-decoding to the stream. Will stop decoding on the first invalid chunk.

Since 1.0.0

encodeBase64URLC :: Monad m => Conduit ByteString m ByteString #

Apply URL-encoding to the stream.

Since 1.0.0

decodeBase64URLC :: Monad m => Conduit ByteString m ByteString #

Apply lenient base64URL-decoding to the stream. Will stop decoding on the first invalid chunk.

Since 1.0.0

encodeBase16C :: Monad m => Conduit ByteString m ByteString #

Apply base16-encoding to the stream.

Since 1.0.0

decodeBase16C :: Monad m => Conduit ByteString m ByteString #

Apply base16-decoding to the stream. Will stop decoding on the first invalid chunk.

Since 1.0.0

### Monadic

mapMC :: Monad m => (a -> m b) -> Conduit a m b #

Apply a monadic transformation to all values in a stream.

If you do not need the transformed values, and instead just want the monadic side-effects of running the action, see `mapM_`.

Since 1.0.0

mapMCE :: (Monad m, Traversable f) => (a -> m b) -> Conduit (f a) m (f b) #

Apply a monadic transformation to all elements in a chunked stream.

Since 1.0.0

omapMCE :: (Monad m, MonoTraversable mono) => (Element mono -> m (Element mono)) -> Conduit mono m mono #

Apply a monadic monomorphic transformation to all elements in a chunked stream.

Unlike `mapME`, this will work on types like `ByteString` and `Text` which are `MonoFunctor` but not `Functor`.

Since 1.0.0

concatMapMC :: (Monad m, MonoFoldable mono) => (a -> m mono) -> Conduit a m (Element mono) #

Apply the monadic function to each value in the stream, resulting in a foldable value (e.g., a list). Then yield each of the individual values in that foldable value separately.

Generalizes concatMapM, mapMaybeM, and mapFoldableM.

Since 1.0.0

filterMC :: Monad m => (a -> m Bool) -> Conduit a m a #

Keep only values in the stream passing a given monadic predicate.

Since 1.0.0

filterMCE :: (Monad m, IsSequence seq) => (Element seq -> m Bool) -> Conduit seq m seq #

Keep only elements in the chunked stream passing a given monadic predicate.

Since 1.0.0

iterMC :: Monad m => (a -> m ()) -> Conduit a m a #

Apply a monadic action on all values in a stream.

This `Conduit` can be used to perform a monadic side-effect for every value, whilst passing the value through the `Conduit` as-is.

    iterM f = mapM (\a -> f a >>= \() -> return a)

Since 1.0.0

scanlMC :: Monad m => (a -> b -> m a) -> a -> Conduit b m a #

Analog of `scanl` for lists, monadic.

Since 1.0.6

mapAccumWhileMC :: Monad m => (a -> s -> m (Either s (s, b))) -> s -> ConduitM a b m s #

Monadic `mapAccumWhileC`.

concatMapAccumMC :: Monad m => (a -> accum -> m (accum, [b])) -> accum -> Conduit a m b #

`concatMapM` with an accumulator.

Since 1.0.0

### Textual

encodeUtf8C :: (Monad m, Utf8 text binary) => Conduit text m binary #

Encode a stream of text as UTF8.

Since 1.0.0

decodeUtf8C :: MonadThrow m => Conduit ByteString m Text #

Decode a stream of binary data as UTF8.

Since 1.0.0

decodeUtf8LenientC :: MonadThrow m => Conduit ByteString m Text #

Decode a stream of binary data as UTF8, replacing any invalid bytes with the Unicode replacement character.

Since 1.0.0

lineC :: (Monad m, IsSequence seq, Element seq ~ Char) => ConduitM seq o m r -> ConduitM seq o m r #

Stream in the entirety of a single line.

Like `takeExactly`, this will consume the entirety of the line regardless of the behavior of the inner Conduit.

Since 1.0.0

lineAsciiC :: (Monad m, IsSequence seq, Element seq ~ Word8) => ConduitM seq o m r -> ConduitM seq o m r #

Same as `line`, but operates on ASCII/binary data.

Since 1.0.0

unlinesC :: (Monad m, IsSequence seq, Element seq ~ Char) => Conduit seq m seq #

Insert a newline character after each incoming chunk of data.

Since 1.0.0

unlinesAsciiC :: (Monad m, IsSequence seq, Element seq ~ Word8) => Conduit seq m seq #

Same as `unlines`, but operates on ASCII/binary data.

Since 1.0.0

linesUnboundedC :: (Monad m, IsSequence seq, Element seq ~ Char) => Conduit seq m seq #

Convert a stream of arbitrarily-chunked textual data into a stream of data where each chunk represents a single line. Note that, if you have unknownuntrusted input, this function is unsafe/, since it would allow an attacker to form lines of massive length and exhaust memory.

Since 1.0.0

linesUnboundedAsciiC :: (Monad m, IsSequence seq, Element seq ~ Word8) => Conduit seq m seq #

Same as `linesUnbounded`, but for ASCII/binary data.

Since 1.0.0

## Special

vectorBuilderC #

Arguments

:: (PrimMonad base, MonadBase base m, Vector v e, MonadBase base n) |
=> Int | size
-> ((e -> n ()) -> Sink i m r) |
-> ConduitM i (v e) m r |

Generally speaking, yielding values from inside a Conduit requires some allocation for constructors. This can introduce an overhead, similar to the overhead needed to represent a list of values instead of a vector. This overhead is even more severe when talking about unboxed values.

This combinator allows you to overcome this overhead, and efficiently fill up vectors. It takes two parameters. The first is the size of each mutable vector to be allocated. The second is a function. The function takes an argument which will yield the next value into a mutable vector.

Under the surface, this function uses a number of tricks to get high performance. For more information on both usage and implementation, please see: https://www.fpcomplete.com/user/snoyberg/library-documentation/vectorbuilder

Since 1.0.0

mapAccumS :: Monad m => (a -> s -> Sink b m s) -> s -> Source m b -> Sink a m s #

Consume a source with a strict accumulator, in a way piecewise defined by a controlling stream. The latter will be evaluated until it terminates.

    >>> let f a s = liftM (:s) $ mapC (*a) =$ CL.take a
    >>> reverse $ runIdentity $ yieldMany [0..3] $$ mapAccumS f [] (yieldMany [1..])
    [[],[1],[4,6],[12,15,18]] :: [[Int]]

peekForever :: Monad m => ConduitM i o m () -> ConduitM i o m () #

Run a consuming conduit repeatedly, only stopping when there is no more data available from upstream.

Since 1.0.0

# Monadic lifting

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)

Instances

MonadIO IO |
Methods liftIO :: IO a -> IO a #
MonadIO Acquire |
Methods liftIO :: IO a -> Acquire a #
MonadIO m => MonadIO (MaybeT m) |
Methods liftIO :: IO a -> MaybeT m a #
MonadIO m => MonadIO (ListT m) |
Methods liftIO :: IO a -> ListT m a #
MonadIO m => MonadIO (ResourceT m) |
Methods liftIO :: IO a -> ResourceT m a #
(Monoid w, MonadIO m) => MonadIO (WriterT w m) |
Methods liftIO :: IO a -> WriterT w m a #
(Monoid w, MonadIO m) => MonadIO (WriterT w m) |
Methods liftIO :: IO a -> WriterT w m a #
MonadIO m => MonadIO (StateT s m) |
Methods liftIO :: IO a -> StateT s m a #
MonadIO m => MonadIO (StateT s m) |
Methods liftIO :: IO a -> StateT s m a #
(Error e, MonadIO m) => MonadIO (ErrorT e m) |
Methods liftIO :: IO a -> ErrorT e m a #
MonadIO m => MonadIO (ExceptT e m) |
Methods liftIO :: IO a -> ExceptT e m a #
MonadIO m => MonadIO (IdentityT * m) |
Methods liftIO :: IO a -> IdentityT * m a #
MonadIO m => MonadIO (ReaderT * r m) |
Methods liftIO :: IO a -> ReaderT * r m a #
MonadIO m => MonadIO (ConduitM i o m) |
Methods liftIO :: IO a -> ConduitM i o m a #
MonadIO m => MonadIO (ContT * r m) |
Methods liftIO :: IO a -> ContT * r m a #
(Monoid w, MonadIO m) => MonadIO (RWST r w s m) |
Methods liftIO :: IO a -> RWST r w s m a #
(Monoid w, MonadIO m) => MonadIO (RWST r w s m) |
Methods liftIO :: IO a -> RWST r w s m a #
MonadIO m => MonadIO (Pipe l i o u m) |
Methods liftIO :: IO a -> Pipe l i o u m a #

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)

Instances

MonadTrans MaybeT |
Methods lift :: Monad m => m a -> MaybeT m a #
MonadTrans ListT |
Methods lift :: Monad m => m a -> ListT m a #
MonadTrans ResourceT |
Methods lift :: Monad m => m a -> ResourceT m a #
Monoid w => MonadTrans (WriterT w) |
Methods lift :: Monad m => m a -> WriterT w m a #
Monoid w => MonadTrans (WriterT w) |
Methods lift :: Monad m => m a -> WriterT w m a #
MonadTrans (StateT s) |
Methods lift :: Monad m => m a -> StateT s m a #
MonadTrans (StateT s) |
Methods lift :: Monad m => m a -> StateT s m a #
MonadTrans (ErrorT e) |
Methods lift :: Monad m => m a -> ErrorT e m a #
MonadTrans (ExceptT e) |
Methods lift :: Monad m => m a -> ExceptT e m a #
MonadTrans (IdentityT *) |
Methods lift :: Monad m => m a -> IdentityT * m a #
MonadTrans (ReaderT * r) |
Methods lift :: Monad m => m a -> ReaderT * r m a #
MonadTrans (ConduitM i o) |
Methods lift :: Monad m => m a -> ConduitM i o m a #
MonadTrans (ContT * r) |
Methods lift :: Monad m => m a -> ContT * r m a #
Monoid w => MonadTrans (RWST r w s) |
Methods lift :: Monad m => m a -> RWST r w s m a #
Monoid w => MonadTrans (RWST r w s) |
Methods lift :: Monad m => m a -> RWST r w s m a #
MonadTrans (Pipe l i o u) |
Methods lift :: Monad m => m a -> Pipe l i o u m a #

class (Applicative b, Applicative m, Monad b, Monad m) => MonadBase b m | m -> b where #

Instances

MonadBase [] [] |
Methods liftBase :: [α] -> [α] #
MonadBase Maybe Maybe |
Methods liftBase :: Maybe α -> Maybe α #
MonadBase IO IO |
Methods liftBase :: IO α -> IO α #
MonadBase IO Acquire |
Methods liftBase :: IO α -> Acquire α #
MonadBase Identity Identity |
Methods liftBase :: Identity α -> Identity α #
MonadBase STM STM |
Methods liftBase :: STM α -> STM α #
MonadBase b m => MonadBase b (ResourceT m) |
Methods liftBase :: b α -> ResourceT m α #
MonadBase b m => MonadBase b (MaybeT m) |
Methods liftBase :: b α -> MaybeT m α #
MonadBase b m => MonadBase b (ListT m) |
Methods liftBase :: b α -> ListT m α #
(Monoid w, MonadBase b m) => MonadBase b (WriterT w m) |
Methods liftBase :: b α -> WriterT w m α #
(Monoid w, MonadBase b m) => MonadBase b (WriterT w m) |
Methods liftBase :: b α -> WriterT w m α #
MonadBase b m => MonadBase b (StateT s m) |
Methods liftBase :: b α -> StateT s m α #
MonadBase b m => MonadBase b (StateT s m) |
Methods liftBase :: b α -> StateT s m α #
MonadBase b m => MonadBase b (IdentityT * m) |
Methods liftBase :: b α -> IdentityT * m α #
MonadBase b m => MonadBase b (ExceptT e m) |
Methods liftBase :: b α -> ExceptT e m α #
(Error e, MonadBase b m) => MonadBase b (ErrorT e m) |
Methods liftBase :: b α -> ErrorT e m α #
MonadBase b m => MonadBase b (ReaderT * r m) |
Methods liftBase :: b α -> ReaderT * r m α #
MonadBase b m => MonadBase b (ContT * r m) |
Methods liftBase :: b α -> ContT * r m α #
MonadBase base m => MonadBase base (ConduitM i o m) |
Methods liftBase :: base α -> ConduitM i o m α #
(Monoid w, MonadBase b m) => MonadBase b (RWST r w s m) |
Methods liftBase :: b α -> RWST r w s m α #
(Monoid w, MonadBase b m) => MonadBase b (RWST r w s m) |
Methods liftBase :: b α -> RWST r w s m α #
MonadBase base m => MonadBase base (Pipe l i o u m) |
Methods liftBase :: base α -> Pipe l i o u m α #
MonadBase ((->) r) ((->) r) |
Methods liftBase :: (r -> α) -> r -> α #
MonadBase (Either e) (Either e) |
Methods liftBase :: Either e α -> Either e α #
MonadBase (ST s) (ST s) |
Methods liftBase :: ST s α -> ST s α #
MonadBase (ST s) (ST s) |
Methods liftBase :: ST s α -> ST s α #

class Monad m => MonadThrow m where #

A class for monads in which exceptions may be thrown.

Instances should obey the following law:

    throwM e >> x = throwM e

In other words, throwing an exception short-circuits the rest of the monadic computation.

Instances

MonadThrow [] |
Methods throwM :: Exception e => e -> [a] #
MonadThrow Maybe |
Methods throwM :: Exception e => e -> Maybe a #
MonadThrow IO |
Methods throwM :: Exception e => e -> IO a #
MonadThrow Q |
Methods throwM :: Exception e => e -> Q a #
MonadThrow STM |
Methods throwM :: Exception e => e -> STM a #
(~) * e SomeException => MonadThrow (Either e) |
Methods throwM :: Exception e => e -> Either e a #
MonadThrow m => MonadThrow (MaybeT m) | Throws exceptions into the base monad.
Methods throwM :: Exception e => e -> MaybeT m a #
MonadThrow m => MonadThrow (ListT m) |
Methods throwM :: Exception e => e -> ListT m a #
MonadThrow m => MonadThrow (ResourceT m) |
Methods throwM :: Exception e => e -> ResourceT m a #
(MonadThrow m, Monoid w) => MonadThrow (WriterT w m) |
Methods throwM :: Exception e => e -> WriterT w m a #
(MonadThrow m, Monoid w) => MonadThrow (WriterT w m) |
Methods throwM :: Exception e => e -> WriterT w m a #
MonadThrow m => MonadThrow (StateT s m) |
Methods throwM :: Exception e => e -> StateT s m a #
MonadThrow m => MonadThrow (StateT s m) |
Methods throwM :: Exception e => e -> StateT s m a #
(Error e, MonadThrow m) => MonadThrow (ErrorT e m) | Throws exceptions into the base monad.
Methods throwM :: Exception e => e -> ErrorT e m a #
MonadThrow m => MonadThrow (ExceptT e m) | Throws exceptions into the base monad.
Methods throwM :: Exception e => e -> ExceptT e m a #
MonadThrow m => MonadThrow (IdentityT * m) |
Methods throwM :: Exception e => e -> IdentityT * m a #
MonadThrow m => MonadThrow (ReaderT * r m) |
Methods throwM :: Exception e => e -> ReaderT * r m a #
MonadThrow m => MonadThrow (ConduitM i o m) |
Methods throwM :: Exception e => e -> ConduitM i o m a #
MonadThrow m => MonadThrow (ContT * r m) |
Methods throwM :: Exception e => e -> ContT * r m a #
(MonadThrow m, Monoid w) => MonadThrow (RWST r w s m) |
Methods throwM :: Exception e => e -> RWST r w s m a #
(MonadThrow m, Monoid w) => MonadThrow (RWST r w s m) |
Methods throwM :: Exception e => e -> RWST r w s m a #
MonadThrow m => MonadThrow (Pipe l i o u m) |
Methods throwM :: Exception e => e -> Pipe l i o u m a #

class MonadBase b m => MonadBaseControl b m | m -> b #

Minimal complete definition

liftBaseWith, restoreM

Instances

MonadBaseControl [] [] |
Associated Types type StM ([] :: * -> *) a :: * # Methods liftBaseWith :: (RunInBase [] [] -> [a]) -> [a] # restoreM :: StM [] a -> [a] #
MonadBaseControl Maybe Maybe |
Associated Types type StM (Maybe :: * -> *) a :: * # Methods liftBaseWith :: (RunInBase Maybe Maybe -> Maybe a) -> Maybe a # restoreM :: StM Maybe a -> Maybe a #
MonadBaseControl IO IO |
Associated Types type StM (IO :: * -> *) a :: * # Methods liftBaseWith :: (RunInBase IO IO -> IO a) -> IO a # restoreM :: StM IO a -> IO a #
MonadBaseControl Identity Identity |
Associated Types type StM (Identity :: * -> *) a :: * # Methods liftBaseWith :: (RunInBase Identity Identity -> Identity a) -> Identity a # restoreM :: StM Identity a -> Identity a #
MonadBaseControl STM STM |
Associated Types type StM (STM :: * -> *) a :: * # Methods liftBaseWith :: (RunInBase STM STM -> STM a) -> STM a # restoreM :: StM STM a -> STM a #
MonadBaseControl b m => MonadBaseControl b (MaybeT m) |
Associated Types type StM (MaybeT m :: * -> *) a :: * # Methods liftBaseWith :: (RunInBase (MaybeT m) b -> b a) -> MaybeT m a # restoreM :: StM (MaybeT m) a -> MaybeT m a #
MonadBaseControl b m => MonadBaseControl b (ListT m) |
Associated Types type StM (ListT m :: * -> *) a :: * # Methods liftBaseWith :: (RunInBase (ListT m) b -> b a) -> ListT m a # restoreM :: StM (ListT m) a -> ListT m a #
MonadBaseControl b m => MonadBaseControl b (ResourceT m) |
Associated Types type StM (ResourceT m :: * -> *) a :: * # Methods liftBaseWith :: (RunInBase (ResourceT m) b -> b a) -> ResourceT m a # restoreM :: StM (ResourceT m) a -> ResourceT m a #
(Monoid w, MonadBaseControl b m) => MonadBaseControl b (WriterT w m) |
Associated Types type StM (WriterT w m :: * -> *) a :: * # Methods liftBaseWith :: (RunInBase (WriterT w m) b -> b a) -> WriterT w m a # restoreM :: StM (WriterT w m) a -> WriterT w m a #
(Monoid w, MonadBaseControl b m) => MonadBaseControl b (WriterT w m) |
Associated Types type StM (WriterT w m :: * -> *) a :: * # Methods liftBaseWith :: (RunInBase (WriterT w m) b -> b a) -> WriterT w m a # restoreM :: StM (WriterT w m) a -> WriterT w m a #
MonadBaseControl b m => MonadBaseControl b (StateT s m) |
Associated Types type StM (StateT s m :: * -> *) a :: * # Methods liftBaseWith :: (RunInBase (StateT s m) b -> b a) -> StateT s m a # restoreM :: StM (StateT s m) a -> StateT s m a #
MonadBaseControl b m => MonadBaseControl b (StateT s m) |
Associated Types type StM (StateT s m :: * -> *) a :: * # Methods liftBaseWith :: (RunInBase (StateT s m) b -> b a) -> StateT s m a # restoreM :: StM (StateT s m) a -> StateT s m a #
MonadBaseControl b m => MonadBaseControl b (IdentityT * m) |
Associated Types type StM (IdentityT * m :: * -> *) a :: * # Methods liftBaseWith :: (RunInBase (IdentityT * m) b -> b a) -> IdentityT * m a # restoreM :: StM (IdentityT * m) a -> IdentityT * m a #
MonadBaseControl b m => MonadBaseControl b (ExceptT e m) |
Associated Types type StM (ExceptT e m :: * -> *) a :: * # Methods liftBaseWith :: (RunInBase (ExceptT e m) b -> b a) -> ExceptT e m a # restoreM :: StM (ExceptT e m) a -> ExceptT e m a #
(Error e, MonadBaseControl b m) => MonadBaseControl b (ErrorT e m) |
Associated Types type StM (ErrorT e m :: * -> *) a :: * # Methods liftBaseWith :: (RunInBase (ErrorT e m) b -> b a) -> ErrorT e m a # restoreM :: StM (ErrorT e m) a -> ErrorT e m a #
MonadBaseControl b m => MonadBaseControl b (ReaderT * r m) |
Associated Types type StM (ReaderT * r m :: * -> *) a :: * # Methods liftBaseWith :: (RunInBase (ReaderT * r m) b -> b a) -> ReaderT * r m a # restoreM :: StM (ReaderT * r m) a -> ReaderT * r m a #
(Monoid w, MonadBaseControl b m) => MonadBaseControl b (RWST r w s m) |
Associated Types type StM (RWST r w s m :: * -> *) a :: * # Methods liftBaseWith :: (RunInBase (RWST r w s m) b -> b a) -> RWST r w s m a # restoreM :: StM (RWST r w s m) a -> RWST r w s m a #
(Monoid w, MonadBaseControl b m) => MonadBaseControl b (RWST r w s m) |
Associated Types type StM (RWST r w s m :: * -> *) a :: * # Methods liftBaseWith :: (RunInBase (RWST r w s m) b -> b a) -> RWST r w s m a # restoreM :: StM (RWST r w s m) a -> RWST r w s m a #
MonadBaseControl ((->) r) ((->) r) |
Associated Types type StM ((->) r :: * -> *) a :: * # Methods liftBaseWith :: (RunInBase ((->) r) ((->) r) -> r -> a) -> r -> a # restoreM :: StM ((->) r) a -> r -> a #
MonadBaseControl (Either e) (Either e) |
Associated Types type StM (Either e :: * -> *) a :: * # Methods liftBaseWith :: (RunInBase (Either e) (Either e) -> Either e a) -> Either e a # restoreM :: StM (Either e) a -> Either e a #
MonadBaseControl (ST s) (ST s) |
Associated Types type StM (ST s :: * -> *) a :: * # Methods liftBaseWith :: (RunInBase (ST s) (ST s) -> ST s a) -> ST s a # restoreM :: StM (ST s) a -> ST s a #
MonadBaseControl (ST s) (ST s) |
Associated Types type StM (ST s :: * -> *) a :: * # Methods liftBaseWith :: (RunInBase (ST s) (ST s) -> ST s a) -> ST s a # restoreM :: StM (ST s) a -> ST s a #

# ResourceT

class (MonadThrow m, MonadIO m, Applicative m, MonadBase IO m) => MonadResource m #

A `Monad` which allows for safe resource allocation. In theory, any monad transformer stack which includes a `ResourceT` can be an instance of `MonadResource`.

Note: `runResourceT` has a requirement for a `MonadBaseControl IO m` monad, which allows control operations to be lifted. A `MonadResource` does not have this requirement. This means that transformers such as `ContT` can be an instance of `MonadResource`. However, the `ContT` wrapper will need to be unwrapped before calling `runResourceT`.

Since 0.3.0

Minimal complete definition

liftResourceT

Instances

MonadResource m => MonadResource (MaybeT m) |
Methods liftResourceT :: ResourceT IO a -> MaybeT m a #
MonadResource m => MonadResource (ListT m) |
Methods liftResourceT :: ResourceT IO a -> ListT m a #
(MonadThrow m, MonadBase IO m, MonadIO m, Applicative m) => MonadResource (ResourceT m) |
Methods liftResourceT :: ResourceT IO a -> ResourceT m a #
(Monoid w, MonadResource m) => MonadResource (WriterT w m) |
Methods liftResourceT :: ResourceT IO a -> WriterT w m a #
(Monoid w, MonadResource m) => MonadResource (WriterT w m) |
Methods liftResourceT :: ResourceT IO a -> WriterT w m a #
MonadResource m => MonadResource (StateT s m) |
Methods liftResourceT :: ResourceT IO a -> StateT s m a #
MonadResource m => MonadResource (StateT s m) |
Methods liftResourceT :: ResourceT IO a -> StateT s m a #
(Error e, MonadResource m) => MonadResource (ErrorT e m) |
Methods liftResourceT :: ResourceT IO a -> ErrorT e m a #
MonadResource m => MonadResource (ExceptT e m) |
Methods liftResourceT :: ResourceT IO a -> ExceptT e m a #
MonadResource m => MonadResource (IdentityT * m) |
Methods liftResourceT :: ResourceT IO a -> IdentityT * m a #
MonadResource m => MonadResource (ReaderT * r m) |
Methods liftResourceT :: ResourceT IO a -> ReaderT * r m a #
MonadResource m => MonadResource (ConduitM i o m) |
Methods liftResourceT :: ResourceT IO a -> ConduitM i o m a #
MonadResource m => MonadResource (ContT * r m) |
Methods liftResourceT :: ResourceT IO a -> ContT * r m a #
(Monoid w, MonadResource m) => MonadResource (RWST r w s m) |
Methods liftResourceT :: ResourceT IO a -> RWST r w s m a #
(Monoid w, MonadResource m) => MonadResource (RWST r w s m) |
Methods liftResourceT :: ResourceT IO a -> RWST r w s m a #
MonadResource m => MonadResource (Pipe l i o u m) |
Methods liftResourceT :: ResourceT IO a -> Pipe l i o u m a #

data ResourceT m a :: (* -> *) -> * -> * #

The Resource transformer. This transformer keeps track of all registered actions, and calls them upon exit (via `runResourceT`). Actions may be registered via `register`, or resources may be allocated atomically via `allocate`. `allocate` corresponds closely to `bracket`.

Releasing may be performed before exit via the `release` function. This is a highly recommended optimization, as it will ensure that scarce resources are freed early. Note that calling `release` will deregister the action, so that a release action will only ever be called once.

Since 0.3.0

Instances

MFunctor ResourceT | Since 0.4.7
Methods hoist :: Monad m => (forall a. m a -> n a) -> ResourceT m b -> ResourceT n b #
MMonad ResourceT | Since 0.4.7
Methods embed :: Monad n => (forall a. m a -> ResourceT n a) -> ResourceT m b -> ResourceT n b #
MonadTrans ResourceT |
Methods lift :: Monad m => m a -> ResourceT m a #
MonadTransControl ResourceT |
Associated Types type StT (ResourceT :: (* -> *) -> * -> *) a :: * # Methods liftWith :: Monad m => (Run ResourceT -> m a) -> ResourceT m a # restoreT :: Monad m => m (StT ResourceT a) -> ResourceT m a #
MonadRWS r w s m => MonadRWS r w s (ResourceT m) |
MonadBaseControl b m => MonadBaseControl b (ResourceT m) |
Associated Types type StM (ResourceT m :: * -> *) a :: * # Methods liftBaseWith :: (RunInBase (ResourceT m) b -> b a) -> ResourceT m a # restoreM :: StM (ResourceT m) a -> ResourceT m a #
MonadBase b m => MonadBase b (ResourceT m) |
Methods liftBase :: b α -> ResourceT m α #
MonadError e m => MonadError e (ResourceT m) |
Methods throwError :: e -> ResourceT m a # catchError :: ResourceT m a -> (e -> ResourceT m a) -> ResourceT m a #
MonadReader r m => MonadReader r (ResourceT m) |
Methods ask :: ResourceT m r # local :: (r -> r) -> ResourceT m a -> ResourceT m a # reader :: (r -> a) -> ResourceT m a #
MonadState s m => MonadState s (ResourceT m) |
Methods get :: ResourceT m s # put :: s -> ResourceT m () # state :: (s -> (a, s)) -> ResourceT m a #
MonadWriter w m => MonadWriter w (ResourceT m) |
Methods writer :: (a, w) -> ResourceT m a # tell :: w -> ResourceT m () # listen :: ResourceT m a -> ResourceT m (a, w) # pass :: ResourceT m (a, w -> w) -> ResourceT m a #
Monad m => Monad (ResourceT m) |
Methods (>>=) :: ResourceT m a -> (a -> ResourceT m b) -> ResourceT m b # (>>) :: ResourceT m a -> ResourceT m b -> ResourceT m b # return :: a -> ResourceT m a # fail :: String -> ResourceT m a #
Functor m => Functor (ResourceT m) |
Methods fmap :: (a -> b) -> ResourceT m a -> ResourceT m b # (<$) :: a -> ResourceT m b -> ResourceT m a #
Applicative m => Applicative (ResourceT m) |
Methods pure :: a -> ResourceT m a # (<*>) :: ResourceT m (a -> b) -> ResourceT m a -> ResourceT m b # (*>) :: ResourceT m a -> ResourceT m b -> ResourceT m b # (<*) :: ResourceT m a -> ResourceT m b -> ResourceT m a #
Alternative m => Alternative (ResourceT m) | Since 1.1.5
Methods empty :: ResourceT m a # (<|>) :: ResourceT m a -> ResourceT m a -> ResourceT m a # some :: ResourceT m a -> ResourceT m [a] # many :: ResourceT m a -> ResourceT m [a] #
MonadPlus m => MonadPlus (ResourceT m) | Since 1.1.5
Methods mzero :: ResourceT m a # mplus :: ResourceT m a -> ResourceT m a -> ResourceT m a #
MonadIO m => MonadIO (ResourceT m) |
Methods liftIO :: IO a -> ResourceT m a #
MonadThrow m => MonadThrow (ResourceT m) |
Methods throwM :: Exception e => e -> ResourceT m a #
MonadCatch m => MonadCatch (ResourceT m) |
Methods catch :: Exception e => ResourceT m a -> (e -> ResourceT m a) -> ResourceT m a #
MonadMask m => MonadMask (ResourceT m) |
Methods mask :: ((forall a. ResourceT m a -> ResourceT m a) -> ResourceT m b) -> ResourceT m b # uninterruptibleMask :: ((forall a. ResourceT m a -> ResourceT m a) -> ResourceT m b) -> ResourceT m b #
MonadCont m => MonadCont (ResourceT m) |
Methods callCC :: ((a -> ResourceT m b) -> ResourceT m a) -> ResourceT m a #
(MonadThrow m, MonadBase IO m, MonadIO m, Applicative m) => MonadResource (ResourceT m) |
Methods liftResourceT :: ResourceT IO a -> ResourceT m a #
type StT ResourceT a |
type StT ResourceT a = a
type StM (ResourceT m) a |
type StM (ResourceT m) a = StM m a

runResourceT :: MonadBaseControl IO m => ResourceT m a -> m a #

Unwrap a `ResourceT` transformer, and call all registered release actions.

Note that there is some reference counting involved due to `resourceForkIO`. If multiple threads are sharing the same collection of resources, only the last call to `runResourceT` will deallocate the resources.

Since 0.3.0

# Acquire

module Data.Acquire

withAcquire :: MonadBaseControl IO m => Acquire a -> (a -> m b) -> m b #

# Pure pipelines

newtype Identity a :: * -> * #

Identity functor and monad. (a non-strict monad)

Since: 4.8.0.0

Constructors

Identity |
Fields runIdentity :: a

Instances

Monad Identity |
Methods (>>=) :: Identity a -> (a -> Identity b) -> Identity b # (>>) :: Identity a -> Identity b -> Identity b # return :: a -> Identity a # fail :: String -> Identity a #
Functor Identity |
Methods fmap :: (a -> b) -> Identity a -> Identity b # (<$) :: a -> Identity b -> Identity a #
MonadFix Identity |
Methods mfix :: (a -> Identity a) -> Identity a #
Applicative Identity |
Methods pure :: a -> Identity a # (<*>) :: Identity (a -> b) -> Identity a -> Identity b # (*>) :: Identity a -> Identity b -> Identity b # (<*) :: Identity a -> Identity b -> Identity a #
Foldable 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 #
Traversable Identity |
Methods traverse :: Applicative f => (a -> f b) -> Identity a -> f (Identity b) # sequenceA :: Applicative f => Identity (f a) -> f (Identity a) # mapM :: Monad m => (a -> m b) -> Identity a -> m (Identity b) # sequence :: Monad m => Identity (m a) -> m (Identity a) #
Generic1 Identity |
Associated Types type Rep1 (Identity :: * -> *) :: * -> * # Methods from1 :: Identity a -> Rep1 Identity a # to1 :: Rep1 Identity a -> Identity a #
Eq1 Identity |
Methods liftEq :: (a -> b -> Bool) -> Identity a -> Identity b -> Bool #
Ord1 Identity |
Methods liftCompare :: (a -> b -> Ordering) -> Identity a -> Identity b -> Ordering #
Read1 Identity |
Methods liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (Identity a) # liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [Identity a] #
Show1 Identity |
Methods liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Identity a -> ShowS # liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [Identity a] -> ShowS #
MonadZip Identity |
Methods mzip :: Identity a -> Identity b -> Identity (a, b) # mzipWith :: (a -> b -> c) -> Identity a -> Identity b -> Identity c # munzip :: Identity (a, b) -> (Identity a, Identity b) #
MonadBaseControl Identity Identity |
Associated Types type StM (Identity :: * -> *) a :: * # Methods liftBaseWith :: (RunInBase Identity Identity -> Identity a) -> Identity a # restoreM :: StM Identity a -> Identity a #
MonadBase Identity Identity |
Methods liftBase :: Identity α -> Identity α #
Bounded a => Bounded (Identity a) |
Methods minBound :: Identity a # maxBound :: Identity a #
Enum a => Enum (Identity a) |
Methods succ :: Identity a -> Identity a # pred :: Identity a -> Identity a # toEnum :: Int -> Identity a # fromEnum :: Identity a -> Int # enumFrom :: Identity a -> [Identity a] # enumFromThen :: Identity a -> Identity a -> [Identity a] # enumFromTo :: Identity a -> Identity a -> [Identity a] # enumFromThenTo :: Identity a -> Identity a -> Identity a -> [Identity a] #
Eq a => Eq (Identity a) |
Methods (==) :: Identity a -> Identity a -> Bool # (/=) :: Identity a -> Identity a -> Bool #
Floating a => Floating (Identity a) |
Methods pi :: Identity a # exp :: Identity a -> Identity a # log :: Identity a -> Identity a # sqrt :: Identity a -> Identity a # (**) :: Identity a -> Identity a -> Identity a # logBase :: Identity a -> Identity a -> Identity a # sin :: Identity a -> Identity a # cos :: Identity a -> Identity a # tan :: Identity a -> Identity a # asin :: Identity a -> Identity a # acos :: Identity a -> Identity a # atan :: Identity a -> Identity a # sinh :: Identity a -> Identity a # cosh :: Identity a -> Identity a # tanh :: Identity a -> Identity a # asinh :: Identity a -> Identity a # acosh :: Identity a -> Identity a # atanh :: Identity a -> Identity a # log1p :: Identity a -> Identity a # expm1 :: Identity a -> Identity a # log1pexp :: Identity a -> Identity a # log1mexp :: Identity a -> Identity a #
Fractional a => Fractional (Identity a) |
Methods (/) :: Identity a -> Identity a -> Identity a # recip :: Identity a -> Identity a # fromRational :: Rational -> Identity a #
Integral a => Integral (Identity a) |
Methods quot :: Identity a -> Identity a -> Identity a # rem :: Identity a -> Identity a -> Identity a # div :: Identity a -> Identity a -> Identity a # mod :: Identity a -> Identity a -> Identity a # quotRem :: Identity a -> Identity a -> (Identity a, Identity a) # divMod :: Identity a -> Identity a -> (Identity a, Identity a) # toInteger :: Identity a -> Integer #
Data a => Data (Identity a) |
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Identity a -> c (Identity a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Identity a) # toConstr :: Identity a -> Constr # dataTypeOf :: Identity a -> DataType # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c (Identity a)) # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Identity a)) # gmapT :: (forall b. Data b => b -> b) -> Identity a -> Identity a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Identity a -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Identity a -> r # gmapQ :: (forall d. Data d => d -> u) -> Identity a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Identity a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Identity a -> m (Identity a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Identity a -> m (Identity a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Identity a -> m (Identity a) #
Num a => Num (Identity a) |
Methods (+) :: Identity a -> Identity a -> Identity a # (-) :: Identity a -> Identity a -> Identity a # (*) :: Identity a -> Identity a -> Identity a # negate :: Identity a -> Identity a # abs :: Identity a -> Identity a # signum :: Identity a -> Identity a # fromInteger :: Integer -> Identity a #
Ord a => Ord (Identity a) |
Methods compare :: Identity a -> Identity a -> Ordering # (<) :: Identity a -> Identity a -> Bool # (<=) :: Identity a -> Identity a -> Bool # (>) :: Identity a -> Identity a -> Bool # (>=) :: Identity a -> Identity a -> Bool # max :: Identity a -> Identity a -> Identity a # min :: Identity a -> Identity a -> Identity a #
Read a => Read (Identity a) | This instance would be equivalent to the derived instances of the `Identity` newtype if the `runIdentity` field were removed
Methods readsPrec :: Int -> ReadS (Identity a) # readList :: ReadS [Identity a] # readPrec :: ReadPrec (Identity a) # readListPrec :: ReadPrec [Identity a] #
Real a => Real (Identity a) |
Methods toRational :: Identity a -> Rational #
RealFloat a => RealFloat (Identity a) |
Methods floatRadix :: Identity a -> Integer # floatDigits :: Identity a -> Int # floatRange :: Identity a -> (Int, Int) # decodeFloat :: Identity a -> (Integer, Int) # encodeFloat :: Integer -> Int -> Identity a # exponent :: Identity a -> Int # significand :: Identity a -> Identity a # scaleFloat :: Int -> Identity a -> Identity a # isNaN :: Identity a -> Bool # isInfinite :: Identity a -> Bool # isDenormalized :: Identity a -> Bool # isNegativeZero :: Identity a -> Bool # isIEEE :: Identity a -> Bool # atan2 :: Identity a -> Identity a -> Identity a #
RealFrac a => RealFrac (Identity a) |
Methods properFraction :: Integral b => Identity a -> (b, Identity a) # truncate :: Integral b => Identity a -> b # round :: Integral b => Identity a -> b # ceiling :: Integral b => Identity a -> b # floor :: Integral b => Identity a -> b #
Show a => Show (Identity a) | This instance would be equivalent to the derived instances of the `Identity` newtype if the `runIdentity` field were removed
Methods showsPrec :: Int -> Identity a -> ShowS # show :: Identity a -> String # showList :: [Identity a] -> ShowS #
Ix a => Ix (Identity a) |
Methods range :: (Identity a, Identity a) -> [Identity a] # index :: (Identity a, Identity a) -> Identity a -> Int # unsafeIndex :: (Identity a, Identity a) -> Identity a -> Int inRange :: (Identity a, Identity a) -> Identity a -> Bool # rangeSize :: (Identity a, Identity a) -> Int # unsafeRangeSize :: (Identity a, Identity a) -> Int
IsString a => IsString (Identity a) |
Methods fromString :: String -> Identity a #
Generic (Identity a) |
Associated Types type Rep (Identity a) :: * -> * # Methods from :: Identity a -> Rep (Identity a) x # to :: Rep (Identity a) x -> Identity a #
Semigroup a => Semigroup (Identity a) |
Methods (<>) :: Identity a -> Identity a -> Identity a # sconcat :: NonEmpty (Identity a) -> Identity a # stimes :: Integral b => b -> Identity a -> Identity a #
Monoid a => Monoid (Identity a) |
Methods mempty :: Identity a # mappend :: Identity a -> Identity a -> Identity a # mconcat :: [Identity a] -> Identity a #
Storable a => Storable (Identity a) |
Methods sizeOf :: Identity a -> Int # alignment :: Identity a -> Int # peekElemOff :: Ptr (Identity a) -> Int -> IO (Identity a) # pokeElemOff :: Ptr (Identity a) -> Int -> Identity a -> IO () # peekByteOff :: Ptr b -> Int -> IO (Identity a) # pokeByteOff :: Ptr b -> Int -> Identity a -> IO () # peek :: Ptr (Identity a) -> IO (Identity a) # poke :: Ptr (Identity a) -> Identity a -> IO () #
Bits a => Bits (Identity a) |
Methods (.&.) :: Identity a -> Identity a -> Identity a # (.|.) :: Identity a -> Identity a -> Identity a # xor :: Identity a -> Identity a -> Identity a # complement :: Identity a -> Identity a # shift :: Identity a -> Int -> Identity a # rotate :: Identity a -> Int -> Identity a # zeroBits :: Identity a # bit :: Int -> Identity a # setBit :: Identity a -> Int -> Identity a # clearBit :: Identity a -> Int -> Identity a # complementBit :: Identity a -> Int -> Identity a # testBit :: Identity a -> Int -> Bool # bitSizeMaybe :: Identity a -> Maybe Int # bitSize :: Identity a -> Int # isSigned :: Identity a -> Bool # shiftL :: Identity a -> Int -> Identity a # unsafeShiftL :: Identity a -> Int -> Identity a # shiftR :: Identity a -> Int -> Identity a # unsafeShiftR :: Identity a -> Int -> Identity a # rotateL :: Identity a -> Int -> Identity a # rotateR :: Identity a -> Int -> Identity a # popCount :: Identity a -> Int #
FiniteBits a => FiniteBits (Identity a) |
Methods finiteBitSize :: Identity a -> Int # countLeadingZeros :: Identity a -> Int # countTrailingZeros :: Identity a -> Int #
MonoFunctor (Identity a) |
Methods omap :: (Element (Identity a) -> Element (Identity a)) -> Identity a -> Identity a #
MonoFoldable (Identity a) |
Methods ofoldMap :: Monoid m => (Element (Identity a) -> m) -> Identity a -> m # ofoldr :: (Element (Identity a) -> b -> b) -> b -> Identity a -> b # ofoldl' :: (a -> Element (Identity a) -> a) -> a -> Identity a -> a # otoList :: Identity a -> [Element (Identity a)] # oall :: (Element (Identity a) -> Bool) -> Identity a -> Bool # oany :: (Element (Identity a) -> Bool) -> Identity a -> Bool # onull :: Identity a -> Bool # olength :: Identity a -> Int # olength64 :: Identity a -> Int64 # ocompareLength :: Integral i => Identity a -> i -> Ordering # otraverse_ :: Applicative f => (Element (Identity a) -> f b) -> Identity a -> f () # ofor_ :: Applicative f => Identity a -> (Element (Identity a) -> f b) -> f () # omapM_ :: Applicative m => (Element (Identity a) -> m ()) -> Identity a -> m () # oforM_ :: Applicative m => Identity a -> (Element (Identity a) -> m ()) -> m () # ofoldlM :: Monad m => (a -> Element (Identity a) -> m a) -> a -> Identity a -> m a # ofoldMap1Ex :: Semigroup m => (Element (Identity a) -> m) -> Identity a -> m # ofoldr1Ex :: (Element (Identity a) -> Element (Identity a) -> Element (Identity a)) -> Identity a -> Element (Identity a) # ofoldl1Ex' :: (Element (Identity a) -> Element (Identity a) -> Element (Identity a)) -> Identity a -> Element (Identity a) # headEx :: Identity a -> Element (Identity a) # lastEx :: Identity a -> Element (Identity a) # unsafeHead :: Identity a -> Element (Identity a) # unsafeLast :: Identity a -> Element (Identity a) # maximumByEx :: (Element (Identity a) -> Element (Identity a) -> Ordering) -> Identity a -> Element (Identity a) # minimumByEx :: (Element (Identity a) -> Element (Identity a) -> Ordering) -> Identity a -> Element (Identity a) #
MonoTraversable (Identity a) |
Methods otraverse :: Applicative f => (Element (Identity a) -> f (Element (Identity a))) -> Identity a -> f (Identity a) # omapM :: Applicative m => (Element (Identity a) -> m (Element (Identity a))) -> Identity a -> m (Identity a) #
MonoPointed (Identity a) |
Methods opoint :: Element (Identity a) -> Identity a #
type Rep1 Identity |
type Rep1 Identity = D1 (MetaData "Identity" "Data.Functor.Identity" "base" True) (C1 (MetaCons "Identity" PrefixI True) (S1 (MetaSel (Just Symbol "runIdentity") NoSourceUnpackedness NoSourceStrictness DecidedLazy) Par1))
type StM Identity a |
type StM Identity a = a
type Rep (Identity a) |
type Rep (Identity a) = D1 (MetaData "Identity" "Data.Functor.Identity" "base" True) (C1 (MetaCons "Identity" PrefixI True) (S1 (MetaSel (Just Symbol "runIdentity") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a)))
type Element (Identity a) |
type Element (Identity a) = a