classy-prelude-conduit-1.5.0: classy-prelude together with conduit functions

Safe HaskellNone
LanguageHaskell2010

ClassyPrelude.Conduit

Contents

Synopsis

Re-export

data Void #

Uninhabited data type

Since: base-4.8.0.0

Instances
Eq Void

Since: base-4.8.0.0

Instance details

Defined in Data.Void

Methods

(==) :: Void -> Void -> Bool #

(/=) :: Void -> Void -> Bool #

Data Void

Since: base-4.8.0.0

Instance details

Defined in Data.Void

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Void -> c Void #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Void #

toConstr :: Void -> Constr #

dataTypeOf :: Void -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Void) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Void) #

gmapT :: (forall b. Data b => b -> b) -> Void -> Void #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Void -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Void -> r #

gmapQ :: (forall d. Data d => d -> u) -> Void -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Void -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Void -> m Void #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Void -> m Void #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Void -> m Void #

Ord Void

Since: base-4.8.0.0

Instance details

Defined in Data.Void

Methods

compare :: Void -> Void -> Ordering #

(<) :: Void -> Void -> Bool #

(<=) :: Void -> Void -> Bool #

(>) :: Void -> Void -> Bool #

(>=) :: Void -> Void -> Bool #

max :: Void -> Void -> Void #

min :: Void -> Void -> Void #

Read Void

Reading a Void value is always a parse error, considering Void as a data type with no constructors.

Since: base-4.8.0.0

Instance details

Defined in Data.Void

Show Void

Since: base-4.8.0.0

Instance details

Defined in Data.Void

Methods

showsPrec :: Int -> Void -> ShowS #

show :: Void -> String #

showList :: [Void] -> ShowS #

Ix Void

Since: base-4.8.0.0

Instance details

Defined in Data.Void

Methods

range :: (Void, Void) -> [Void] #

index :: (Void, Void) -> Void -> Int #

unsafeIndex :: (Void, Void) -> Void -> Int

inRange :: (Void, Void) -> Void -> Bool #

rangeSize :: (Void, Void) -> Int #

unsafeRangeSize :: (Void, Void) -> Int

Generic Void 
Instance details

Defined in Data.Void

Associated Types

type Rep Void :: * -> * #

Methods

from :: Void -> Rep Void x #

to :: Rep Void x -> Void #

Semigroup Void

Since: base-4.9.0.0

Instance details

Defined in Data.Void

Methods

(<>) :: Void -> Void -> Void #

sconcat :: NonEmpty Void -> Void #

stimes :: Integral b => b -> Void -> Void #

Exception Void

Since: base-4.8.0.0

Instance details

Defined in Data.Void

Hashable Void 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Void -> Int #

hash :: Void -> Int #

NFData Void

Defined as rnf = absurd.

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: Void -> () #

type Rep Void

Since: base-4.8.0.0

Instance details

Defined in Data.Void

type Rep Void = D1 (MetaData "Void" "Data.Void" "base" False) (V1 :: * -> *)

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:

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 Acquire 
Instance details

Defined in Data.Acquire.Internal

Methods

liftIO :: IO a -> Acquire a #

MonadIO m => MonadIO (MaybeT m) 
Instance details

Defined in Control.Monad.Trans.Maybe

Methods

liftIO :: IO a -> MaybeT m a #

MonadIO m => MonadIO (CatchT m) 
Instance details

Defined in Control.Monad.Catch.Pure

Methods

liftIO :: IO a -> CatchT m a #

MonadIO m => MonadIO (ResourceT m) 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

liftIO :: IO a -> ResourceT 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 #

(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 #

MonadIO m => MonadIO (StateT s m) 
Instance details

Defined in Control.Monad.Trans.State.Strict

Methods

liftIO :: IO a -> StateT s 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 (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

liftIO :: IO a -> ExceptT e m a #

(Functor f, MonadIO m) => MonadIO (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

liftIO :: IO a -> FreeT f 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 (ReaderT r m) 
Instance details

Defined in Control.Monad.Trans.Reader

Methods

liftIO :: IO a -> ReaderT r m a #

MonadIO m => MonadIO (ConduitT i o m) 
Instance details

Defined in Data.Conduit.Internal.Conduit

Methods

liftIO :: IO a -> ConduitT i o 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 #

(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 #

MonadIO m => MonadIO (Pipe l i o u m) 
Instance details

Defined in Data.Conduit.Internal.Pipe

Methods

liftIO :: IO a -> Pipe l i o u m a #

newtype Identity a #

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

Since: base-4.8.0.0

Constructors

Identity 

Fields

Instances
Monad Identity

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.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

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Methods

fmap :: (a -> b) -> Identity a -> Identity b #

(<$) :: a -> Identity b -> Identity a #

MonadFix Identity

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Methods

mfix :: (a -> Identity a) -> Identity a #

Applicative Identity

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Methods

pure :: a -> Identity a #

(<*>) :: Identity (a -> b) -> Identity a -> Identity b #

liftA2 :: (a -> b -> c) -> Identity a -> Identity b -> Identity c #

(*>) :: Identity a -> Identity b -> Identity b #

(<*) :: Identity a -> Identity b -> Identity 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 #

Traversable Identity 
Instance details

Defined in Data.Traversable

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) #

Representable Identity 
Instance details

Defined in Data.Functor.Rep

Associated Types

type Rep Identity :: * #

Methods

tabulate :: (Rep Identity -> a) -> Identity a #

index :: Identity a -> Rep Identity -> a #

NFData1 Identity

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

liftRnf :: (a -> ()) -> Identity a -> () #

Hashable1 Identity 
Instance details

Defined in Data.Hashable.Class

Methods

liftHashWithSalt :: (Int -> a -> Int) -> Int -> Identity a -> Int #

Keyed Identity 
Instance details

Defined in Data.Key

Methods

mapWithKey :: (Key Identity -> a -> b) -> Identity a -> Identity b #

Zip Identity 
Instance details

Defined in Data.Key

Methods

zipWith :: (a -> b -> c) -> Identity a -> Identity b -> Identity c #

zip :: Identity a -> Identity b -> Identity (a, b) #

zap :: Identity (a -> b) -> Identity a -> Identity b #

ZipWithKey Identity 
Instance details

Defined in Data.Key

Methods

zipWithKey :: (Key Identity -> a -> b -> c) -> Identity a -> Identity b -> Identity c #

zapWithKey :: Identity (Key Identity -> a -> b) -> Identity a -> Identity b #

Indexable Identity 
Instance details

Defined in Data.Key

Methods

index :: Identity a -> Key Identity -> a #

Lookup Identity 
Instance details

Defined in Data.Key

Methods

lookup :: Key Identity -> Identity a -> Maybe a #

Adjustable Identity 
Instance details

Defined in Data.Key

Methods

adjust :: (a -> a) -> Key Identity -> Identity a -> Identity a #

replace :: Key Identity -> a -> Identity a -> Identity a #

FoldableWithKey Identity 
Instance details

Defined in Data.Key

Methods

toKeyedList :: Identity a -> [(Key Identity, a)] #

foldMapWithKey :: Monoid m => (Key Identity -> a -> m) -> Identity a -> m #

foldrWithKey :: (Key Identity -> a -> b -> b) -> b -> Identity a -> b #

foldlWithKey :: (b -> Key Identity -> a -> b) -> b -> Identity a -> b #

FoldableWithKey1 Identity 
Instance details

Defined in Data.Key

Methods

foldMapWithKey1 :: Semigroup m => (Key Identity -> a -> m) -> Identity a -> m #

TraversableWithKey Identity 
Instance details

Defined in Data.Key

Methods

traverseWithKey :: Applicative f => (Key Identity -> a -> f b) -> Identity a -> f (Identity b) #

mapWithKeyM :: Monad m => (Key Identity -> a -> m b) -> Identity a -> m (Identity b) #

TraversableWithKey1 Identity 
Instance details

Defined in Data.Key

Methods

traverseWithKey1 :: Apply f => (Key Identity -> a -> f b) -> Identity a -> f (Identity b) #

Bounded a => Bounded (Identity a) 
Instance details

Defined in Data.Functor.Identity

Enum a => Enum (Identity a) 
Instance details

Defined in Data.Functor.Identity

Eq a => Eq (Identity a) 
Instance details

Defined in Data.Functor.Identity

Methods

(==) :: Identity a -> Identity a -> Bool #

(/=) :: Identity a -> Identity a -> Bool #

Floating a => Floating (Identity a) 
Instance details

Defined in Data.Functor.Identity

Fractional a => Fractional (Identity a) 
Instance details

Defined in Data.Functor.Identity

Integral a => Integral (Identity a) 
Instance details

Defined in Data.Functor.Identity

Num a => Num (Identity a) 
Instance details

Defined in Data.Functor.Identity

Ord a => Ord (Identity a) 
Instance details

Defined in Data.Functor.Identity

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

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Real a => Real (Identity a) 
Instance details

Defined in Data.Functor.Identity

Methods

toRational :: Identity a -> Rational #

RealFloat a => RealFloat (Identity a) 
Instance details

Defined in Data.Functor.Identity

RealFrac a => RealFrac (Identity a) 
Instance details

Defined in Data.Functor.Identity

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

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Methods

showsPrec :: Int -> Identity a -> ShowS #

show :: Identity a -> String #

showList :: [Identity a] -> ShowS #

Ix a => Ix (Identity a) 
Instance details

Defined in Data.Functor.Identity

IsString a => IsString (Identity a) 
Instance details

Defined in Data.String

Methods

fromString :: String -> Identity a #

Generic (Identity a) 
Instance details

Defined in Data.Functor.Identity

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) 
Instance details

Defined in Data.Functor.Identity

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) 
Instance details

Defined in Data.Functor.Identity

Methods

mempty :: Identity a #

mappend :: Identity a -> Identity a -> Identity a #

mconcat :: [Identity a] -> Identity a #

Storable a => Storable (Identity a) 
Instance details

Defined in Data.Functor.Identity

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) 
Instance details

Defined in Data.Functor.Identity

FiniteBits a => FiniteBits (Identity a) 
Instance details

Defined in Data.Functor.Identity

Hashable a => Hashable (Identity a) 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Identity a -> Int #

hash :: Identity a -> Int #

MonoPointed (Identity a) 
Instance details

Defined in Data.MonoTraversable

Methods

opoint :: Element (Identity a) -> Identity a #

MonoTraversable (Identity a) 
Instance details

Defined in Data.MonoTraversable

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) #

MonoFoldable (Identity a) 
Instance details

Defined in Data.MonoTraversable

Methods

ofoldMap :: Monoid m => (Element (Identity a) -> m) -> Identity a -> m #

ofoldr :: (Element (Identity a) -> b -> b) -> b -> Identity a -> b #

ofoldl' :: (a0 -> Element (Identity a) -> a0) -> a0 -> Identity a -> a0 #

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 => (a0 -> Element (Identity a) -> m a0) -> a0 -> Identity a -> m a0 #

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) #

oelem :: Element (Identity a) -> Identity a -> Bool #

onotElem :: Element (Identity a) -> Identity a -> Bool #

MonoFunctor (Identity a) 
Instance details

Defined in Data.MonoTraversable

Methods

omap :: (Element (Identity a) -> Element (Identity a)) -> Identity a -> Identity a #

NFData a => NFData (Identity a)

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: Identity a -> () #

Generic1 Identity 
Instance details

Defined in Data.Functor.Identity

Associated Types

type Rep1 Identity :: k -> * #

Methods

from1 :: Identity a -> Rep1 Identity a #

to1 :: Rep1 Identity a -> Identity a #

type Rep Identity 
Instance details

Defined in Data.Functor.Rep

type Rep Identity = ()
type Key Identity 
Instance details

Defined in Data.Key

type Key Identity = ()
type Rep (Identity a) 
Instance details

Defined in Data.Functor.Identity

type Rep (Identity a) = D1 (MetaData "Identity" "Data.Functor.Identity" "base" True) (C1 (MetaCons "Identity" PrefixI True) (S1 (MetaSel (Just "runIdentity") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a)))
type Element (Identity a) 
Instance details

Defined in Data.MonoTraversable

type Element (Identity a) = a
type Rep1 Identity 
Instance details

Defined in Data.Functor.Identity

type Rep1 Identity = D1 (MetaData "Identity" "Data.Functor.Identity" "base" True) (C1 (MetaCons "Identity" PrefixI True) (S1 (MetaSel (Just "runIdentity") NoSourceUnpackedness NoSourceStrictness DecidedLazy) Par1))

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

Monads which allow their actions to be run in IO.

While MonadIO allows an IO action to be lifted into another monad, this class captures the opposite concept: allowing you to capture the monadic context. Note that, in order to meet the laws given below, the intuition is that a monad must have no monadic state, but may have monadic context. This essentially limits MonadUnliftIO to ReaderT and IdentityT transformers on top of IO.

Laws. For any value u returned by askUnliftIO, it must meet the monad transformer laws as reformulated for MonadUnliftIO:

  • unliftIO u . return = return
  • unliftIO u (m >>= f) = unliftIO u m >>= unliftIO u . f

The third is a currently nameless law which ensures that the current context is preserved.

  • askUnliftIO >>= (u -> liftIO (unliftIO u m)) = m

If you have a name for this, please submit it in a pull request for great glory.

Since: unliftio-core-0.1.0.0

Minimal complete definition

askUnliftIO | withRunInIO

Methods

askUnliftIO :: m (UnliftIO m) #

Capture the current monadic context, providing the ability to run monadic actions in IO.

See UnliftIO for an explanation of why we need a helper datatype here.

Since: unliftio-core-0.1.0.0

withRunInIO :: ((forall a. m a -> IO a) -> IO b) -> m b #

Convenience function for capturing the monadic context and running an IO action with a runner function. The runner function is used to run a monadic action m in IO.

Since: unliftio-core-0.1.0.0

Instances
MonadUnliftIO IO 
Instance details

Defined in Control.Monad.IO.Unlift

Methods

askUnliftIO :: IO (UnliftIO IO) #

withRunInIO :: ((forall a. IO a -> IO a) -> IO b) -> IO b #

MonadUnliftIO m => MonadUnliftIO (ResourceT m)

Since: resourcet-1.1.10

Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

askUnliftIO :: ResourceT m (UnliftIO (ResourceT m)) #

withRunInIO :: ((forall a. ResourceT m a -> IO a) -> IO b) -> ResourceT m b #

MonadUnliftIO m => MonadUnliftIO (IdentityT m) 
Instance details

Defined in Control.Monad.IO.Unlift

Methods

askUnliftIO :: IdentityT m (UnliftIO (IdentityT m)) #

withRunInIO :: ((forall a. IdentityT m a -> IO a) -> IO b) -> IdentityT m b #

MonadUnliftIO m => MonadUnliftIO (ReaderT r m) 
Instance details

Defined in Control.Monad.IO.Unlift

Methods

askUnliftIO :: ReaderT r m (UnliftIO (ReaderT r m)) #

withRunInIO :: ((forall a. ReaderT r m a -> IO a) -> IO b) -> ReaderT r m b #

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

Class of monads which can perform primitive state-transformer actions

Minimal complete definition

primitive

Associated Types

type PrimState (m :: * -> *) :: * #

State token type

Methods

primitive :: (State# (PrimState m) -> (#State# (PrimState m), a#)) -> m a #

Execute a primitive operation

Instances
PrimMonad IO 
Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState IO :: * #

Methods

primitive :: (State# (PrimState IO) -> (#State# (PrimState IO), a#)) -> IO a #

PrimMonad (ST s) 
Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (ST s) :: * #

Methods

primitive :: (State# (PrimState (ST s)) -> (#State# (PrimState (ST s)), a#)) -> ST s a #

PrimMonad m => PrimMonad (MaybeT m) 
Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (MaybeT m) :: * #

Methods

primitive :: (State# (PrimState (MaybeT m)) -> (#State# (PrimState (MaybeT m)), a#)) -> MaybeT m a #

PrimMonad m => PrimMonad (ResourceT m) 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

Associated Types

type PrimState (ResourceT m) :: * #

Methods

primitive :: (State# (PrimState (ResourceT m)) -> (#State# (PrimState (ResourceT m)), a#)) -> ResourceT m a #

PrimMonad m => PrimMonad (ListT m) 
Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (ListT m) :: * #

Methods

primitive :: (State# (PrimState (ListT m)) -> (#State# (PrimState (ListT m)), a#)) -> ListT m a #

PrimMonad m => PrimMonad (IdentityT m) 
Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (IdentityT m) :: * #

Methods

primitive :: (State# (PrimState (IdentityT m)) -> (#State# (PrimState (IdentityT m)), a#)) -> IdentityT m a #

(Monoid w, PrimMonad m) => PrimMonad (WriterT w m) 
Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (WriterT w m) :: * #

Methods

primitive :: (State# (PrimState (WriterT w m)) -> (#State# (PrimState (WriterT w m)), a#)) -> WriterT w m a #

(Monoid w, PrimMonad m) => PrimMonad (WriterT w m) 
Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (WriterT w m) :: * #

Methods

primitive :: (State# (PrimState (WriterT w m)) -> (#State# (PrimState (WriterT w m)), a#)) -> WriterT w m a #

PrimMonad m => PrimMonad (StateT s m) 
Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (StateT s m) :: * #

Methods

primitive :: (State# (PrimState (StateT s m)) -> (#State# (PrimState (StateT s m)), a#)) -> StateT s m a #

PrimMonad m => PrimMonad (StateT s m) 
Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (StateT s m) :: * #

Methods

primitive :: (State# (PrimState (StateT s m)) -> (#State# (PrimState (StateT s m)), a#)) -> StateT s m a #

PrimMonad m => PrimMonad (ExceptT e m) 
Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (ExceptT e m) :: * #

Methods

primitive :: (State# (PrimState (ExceptT e m)) -> (#State# (PrimState (ExceptT e m)), a#)) -> ExceptT e m a #

(Error e, PrimMonad m) => PrimMonad (ErrorT e m) 
Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (ErrorT e m) :: * #

Methods

primitive :: (State# (PrimState (ErrorT e m)) -> (#State# (PrimState (ErrorT e m)), a#)) -> ErrorT e m a #

(Monoid w, PrimMonad m) => PrimMonad (AccumT w m)

Since: primitive-0.6.3.0

Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (AccumT w m) :: * #

Methods

primitive :: (State# (PrimState (AccumT w m)) -> (#State# (PrimState (AccumT w m)), a#)) -> AccumT w m a #

PrimMonad m => PrimMonad (SelectT r m) 
Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (SelectT r m) :: * #

Methods

primitive :: (State# (PrimState (SelectT r m)) -> (#State# (PrimState (SelectT r m)), a#)) -> SelectT r m a #

PrimMonad m => PrimMonad (ReaderT r m) 
Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (ReaderT r m) :: * #

Methods

primitive :: (State# (PrimState (ReaderT r m)) -> (#State# (PrimState (ReaderT r m)), a#)) -> ReaderT r m a #

PrimMonad m => PrimMonad (ConduitT i o m) 
Instance details

Defined in Data.Conduit.Internal.Conduit

Associated Types

type PrimState (ConduitT i o m) :: * #

Methods

primitive :: (State# (PrimState (ConduitT i o m)) -> (#State# (PrimState (ConduitT i o m)), a#)) -> ConduitT i o m a #

PrimMonad m => PrimMonad (ContT r m)

Since: primitive-0.6.3.0

Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (ContT r m) :: * #

Methods

primitive :: (State# (PrimState (ContT r m)) -> (#State# (PrimState (ContT r m)), a#)) -> ContT r m a #

(Monoid w, PrimMonad m) => PrimMonad (RWST r w s m) 
Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (RWST r w s m) :: * #

Methods

primitive :: (State# (PrimState (RWST r w s m)) -> (#State# (PrimState (RWST r w s m)), a#)) -> RWST r w s m a #

(Monoid w, PrimMonad m) => PrimMonad (RWST r w s m) 
Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (RWST r w s m) :: * #

Methods

primitive :: (State# (PrimState (RWST r w s m)) -> (#State# (PrimState (RWST r w s m)), a#)) -> RWST r w s m a #

PrimMonad m => PrimMonad (Pipe l i o u m) 
Instance details

Defined in Data.Conduit.Internal.Pipe

Associated Types

type PrimState (Pipe l i o u m) :: * #

Methods

primitive :: (State# (PrimState (Pipe l i o u m)) -> (#State# (PrimState (Pipe l i o u m)), a#)) -> Pipe l i o u m a #

vectorBuilderC #

Arguments

:: (PrimMonad m, Vector v e, PrimMonad n, PrimState m ~ PrimState n) 
=> Int

size

-> ((e -> n ()) -> ConduitT i Void m r) 
-> ConduitT 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: conduit-1.3.0

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

Same as linesUnbounded, but for ASCII/binary data.

Since: conduit-1.3.0

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

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: conduit-1.3.0

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

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

Since: conduit-1.3.0

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

Insert a newline character after each incoming chunk of data.

Since: conduit-1.3.0

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

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

Since: conduit-1.3.0

lineC :: (Monad m, IsSequence seq, Element seq ~ Char) => ConduitT seq o m r -> ConduitT 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: conduit-1.3.0

decodeUtf8LenientC :: Monad m => ConduitT ByteString Text m () #

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

Since: conduit-1.3.0

decodeUtf8C :: MonadThrow m => ConduitT ByteString Text m () #

Decode a stream of binary data as UTF8.

Since: conduit-1.3.0

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

Encode a stream of text as UTF8.

Since: conduit-1.3.0

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

concatMapM with an accumulator.

Since: conduit-1.3.0

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

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

Analog of scanl for lists, monadic.

Since: conduit-1.3.0

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

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: conduit-1.3.0

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

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

Since: conduit-1.3.0

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

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

Since: conduit-1.3.0

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

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: conduit-1.3.0

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

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: conduit-1.3.0

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

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

Since: conduit-1.3.0

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

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: conduit-1.3.0

chunksOfExactlyCE :: (Monad m, IsSequence seq) => Index seq -> ConduitT seq seq m () #

Split input into chunk of size chunkSize

If the input does not split into chunks exactly, the remainder will be leftover (see also chunksOfE)

Since: conduit-1.3.0

chunksOfCE :: (Monad m, IsSequence seq) => Index seq -> ConduitT seq seq m () #

Split input into chunk of size chunkSize

The last element may be smaller than the chunkSize (see also chunksOfExactlyE which will not yield this last element)

Since: conduit-1.3.0

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

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: conduit-1.3.0

intersperseC :: Monad m => a -> ConduitT a a m () #

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

Since: conduit-1.3.0

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

concatMap with an accumulator.

Since: conduit-1.3.0

mapAccumWhileC :: Monad m => (a -> s -> Either s (s, b)) -> s -> ConduitT 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.

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

Analog of scanl for lists.

Since: conduit-1.3.0

conduitVector #

Arguments

:: (Vector v a, PrimMonad m) 
=> Int

maximum allowed size

-> ConduitT a (v a) m () 

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: conduit-1.3.0

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

Map values as long as the result is Just.

Since: conduit-1.3.0

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

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

Since: conduit-1.3.0

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

Keep only values in the stream passing a given predicate.

Since: conduit-1.3.0

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

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

Since: conduit-1.3.0

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

Same as takeExactly, but for chunked streams.

Since: conduit-1.3.0

takeExactlyC :: Monad m => Int -> ConduitT a b m r -> ConduitT 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 ConduitT 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: conduit-1.3.0

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

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

Same caveats regarding downstream termination apply as with takeE.

Since: conduit-1.3.0

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

Stream all values downstream that match the given predicate.

Same caveats regarding downstream termination apply as with take.

Since: conduit-1.3.0

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

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: conduit-1.3.0

takeC :: Monad m => Int -> ConduitT a a m () #

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: conduit-1.3.0

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

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: conduit-1.3.0

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

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: conduit-1.3.0

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

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: conduit-1.3.0

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

Apply a transformation to all elements in a chunked stream.

Since: conduit-1.3.0

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

Apply a transformation to all values in a stream.

Since: conduit-1.3.0

stderrC :: MonadIO m => ConduitT ByteString o m () #

sinkHandle applied to stderr.

Since: conduit-1.3.0

stdoutC :: MonadIO m => ConduitT ByteString o m () #

sinkHandle applied to stdout.

Since: conduit-1.3.0

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

Print all incoming values to stdout.

Since: conduit-1.3.0

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

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

Since: conduit-1.3.0

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

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

Since: conduit-1.3.0

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

A monadic strict left fold on a chunked stream.

Since: conduit-1.3.0

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

A monadic strict left fold.

Since: conduit-1.3.0

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

Apply the action to all elements in the chunked stream.

Note: the same caveat as with mapM_C applies. If you don't want to consume the values, you can use iterM:

iterM (omapM_ f)

Since: conduit-1.3.0

mapM_C :: Monad m => (a -> m ()) -> ConduitT a o m () #

Apply the action to all values in the stream.

Note: if you want to pass the values instead of consuming them, use iterM instead.

Since: conduit-1.3.0

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

Find the first matching value.

Since: conduit-1.3.0

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

Get the product of all elements in the chunked stream.

Since: conduit-1.3.0

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

Get the product of all values in the stream.

Since: conduit-1.3.0

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

Get the sum of all elements in the chunked stream.

Since: conduit-1.3.0

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

Get the sum of all values in the stream.

Since: conduit-1.3.0

nullCE :: (Monad m, MonoFoldable mono) => ConduitT mono o 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: conduit-1.3.0

nullC :: Monad m => ConduitT a o m Bool #

True if there are no values in the stream.

This function does not modify the stream.

Since: conduit-1.3.0

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

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

Since: conduit-1.3.0

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

Get the smallest value in the stream, if present.

Since: conduit-1.3.0

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

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

Since: conduit-1.3.0

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

Get the largest value in the stream, if present.

Since: conduit-1.3.0

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

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

Since: conduit-1.3.0

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

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

Since: conduit-1.3.0

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

Count how many elements are in the chunked stream.

Since: conduit-1.3.0

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

Count how many values are in the stream.

Since: conduit-1.3.0

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

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

Since: conduit-1.3.0

lastDefC :: Monad m => a -> ConduitT a o m a #

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

Since: conduit-1.3.0

lastC :: Monad m => ConduitT a o m (Maybe a) #

Retrieve the last value in the stream, if present.

Since: conduit-1.3.0

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

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

Since: conduit-1.3.0

peekC :: Monad m => ConduitT a o m (Maybe a) #

View the next value in the stream without consuming it.

Since: conduit-1.3.0

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

Get the next element in the chunked stream.

Since: conduit-1.3.0

headDefC :: Monad m => a -> ConduitT a o m a #

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

Since: conduit-1.3.0

headC :: Monad m => ConduitT a o m (Maybe a) #

Take a single value from the stream, if available.

Since: conduit-1.3.0

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

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

Stops consuming as soon as a match is found.

Since: conduit-1.3.0

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

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

Stops consuming as soon as a match is found.

Since: conduit-1.3.0

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

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

Stops consuming as soon as a match is found.

Since: conduit-1.3.0

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

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

Stops consuming as soon as a match is found.

Since: conduit-1.3.0

asumC :: (Monad m, Alternative f) => ConduitT (f a) o m (f a) #

Alternatively combine all values in the stream.

Since: conduit-1.3.0

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

Are any elements in the chunked stream True?

Consumption stops once the first True is encountered.

Since: conduit-1.3.0

orC :: Monad m => ConduitT Bool o m Bool #

Are any values in the stream True?

Consumption stops once the first True is encountered.

Since: conduit-1.3.0

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

Are all elements in the chunked stream True?

Consumption stops once the first False is encountered.

Since: conduit-1.3.0

andC :: Monad m => ConduitT Bool o m Bool #

Are all values in the stream True?

Consumption stops once the first False is encountered.

Since: conduit-1.3.0

anyCE :: (Monad m, MonoFoldable mono) => (Element mono -> Bool) -> ConduitT mono o 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: conduit-1.3.0

anyC :: Monad m => (a -> Bool) -> ConduitT a o 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: conduit-1.3.0

allCE :: (Monad m, MonoFoldable mono) => (Element mono -> Bool) -> ConduitT mono o 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: conduit-1.3.0

allC :: Monad m => (a -> Bool) -> ConduitT a o 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: conduit-1.3.0

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

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

Since: conduit-1.3.0

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

Apply the provided mapping function and monoidal combine all values.

Since: conduit-1.3.0

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

A strict left fold on a chunked stream.

Since: conduit-1.3.0

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

A strict left fold.

Since: conduit-1.3.0

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

Monoidally combine all elements in the chunked stream.

Since: conduit-1.3.0

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

Monoidally combine all values in the stream.

Since: conduit-1.3.0

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

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

Note: you likely want to use it with monadic composition. See the docs for dropC.

Since: conduit-1.3.0

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

Drop all values which match the given predicate.

Note: you likely want to use it with monadic composition. See the docs for dropC.

Since: conduit-1.3.0

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

Drop a certain number of elements from a chunked stream.

Note: you likely want to use it with monadic composition. See the docs for dropC.

Since: conduit-1.3.0

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

Ignore a certain number of values in the stream.

Note: since this function doesn't produce anything, you probably want to use it with (>>) instead of directly plugging it into a pipeline:

>>> runConduit $ yieldMany [1..5] .| dropC 2 .| sinkList
[]
>>> runConduit $ yieldMany [1..5] .| (dropC 2 >> sinkList)
[3,4,5]

Since: conduit-1.3.0

stdinC :: MonadIO m => ConduitT i ByteString m () #

sourceHandle applied to stdin.

Since: conduit-1.3.0

replicateMC :: Monad m => Int -> m a -> ConduitT i a m () #

Perform the given action n times, yielding each result.

Since: conduit-1.3.0

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

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

Since: conduit-1.3.0

repeatMC :: Monad m => m a -> ConduitT i a m () #

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

Since: conduit-1.3.0

replicateC :: Monad m => Int -> a -> ConduitT i a m () #

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

Since: conduit-1.3.0

repeatC :: Monad m => a -> ConduitT i a m () #

Produce an infinite stream consisting entirely of the given value.

Since: conduit-1.3.0

iterateC :: Monad m => (a -> a) -> a -> ConduitT i a m () #

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

Since: conduit-1.3.0

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

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: conduit-1.3.0

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

Generate a producer from a seed value.

Since: conduit-1.3.0

peekForeverE :: (Monad m, MonoFoldable i) => ConduitT i o m () -> ConduitT i o m () #

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

In contrast to peekForever, this function will ignore empty chunks of data. So for example, if a stream of data contains an empty ByteString, it is still treated as empty, and the consuming function is not called.

Since: conduit-1.3.0

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

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

Since: conduit-1.3.0

mapAccumS :: Monad m => (a -> s -> ConduitT b Void m s) -> s -> ConduitT () b m () -> ConduitT a Void 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]]

reuseBufferStrategy :: IO Buffer -> BufferAllocStrategy #

An unsafe, but possibly more efficient buffer allocation strategy: reuse the buffer, if it is big enough for the next build step to execute.

Since: conduit-1.3.0

allNewBuffersStrategy :: Int -> BufferAllocStrategy #

The simplest buffer allocation strategy: whenever a buffer is requested, allocate a new one that is big enough for the next build step to execute.

NOTE that this allocation strategy may spill quite some memory upon direct insertion of a bytestring by the builder. Thats no problem for garbage collection, but it may lead to unreasonably high memory consumption in special circumstances.

Since: conduit-1.3.0

builderToByteStringWith :: PrimMonad m => BufferAllocStrategy -> ConduitT Builder ByteString m () #

A conduit that incrementally executes builders and passes on the filled chunks as bytestrings to an inner sink.

INV: All bytestrings passed to the inner sink are non-empty.

Since: conduit-1.3.0

unsafeBuilderToByteString :: PrimMonad m => ConduitT Builder ByteString m () #

Incrementally execute builders on the given buffer and pass on the filled chunks as bytestrings. Note that, if the given buffer is too small for the execution of a build step, a larger one will be allocated.

WARNING: This conduit yields bytestrings that are NOT referentially transparent. Their content will be overwritten as soon as control is returned from the inner sink!

Since: conduit-1.3.0

builderToByteStringFlush :: PrimMonad m => ConduitT (Flush Builder) (Flush ByteString) m () #

Same as builderToByteString, but input and output are wrapped in Flush.

Since: conduit-1.3.0

builderToByteString :: PrimMonad m => ConduitT Builder ByteString m () #

Incrementally execute builders and pass on the filled chunks as bytestrings.

Since: conduit-1.3.0

sinkFileBS :: MonadResource m => FilePath -> ConduitT ByteString o m () #

sinkFile specialized to ByteString to help with type inference.

Since: conduit-1.3.0

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

Same as await, but discards any leading onull values.

Since: conduit-1.3.0

sinkNull :: Monad m => ConduitT a o m () #

Consume and discard all remaining values in the stream.

Subject to fusion

Since: conduit-1.3.0

sinkLazyBuilder :: Monad m => ConduitT Builder o m ByteString #

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.

Subject to fusion

Since: conduit-1.3.0

sinkVectorN #

Arguments

:: (Vector v a, PrimMonad m) 
=> Int

maximum allowed size

-> ConduitT a o 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.

Subject to fusion

Since: conduit-1.3.0

sinkVector :: (Vector v a, PrimMonad m) => ConduitT a o 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.

Subject to fusion

Since: conduit-1.3.0

sinkList :: Monad m => ConduitT a o m [a] #

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

Subject to fusion

Since: conduit-1.3.0

sinkLazy :: (Monad m, LazySequence lazy strict) => ConduitT strict o 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.

Subject to fusion

Since: conduit-1.3.0

sourceDirectoryDeep #

Arguments

:: MonadResource m 
=> Bool

Follow directory symlinks

-> FilePath

Root directory

-> ConduitT i FilePath m () 

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: conduit-1.3.0

sourceDirectory :: MonadResource m => FilePath -> ConduitT i FilePath m () #

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: conduit-1.3.0

withSinkFileBuilder :: (MonadUnliftIO m, MonadIO n) => FilePath -> (ConduitM Builder o n () -> m a) -> m a #

Same as withSinkFile, but lets you use a Builder.

Since: conduit-1.3.0

withSinkFile :: (MonadUnliftIO m, MonadIO n) => FilePath -> (ConduitM ByteString o n () -> m a) -> m a #

Like withBinaryFile, but provides a sink to write bytes to.

Since: conduit-1.3.0

withSourceFile :: (MonadUnliftIO m, MonadIO n) => FilePath -> (ConduitM i ByteString n () -> m a) -> m a #

Like withBinaryFile, but provides a source to read bytes from.

Since: conduit-1.3.0

sinkIOHandle :: MonadResource m => IO Handle -> ConduitT ByteString o m () #

An alternative to sinkHandle. Instead of taking a pre-opened Handle, it takes an action that opens a Handle (in write mode), so that it can open it only when needed and close it as soon as possible.

Since: conduit-1.3.0

sinkHandleFlush :: MonadIO m => Handle -> ConduitM (Flush ByteString) o m () #

Stream incoming Flushes, executing them on IO.Handle Note that this function does not automatically close the Handle when processing completes

Since: conduit-1.3.0

sinkHandleBuilder :: MonadIO m => Handle -> ConduitM Builder o m () #

Stream incoming builders, executing them directly on the buffer of the given Handle. Note that this function does not automatically close the Handle when processing completes. Pass flush to flush the buffer.

Since: conduit-1.3.0

sinkHandle :: MonadIO m => Handle -> ConduitT ByteString o m () #

Stream all incoming data to the given Handle. Note that this function does not flush and will not close the Handle when processing completes.

Since: conduit-1.3.0

sinkSystemTempFile #

Arguments

:: MonadResource m 
=> String

filename pattern

-> ConduitM ByteString o m FilePath 

Same as sinkTempFile, but will use the default temp file directory for the system as the first argument.

Since: conduit-1.3.0

sinkTempFile #

Arguments

:: MonadResource m 
=> FilePath

temp directory

-> String

filename pattern

-> ConduitM ByteString o m FilePath 

Stream data into a temporary file in the given directory with the given filename pattern, and return the temporary filename. The temporary file will be automatically deleted when exiting the active ResourceT block, if it still exists.

Since: conduit-1.3.0

withSinkFileCautious :: (MonadUnliftIO m, MonadIO n) => FilePath -> (ConduitM ByteString o n () -> m a) -> m a #

Like sinkFileCautious, but uses the with pattern instead of MonadResource.

Since: conduit-1.3.0

sinkFileCautious :: MonadResource m => FilePath -> ConduitM ByteString o m () #

Cautious version of sinkFile. The idea here is to stream the values to a temporary file in the same directory of the destination file, and only on successfully writing the entire file, moves it atomically to the destination path.

In the event of an exception occurring, the temporary file will be deleted and no move will be made. If the application shuts down without running exception handling (such as machine failure or a SIGKILL), the temporary file will remain and the destination file will be untouched.

Since: conduit-1.3.0

sinkFile :: MonadResource m => FilePath -> ConduitT ByteString o m () #

Stream all incoming data to the given file.

Since: conduit-1.3.0

sourceFileBS :: MonadResource m => FilePath -> ConduitT i ByteString m () #

Same as sourceFile. The alternate name is a holdover from an older version, when sourceFile was more polymorphic than it is today.

Since: conduit-1.3.0

sourceIOHandle :: MonadResource m => IO Handle -> ConduitT i ByteString m () #

An alternative to sourceHandle. Instead of taking a pre-opened Handle, it takes an action that opens a Handle (in read mode), so that it can open it only when needed and close it as soon as possible.

Since: conduit-1.3.0

sourceHandleUnsafe :: MonadIO m => Handle -> ConduitT i ByteString m () #

Same as sourceHandle, but instead of allocating a new buffer for each incoming chunk of data, reuses the same buffer. Therefore, the ByteStrings yielded by this function are not referentially transparent between two different yields.

This function will be slightly more efficient than sourceHandle by avoiding allocations and reducing garbage collections, but should only be used if you can guarantee that you do not reuse a ByteString (or any slice thereof) between two calls to await.

Since: conduit-1.3.0

sourceHandle :: MonadIO m => Handle -> ConduitT i ByteString m () #

Stream the contents of a Handle as binary data. Note that this function will not automatically close the Handle when processing completes, since it did not acquire the Handle in the first place.

Since: conduit-1.3.0

sourceFile :: MonadResource m => FilePath -> ConduitT i ByteString m () #

Stream the contents of a file as binary data.

Since: conduit-1.3.0

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

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

For more information, see toChunks.

Subject to fusion

Since: conduit-1.3.0

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

Yield each of the values contained by the given MonoFoldable.

This will work on many data structures, including lists, ByteStrings, and Vectors.

Subject to fusion

Since: conduit-1.3.0

type BufferAllocStrategy = (IO Buffer, Int -> Buffer -> IO (IO Buffer)) #

A buffer allocation strategy (buf0, nextBuf) specifies the initial buffer to use and how to compute a new buffer nextBuf minSize buf with at least size minSize from a filled buffer buf. The double nesting of the IO monad helps to ensure that the reference to the filled buffer buf is lost as soon as possible, but the new buffer doesn't have to be allocated too early.

Since: conduit-1.3.0

execRWSC :: (Monad m, Monoid w) => r -> s -> ConduitT i o (RWST r w s m) res -> ConduitT i o m (s, w) #

Execute RWST in the base monad

Since 1.0.11

evalRWSC :: (Monad m, Monoid w) => r -> s -> ConduitT i o (RWST r w s m) res -> ConduitT i o m (res, w) #

Evaluate RWST in the base monad

Since 1.0.11

runRWSC :: (Monad m, Monoid w) => r -> s -> ConduitT i o (RWST r w s m) res -> ConduitT i o m (res, s, w) #

Run RWST in the base monad

Since 1.0.11

rwsC :: (Monad m, Monoid w) => (r -> s -> ConduitT i o m (a, s, w)) -> ConduitT i o (RWST r w s m) a #

Wrap the base monad in RWST

Since 1.0.11

execRWSLC :: (Monad m, Monoid w) => r -> s -> ConduitT i o (RWST r w s m) res -> ConduitT i o m (s, w) #

Execute RWST in the base monad

Since 1.0.11

evalRWSLC :: (Monad m, Monoid w) => r -> s -> ConduitT i o (RWST r w s m) res -> ConduitT i o m (res, w) #

Evaluate RWST in the base monad

Since 1.0.11

runRWSLC :: (Monad m, Monoid w) => r -> s -> ConduitT i o (RWST r w s m) res -> ConduitT i o m (res, s, w) #

Run RWST in the base monad

Since 1.0.11

rwsLC :: (Monad m, Monoid w) => (r -> s -> ConduitT i o m (a, s, w)) -> ConduitT i o (RWST r w s m) a #

Wrap the base monad in RWST

Since 1.0.11

execWriterC :: (Monad m, Monoid w) => ConduitT i o (WriterT w m) r -> ConduitT i o m w #

Execute WriterT in the base monad

Since 1.0.11

runWriterC :: (Monad m, Monoid w) => ConduitT i o (WriterT w m) r -> ConduitT i o m (r, w) #

Run WriterT in the base monad

Since 1.0.11

writerC :: (Monad m, Monoid w) => ConduitT i o m (b, w) -> ConduitT i o (WriterT w m) b #

Wrap the base monad in WriterT

Since 1.0.11

execWriterLC :: (Monad m, Monoid w) => ConduitT i o (WriterT w m) r -> ConduitT i o m w #

Execute WriterT in the base monad

Since 1.0.11

runWriterLC :: (Monad m, Monoid w) => ConduitT i o (WriterT w m) r -> ConduitT i o m (r, w) #

Run WriterT in the base monad

Since 1.0.11

writerLC :: (Monad m, Monoid w) => ConduitT i o m (b, w) -> ConduitT i o (WriterT w m) b #

Wrap the base monad in WriterT

Since 1.0.11

execStateC :: Monad m => s -> ConduitT i o (StateT s m) r -> ConduitT i o m s #

Execute StateT in the base monad

Since 1.0.11

evalStateC :: Monad m => s -> ConduitT i o (StateT s m) r -> ConduitT i o m r #

Evaluate StateT in the base monad

Since 1.0.11

runStateC :: Monad m => s -> ConduitT i o (StateT s m) r -> ConduitT i o m (r, s) #

Run StateT in the base monad

Since 1.0.11

stateC :: Monad m => (s -> ConduitT i o m (a, s)) -> ConduitT i o (StateT s m) a #

Wrap the base monad in StateT

Since 1.0.11

execStateLC :: Monad m => s -> ConduitT i o (StateT s m) r -> ConduitT i o m s #

Execute StateT in the base monad

Since 1.0.11

evalStateLC :: Monad m => s -> ConduitT i o (StateT s m) r -> ConduitT i o m r #

Evaluate StateT in the base monad

Since 1.0.11

runStateLC :: Monad m => s -> ConduitT i o (StateT s m) r -> ConduitT i o m (r, s) #

Run StateT in the base monad

Since 1.0.11

stateLC :: Monad m => (s -> ConduitT i o m (a, s)) -> ConduitT i o (StateT s m) a #

Wrap the base monad in StateT

Since 1.0.11

runReaderC :: Monad m => r -> ConduitT i o (ReaderT r m) res -> ConduitT i o m res #

Run ReaderT in the base monad

Since 1.0.11

readerC :: Monad m => (r -> ConduitT i o m a) -> ConduitT i o (ReaderT r m) a #

Wrap the base monad in ReaderT

Since 1.0.11

runMaybeC :: Monad m => ConduitT i o (MaybeT m) r -> ConduitT i o m (Maybe r) #

Run MaybeT in the base monad

Since 1.0.11

maybeC :: Monad m => ConduitT i o m (Maybe a) -> ConduitT i o (MaybeT m) a #

Wrap the base monad in MaybeT

Since 1.0.11

catchCatchC :: Monad m => ConduitT i o (CatchT m) r -> (SomeException -> ConduitT i o (CatchT m) r) -> ConduitT i o (CatchT m) r #

Catch an exception in the base monad

Since 1.1.0

runCatchC :: Monad m => ConduitT i o (CatchT m) r -> ConduitT i o m (Either SomeException r) #

Run CatchT in the base monad

Since 1.1.0

catchExceptC :: Monad m => ConduitT i o (ExceptT e m) r -> (e -> ConduitT i o (ExceptT e m) r) -> ConduitT i o (ExceptT e m) r #

Catch an error in the base monad

Since 1.2.12

runExceptC :: Monad m => ConduitT i o (ExceptT e m) r -> ConduitT i o m (Either e r) #

Run ExceptT in the base monad

Since 1.2.12

exceptC :: Monad m => ConduitT i o m (Either e a) -> ConduitT i o (ExceptT e m) a #

Wrap the base monad in ExceptT

Since 1.2.12

runConduitRes :: MonadUnliftIO m => ConduitT () Void (ResourceT m) r -> m r #

Run a pipeline which acquires resources with ResourceT, and then run the ResourceT transformer. This is equivalent to runResourceT . runConduit.

Since: conduit-1.2.8

runConduitPure :: ConduitT () Void Identity r -> r #

Run a pure pipeline until processing completes, i.e. a pipeline with Identity as the base monad. This is equivalient to runIdentity . runConduit.

Since: conduit-1.2.8

fuseUpstream :: Monad m => ConduitT a b m r -> Conduit b m c -> ConduitT a c m r #

Same as fuseBoth, but ignore the return value from the downstream Conduit. Same caveats of forced consumption apply.

Since 1.1.5

fuseBothMaybe :: Monad m => ConduitT a b m r1 -> ConduitT b c m r2 -> ConduitT a c m (Maybe r1, r2) #

Like fuseBoth, but does not force consumption of the Producer. In the case that the Producer terminates, the result value is provided as a Just value. If it does not terminate, then a Nothing value is returned.

One thing to note here is that "termination" here only occurs if the Producer actually yields a Nothing value. For example, with the Producer mapM_ yield [1..5], if five values are requested, the Producer has not yet terminated. Termination only occurs when the sixth value is awaited for and the Producer signals termination.

Since 1.2.4

fuseBoth :: Monad m => ConduitT a b m r1 -> ConduitT b c m r2 -> ConduitT a c m (r1, r2) #

Fuse two ConduitTs together, and provide the return value of both. Note that this will force the entire upstream ConduitT to be run to produce the result value, even if the downstream terminates early.

Since 1.1.5

sequenceConduits :: (Traversable f, Monad m) => f (ConduitT i o m r) -> ConduitT i o m (f r) #

Provide identical input to all of the Conduits and combine their outputs into a single stream.

Implemented on top of ZipConduit, see that data type for more details.

Since 1.0.17

(=$$+-) :: Monad m => SealedConduitT i o m () -> ConduitT o Void m r -> ConduitT i Void m r infixr 0 #

Same as =$$++, but doesn't include the updated SealedConduitT.

NOTE In previous versions, this would cause finalizers to run. Since version 1.3.0, there are no finalizers in conduit.

Since 1.0.17

(=$$++) :: Monad m => SealedConduitT i o m () -> ConduitT o Void m r -> ConduitT i Void m (SealedConduitT i o m (), r) infixr 0 #

Continue processing after usage of =$$+. Connect a SealedConduitT to a sink and return the output of the sink together with a new SealedConduitT.

Since 1.0.17

(=$$+) :: Monad m => ConduitT a b m () -> ConduitT b Void m r -> ConduitT a Void m (SealedConduitT a b m (), r) infixr 0 #

The connect-and-resume operator. This does not close the Conduit, but instead returns it to be used again. This allows a Conduit to be used incrementally in a large program, without forcing the entire program to live in the Sink monad.

Leftover data returned from the Sink will be discarded.

Mnemonic: connect + do more.

Since 1.0.17

sequenceSinks :: (Traversable f, Monad m) => f (Sink i m r) -> Sink i m (f r) #

Send incoming values to all of the Sink providing, and ultimately coalesce together all return values.

Implemented on top of ZipSink, see that data type for more details.

Since 1.0.13

sequenceSources :: (Traversable f, Monad m) => f (Source m o) -> Source m (f o) #

Coalesce all values yielded by all of the Sources.

Implemented on top of ZipSource and as such, it exhibits the same short-circuiting behavior as ZipSource. See that data type for more details. If you want to create a source that yields *all* values from multiple sources, use sequence_.

Since 1.0.13

($=+) :: Monad m => SealedConduitT () a m () -> Conduit a m b -> SealedConduitT () b m () infixl 1 #

Left fusion for a sealed source.

Since 1.0.16

($$+-) :: Monad m => SealedConduitT () a m () -> Sink a m b -> m b infixr 0 #

Same as $$++ and connectResume, but doesn't include the updated SealedConduitT.

NOTE In previous versions, this would cause finalizers to run. Since version 1.3.0, there are no finalizers in conduit.

Since 0.5.0

($$++) :: Monad m => SealedConduitT () a m () -> Sink a m b -> m (SealedConduitT () a m (), b) infixr 0 #

Continue processing after usage of $$+.

Since 0.5.0

($$+) :: Monad m => Source m a -> Sink a m b -> m (SealedConduitT () a m (), b) infixr 0 #

The connect-and-resume operator. This does not close the Source, but instead returns it to be used again. This allows a Source to be used incrementally in a large program, without forcing the entire program to live in the Sink monad.

Mnemonic: connect + do more.

Since 0.5.0

mapInput #

Arguments

:: Monad m 
=> (i1 -> i2)

map initial input to new input

-> (i2 -> Maybe i1)

map new leftovers to initial leftovers

-> ConduitT i2 o m r 
-> ConduitT i1 o m r 

Apply a function to all the input values of a ConduitT.

Since 0.5.0

mapOutputMaybe :: Monad m => (o1 -> Maybe o2) -> ConduitT i o1 m r -> ConduitT i o2 m r #

Same as mapOutput, but use a function that returns Maybe values.

Since 0.5.0

mapOutput :: Monad m => (o1 -> o2) -> ConduitT i o1 m r -> ConduitT i o2 m r #

Apply a function to all the output values of a ConduitT.

This mimics the behavior of fmap for a Source and Conduit in pre-0.4 days. It can also be simulated by fusing with the map conduit from Data.Conduit.List.

Since 0.4.1

transPipe :: Monad m => (forall a. m a -> n a) -> ConduitT i o m r -> ConduitT i o n r #

Transform the monad that a ConduitT lives in.

Note that the monad transforming function will be run multiple times, resulting in unintuitive behavior in some cases. For a fuller treatment, please see:

https://github.com/snoyberg/conduit/wiki/Dealing-with-monad-transformers

Since 0.4.0

awaitForever :: Monad m => (i -> ConduitT i o m r) -> ConduitT i o m () #

Wait for input forever, calling the given inner component for each piece of new input.

This function is provided as a convenience for the common pattern of awaiting input, checking if it's Just and then looping.

Since 0.5.0

bracketP #

Arguments

:: MonadResource m 
=> IO a

computation to run first ("acquire resource")

-> (a -> IO ())

computation to run last ("release resource")

-> (a -> ConduitT i o m r)

computation to run in-between

-> ConduitT i o m r 

Bracket a conduit computation between allocation and release of a resource. Two guarantees are given about resource finalization:

  1. It will be prompt. The finalization will be run as early as possible.
  2. It is exception safe. Due to usage of resourcet, the finalization will be run in the event of any exceptions.

Since 0.5.0

runConduit :: Monad m => ConduitT () Void m r -> m r #

Run a pipeline until processing completes.

Since 1.2.1

leftover :: i -> ConduitT i o m () #

Provide a single piece of leftover input to be consumed by the next component in the current monadic binding.

Note: it is highly encouraged to only return leftover values from input already consumed from upstream.

Since: conduit-0.5.0

yieldM :: Monad m => m o -> ConduitT i o m () #

Send a monadic value downstream for the next component to consume.

Since: conduit-1.2.7

yield #

Arguments

:: Monad m 
=> o

output value

-> ConduitT i o m () 

Send a value downstream to the next component to consume. If the downstream component terminates, this call will never return control.

Since 0.5.0

await :: Monad m => Consumer i m (Maybe i) #

Wait for a single input value from upstream. If no data is available, returns Nothing. Once await returns Nothing, subsequent calls will also return Nothing.

Since 0.5.0

(=$=) :: Monad m => Conduit a m b -> ConduitT b c m r -> ConduitT a c m r infixr 2 #

Deprecated fusion operator.

Since 0.4.0

(=$) :: Monad m => Conduit a m b -> ConduitT b c m r -> ConduitT a c m r infixr 2 #

A synonym for =$= for backwards compatibility.

Since 0.4.0

($=) :: Monad m => Conduit a m b -> ConduitT b c m r -> ConduitT a c m r infixl 1 #

A synonym for =$= for backwards compatibility.

Since 0.4.0

($$) :: Monad m => Source m a -> Sink a m b -> m b infixr 0 #

The connect operator, which pulls data from a source and pushes to a sink. If you would like to keep the Source open to be used for other operations, use the connect-and-resume operator $$+.

Since 0.4.0

(.|) infixr 2 #

Arguments

:: Monad m 
=> ConduitM a b m ()

upstream

-> ConduitM b c m r

downstream

-> ConduitM a c m r 

Combine two Conduits together into a new Conduit (aka fuse).

Output from the upstream (left) conduit will be fed into the downstream (right) conduit. Processing will terminate when downstream (right) returns. Leftover data returned from the right Conduit will be discarded.

Equivalent to fuse and =$=, however the latter is deprecated and will be removed in a future version.

Note that, while this operator looks like categorical composition (from Control.Category), there are a few reasons it's different:

  • The position of the type parameters to ConduitT do not match. We would need to change ConduitT i o m r to ConduitT r m i o, which would preclude a Monad or MonadTrans instance.
  • The result value from upstream and downstream are allowed to differ between upstream and downstream. In other words, we would need the type signature here to look like ConduitT a b m r -> ConduitT b c m r -> ConduitT a c m r.
  • Due to leftovers, we do not have a left identity in Conduit. This can be achieved with the underlying Pipe datatype, but this is not generally recommended. See https://stackoverflow.com/a/15263700.

Since: conduit-1.2.8

fuse :: Monad m => Conduit a m b -> ConduitM b c m r -> ConduitM a c m r #

Named function synonym for .|

Equivalent to .| and =$=. However, the latter is deprecated and will be removed in a future version.

Since 1.2.3

connect :: Monad m => ConduitT () a m () -> ConduitT a Void m r -> m r #

Equivalent to using runConduit and .| together.

Since 1.2.3

sourceToList :: Monad m => Source m a -> m [a] #

Convert a Source into a list. The basic functionality can be explained as:

sourceToList src = src $$ Data.Conduit.List.consume

However, sourceToList is able to produce its results lazily, which cannot be done when running a conduit pipeline in general. Unlike the Data.Conduit.Lazy module (in conduit-extra), this function performs no unsafe I/O operations, and therefore can only be as lazily as the underlying monad.

Since 1.2.6

passthroughSink #

Arguments

:: Monad m 
=> Sink i m r 
-> (r -> m ())

finalizer

-> Conduit i m i 

Turn a Sink into a Conduit in the following way:

  • All input passed to the Sink is yielded downstream.
  • When the Sink finishes processing, the result is passed to the provided to the finalizer function.

Note that the Sink will stop receiving input as soon as the downstream it is connected to shuts down.

An example usage would be to write the result of a Sink to some mutable variable while allowing other processing to continue.

Since 1.1.0

mergeSource :: Monad m => Source m i -> Conduit a m (i, a) #

Merge a Source into a Conduit. The new conduit will stop processing once either source or upstream have been exhausted.

fuseLeftovers :: Monad m => ([b] -> [a]) -> ConduitT a b m () -> ConduitT b c m r -> ConduitT a c m r #

Similar to fuseReturnLeftovers, but use the provided function to convert downstream leftovers to upstream leftovers.

Since 1.0.17

fuseReturnLeftovers :: Monad m => ConduitT a b m () -> ConduitT b c m r -> ConduitT a c m (r, [b]) #

Same as normal fusion (e.g. =$=), except instead of discarding leftovers from the downstream component, return them.

Since 1.0.17

tryC :: (MonadUnliftIO m, Exception e) => ConduitT i o m r -> ConduitT i o m (Either e r) #

A version of try for use within a pipeline. See the comments in catchC for more details.

Since 1.0.11

handleC :: (MonadUnliftIO m, Exception e) => (e -> ConduitT i o m r) -> ConduitT i o m r -> ConduitT i o m r #

The same as flip catchC.

Since 1.0.11

catchC :: (MonadUnliftIO m, Exception e) => ConduitT i o m r -> (e -> ConduitT i o m r) -> ConduitT i o m r #

Catch all exceptions thrown by the current component of the pipeline.

Note: this will not catch exceptions thrown by other components! For example, if an exception is thrown in a Source feeding to a Sink, and the Sink uses catchC, the exception will not be caught.

Due to this behavior (as well as lack of async exception safety), you should not try to implement combinators such as onException in terms of this primitive function.

Note also that the exception handling will not be applied to any finalizers generated by this conduit.

Since 1.0.11

toConsumer :: Monad m => Sink a m b -> Consumer a m b #

Generalize a Sink to a Consumer.

Since 1.0.0

toProducer :: Monad m => Source m a -> Producer m a #

Generalize a Source to a Producer.

Since 1.0.0

unsealConduitT :: Monad m => SealedConduitT i o m r -> ConduitT i o m r #

sealConduitT :: ConduitT i o m r -> SealedConduitT i o m r #

data ConduitT i o (m :: * -> *) r #

Core datatype of the conduit package. This type represents a general component which can consume a stream of input values i, produce a stream of output values o, perform actions in the m monad, and produce a final result r. The type synonyms provided here are simply wrappers around this type.

Since 1.3.0

Instances
MonadRWS r w s m => MonadRWS r w s (ConduitT i o m) 
Instance details

Defined in Data.Conduit.Internal.Conduit

MonadReader r m => MonadReader r (ConduitT i o m) 
Instance details

Defined in Data.Conduit.Internal.Conduit

Methods

ask :: ConduitT i o m r #

local :: (r -> r) -> ConduitT i o m a -> ConduitT i o m a #

reader :: (r -> a) -> ConduitT i o m a #

MonadState s m => MonadState s (ConduitT i o m) 
Instance details

Defined in Data.Conduit.Internal.Conduit

Methods

get :: ConduitT i o m s #

put :: s -> ConduitT i o m () #

state :: (s -> (a, s)) -> ConduitT i o m a #

MonadWriter w m => MonadWriter w (ConduitT i o m) 
Instance details

Defined in Data.Conduit.Internal.Conduit

Methods

writer :: (a, w) -> ConduitT i o m a #

tell :: w -> ConduitT i o m () #

listen :: ConduitT i o m a -> ConduitT i o m (a, w) #

pass :: ConduitT i o m (a, w -> w) -> ConduitT i o m a #

MonadError e m => MonadError e (ConduitT i o m) 
Instance details

Defined in Data.Conduit.Internal.Conduit

Methods

throwError :: e -> ConduitT i o m a #

catchError :: ConduitT i o m a -> (e -> ConduitT i o m a) -> ConduitT i o m a #

MonadTrans (ConduitT i o) 
Instance details

Defined in Data.Conduit.Internal.Conduit

Methods

lift :: Monad m => m a -> ConduitT i o m a #

Monad (ConduitT i o m) 
Instance details

Defined in Data.Conduit.Internal.Conduit

Methods

(>>=) :: ConduitT i o m a -> (a -> ConduitT i o m b) -> ConduitT i o m b #

(>>) :: ConduitT i o m a -> ConduitT i o m b -> ConduitT i o m b #

return :: a -> ConduitT i o m a #

fail :: String -> ConduitT i o m a #

Functor (ConduitT i o m) 
Instance details

Defined in Data.Conduit.Internal.Conduit

Methods

fmap :: (a -> b) -> ConduitT i o m a -> ConduitT i o m b #

(<$) :: a -> ConduitT i o m b -> ConduitT i o m a #

MonadFail m => MonadFail (ConduitT i o m)

Since: conduit-1.3.1

Instance details

Defined in Data.Conduit.Internal.Conduit

Methods

fail :: String -> ConduitT i o m a #

Applicative (ConduitT i o m) 
Instance details

Defined in Data.Conduit.Internal.Conduit

Methods

pure :: a -> ConduitT i o m a #

(<*>) :: ConduitT i o m (a -> b) -> ConduitT i o m a -> ConduitT i o m b #

liftA2 :: (a -> b -> c) -> ConduitT i o m a -> ConduitT i o m b -> ConduitT i o m c #

(*>) :: ConduitT i o m a -> ConduitT i o m b -> ConduitT i o m b #

(<*) :: ConduitT i o m a -> ConduitT i o m b -> ConduitT i o m a #

MonadIO m => MonadIO (ConduitT i o m) 
Instance details

Defined in Data.Conduit.Internal.Conduit

Methods

liftIO :: IO a -> ConduitT i o m a #

PrimMonad m => PrimMonad (ConduitT i o m) 
Instance details

Defined in Data.Conduit.Internal.Conduit

Associated Types

type PrimState (ConduitT i o m) :: * #

Methods

primitive :: (State# (PrimState (ConduitT i o m)) -> (#State# (PrimState (ConduitT i o m)), a#)) -> ConduitT i o m a #

MonadResource m => MonadResource (ConduitT i o m) 
Instance details

Defined in Data.Conduit.Internal.Conduit

Methods

liftResourceT :: ResourceT IO a -> ConduitT i o m a #

MonadThrow m => MonadThrow (ConduitT i o m) 
Instance details

Defined in Data.Conduit.Internal.Conduit

Methods

throwM :: Exception e => e -> ConduitT i o m a #

Monad m => Semigroup (ConduitT i o m ()) 
Instance details

Defined in Data.Conduit.Internal.Conduit

Methods

(<>) :: ConduitT i o m () -> ConduitT i o m () -> ConduitT i o m () #

sconcat :: NonEmpty (ConduitT i o m ()) -> ConduitT i o m () #

stimes :: Integral b => b -> ConduitT i o m () -> ConduitT i o m () #

Monad m => Monoid (ConduitT i o m ()) 
Instance details

Defined in Data.Conduit.Internal.Conduit

Methods

mempty :: ConduitT i o m () #

mappend :: ConduitT i o m () -> ConduitT i o m () -> ConduitT i o m () #

mconcat :: [ConduitT i o m ()] -> ConduitT i o m () #

type PrimState (ConduitT i o m) 
Instance details

Defined in Data.Conduit.Internal.Conduit

type PrimState (ConduitT i o m) = PrimState m

data SealedConduitT i o (m :: * -> *) r #

In order to provide for efficient monadic composition, the ConduitT type is implemented internally using a technique known as the codensity transform. This allows for cheap appending, but makes one case much more expensive: partially running a ConduitT and that capturing the new state.

This data type is the same as ConduitT, but does not use the codensity transform technique.

Since: conduit-1.3.0

type ConduitM = ConduitT #

Same as ConduitT, for backwards compat

type Source (m :: * -> *) o = ConduitT () o m () #

Provides a stream of output values, without consuming any input or producing a final result.

Since 0.5.0

type Producer (m :: * -> *) o = forall i. ConduitT i o m () #

A component which produces a stream of output values, regardless of the input stream. A Producer is a generalization of a Source, and can be used as either a Source or a Conduit.

Since 1.0.0

type Sink i = ConduitT i Void #

Consumes a stream of input values and produces a final result, without producing any output.

type Sink i m r = ConduitT i Void m r

Since 0.5.0

type Consumer i (m :: * -> *) r = forall o. ConduitT i o m r #

A component which consumes a stream of input values and produces a final result, regardless of the output stream. A Consumer is a generalization of a Sink, and can be used as either a Sink or a Conduit.

Since 1.0.0

type Conduit i (m :: * -> *) o = ConduitT i o m () #

Consumes a stream of input values and produces a stream of output values, without producing a final result.

Since 0.5.0

data Flush a #

Provide for a stream of data that can be flushed.

A number of Conduits (e.g., zlib compression) need the ability to flush the stream at some point. This provides a single wrapper datatype to be used in all such circumstances.

Since 0.3.0

Constructors

Chunk a 
Flush 
Instances
Functor Flush 
Instance details

Defined in Data.Conduit.Internal.Conduit

Methods

fmap :: (a -> b) -> Flush a -> Flush b #

(<$) :: a -> Flush b -> Flush a #

Eq a => Eq (Flush a) 
Instance details

Defined in Data.Conduit.Internal.Conduit

Methods

(==) :: Flush a -> Flush a -> Bool #

(/=) :: Flush a -> Flush a -> Bool #

Ord a => Ord (Flush a) 
Instance details

Defined in Data.Conduit.Internal.Conduit

Methods

compare :: Flush a -> Flush a -> Ordering #

(<) :: Flush a -> Flush a -> Bool #

(<=) :: Flush a -> Flush a -> Bool #

(>) :: Flush a -> Flush a -> Bool #

(>=) :: Flush a -> Flush a -> Bool #

max :: Flush a -> Flush a -> Flush a #

min :: Flush a -> Flush a -> Flush a #

Show a => Show (Flush a) 
Instance details

Defined in Data.Conduit.Internal.Conduit

Methods

showsPrec :: Int -> Flush a -> ShowS #

show :: Flush a -> String #

showList :: [Flush a] -> ShowS #

newtype ZipSource (m :: * -> *) o #

A wrapper for defining an Applicative instance for Sources which allows to combine sources together, generalizing zipSources. A combined source will take input yielded from each of its Sources until any of them stop producing output.

Since 1.0.13

Constructors

ZipSource 

Fields

Instances
Monad m => Functor (ZipSource m) 
Instance details

Defined in Data.Conduit.Internal.Conduit

Methods

fmap :: (a -> b) -> ZipSource m a -> ZipSource m b #

(<$) :: a -> ZipSource m b -> ZipSource m a #

Monad m => Applicative (ZipSource m) 
Instance details

Defined in Data.Conduit.Internal.Conduit

Methods

pure :: a -> ZipSource m a #

(<*>) :: ZipSource m (a -> b) -> ZipSource m a -> ZipSource m b #

liftA2 :: (a -> b -> c) -> ZipSource m a -> ZipSource m b -> ZipSource m c #

(*>) :: ZipSource m a -> ZipSource m b -> ZipSource m b #

(<*) :: ZipSource m a -> ZipSource m b -> ZipSource m a #

newtype ZipSink i (m :: * -> *) r #

A wrapper for defining an Applicative instance for Sinks which allows to combine sinks together, generalizing zipSinks. A combined sink distributes the input to all its participants and when all finish, produces the result. This allows to define functions like

sequenceSinks :: (Monad m)
          => [Sink i m r] -> Sink i m [r]
sequenceSinks = getZipSink . sequenceA . fmap ZipSink

Note that the standard Applicative instance for conduits works differently. It feeds one sink with input until it finishes, then switches to another, etc., and at the end combines their results.

This newtype is in fact a type constrained version of ZipConduit, and has the same behavior. It's presented as a separate type since (1) it historically predates ZipConduit, and (2) the type constraining can make your code clearer (and thereby make your error messages more easily understood).

Since 1.0.13

Constructors

ZipSink 

Fields

Instances
Monad m => Functor (ZipSink i m) 
Instance details

Defined in Data.Conduit.Internal.Conduit

Methods

fmap :: (a -> b) -> ZipSink i m a -> ZipSink i m b #

(<$) :: a -> ZipSink i m b -> ZipSink i m a #

Monad m => Applicative (ZipSink i m) 
Instance details

Defined in Data.Conduit.Internal.Conduit

Methods

pure :: a -> ZipSink i m a #

(<*>) :: ZipSink i m (a -> b) -> ZipSink i m a -> ZipSink i m b #

liftA2 :: (a -> b -> c) -> ZipSink i m a -> ZipSink i m b -> ZipSink i m c #

(*>) :: ZipSink i m a -> ZipSink i m b -> ZipSink i m b #

(<*) :: ZipSink i m a -> ZipSink i m b -> ZipSink i m a #

newtype ZipConduit i o (m :: * -> *) r #

Provides an alternative Applicative instance for ConduitT. In this instance, every incoming value is provided to all ConduitTs, and output is coalesced together. Leftovers from individual ConduitTs will be used within that component, and then discarded at the end of their computation. Output and finalizers will both be handled in a left-biased manner.

As an example, take the following program:

main :: IO ()
main = do
    let src = mapM_ yield [1..3 :: Int]
        conduit1 = CL.map (+1)
        conduit2 = CL.concatMap (replicate 2)
        conduit = getZipConduit $ ZipConduit conduit1 <* ZipConduit conduit2
        sink = CL.mapM_ print
    src $$ conduit =$ sink

It will produce the output: 2, 1, 1, 3, 2, 2, 4, 3, 3

Since 1.0.17

Constructors

ZipConduit 

Fields

Instances
Functor (ZipConduit i o m) 
Instance details

Defined in Data.Conduit.Internal.Conduit

Methods

fmap :: (a -> b) -> ZipConduit i o m a -> ZipConduit i o m b #

(<$) :: a -> ZipConduit i o m b -> ZipConduit i o m a #

Monad m => Applicative (ZipConduit i o m) 
Instance details

Defined in Data.Conduit.Internal.Conduit

Methods

pure :: a -> ZipConduit i o m a #

(<*>) :: ZipConduit i o m (a -> b) -> ZipConduit i o m a -> ZipConduit i o m b #

liftA2 :: (a -> b -> c) -> ZipConduit i o m a -> ZipConduit i o m b -> ZipConduit i o m c #

(*>) :: ZipConduit i o m a -> ZipConduit i o m b -> ZipConduit i o m b #

(<*) :: ZipConduit i o m a -> ZipConduit i o m b -> ZipConduit i o m a #

data Acquire a #

A method for acquiring a scarce resource, providing the means of freeing it when no longer needed. This data type provides Functor/Applicative/Monad instances for composing different resources together. You can allocate these resources using either the bracket pattern (via with) or using ResourceT (via allocateAcquire).

This concept was originally introduced by Gabriel Gonzalez and described at: http://www.haskellforall.com/2013/06/the-resource-applicative.html. The implementation in this package is slightly different, due to taking a different approach to async exception safety.

Since: resourcet-1.1.0

Instances
Monad Acquire 
Instance details

Defined in Data.Acquire.Internal

Methods

(>>=) :: Acquire a -> (a -> Acquire b) -> Acquire b #

(>>) :: Acquire a -> Acquire b -> Acquire b #

return :: a -> Acquire a #

fail :: String -> Acquire a #

Functor Acquire 
Instance details

Defined in Data.Acquire.Internal

Methods

fmap :: (a -> b) -> Acquire a -> Acquire b #

(<$) :: a -> Acquire b -> Acquire a #

Applicative Acquire 
Instance details

Defined in Data.Acquire.Internal

Methods

pure :: a -> Acquire a #

(<*>) :: Acquire (a -> b) -> Acquire a -> Acquire b #

liftA2 :: (a -> b -> c) -> Acquire a -> Acquire b -> Acquire c #

(*>) :: Acquire a -> Acquire b -> Acquire b #

(<*) :: Acquire a -> Acquire b -> Acquire a #

MonadIO Acquire 
Instance details

Defined in Data.Acquire.Internal

Methods

liftIO :: IO a -> Acquire a #

data ReleaseType #

The way in which a release is called.

Since: resourcet-1.1.2

Instances
Bounded ReleaseType 
Instance details

Defined in Data.Acquire.Internal

Enum ReleaseType 
Instance details

Defined in Data.Acquire.Internal

Eq ReleaseType 
Instance details

Defined in Data.Acquire.Internal

Ord ReleaseType 
Instance details

Defined in Data.Acquire.Internal

Read ReleaseType 
Instance details

Defined in Data.Acquire.Internal

Show ReleaseType 
Instance details

Defined in Data.Acquire.Internal

mkAcquire #

Arguments

:: IO a

acquire the resource

-> (a -> IO ())

free the resource

-> Acquire a 

Create an Acquire value using the given allocate and free functions.

Since: resourcet-1.1.0

mkAcquireType #

Arguments

:: IO a

acquire the resource

-> (a -> ReleaseType -> IO ())

free the resource

-> Acquire a 

Same as mkAcquire, but the cleanup function will be informed of how cleanup was initiated. This allows you to distinguish, for example, between normal and exceptional exits.

Since: resourcet-1.1.2

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
MonadTrans ResourceT 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

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

MonadRWS r w s m => MonadRWS r w s (ResourceT m) 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

MonadReader r m => MonadReader r (ResourceT m) 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

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) 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

get :: ResourceT m s #

put :: s -> ResourceT m () #

state :: (s -> (a, s)) -> ResourceT m a #

MonadWriter w m => MonadWriter w (ResourceT m) 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

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 #

MonadError e m => MonadError e (ResourceT m) 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

throwError :: e -> ResourceT m a #

catchError :: ResourceT m a -> (e -> ResourceT m a) -> ResourceT m a #

Monad m => Monad (ResourceT m) 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

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) 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

fmap :: (a -> b) -> ResourceT m a -> ResourceT m b #

(<$) :: a -> ResourceT m b -> ResourceT m a #

MonadFix m => MonadFix (ResourceT m)

Since: resourcet-1.1.8

Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

mfix :: (a -> ResourceT m a) -> ResourceT m a #

MonadFail m => MonadFail (ResourceT m)

Since: resourcet-1.2.2

Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

fail :: String -> ResourceT m a #

Applicative m => Applicative (ResourceT m) 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

pure :: a -> ResourceT m a #

(<*>) :: ResourceT m (a -> b) -> ResourceT m a -> ResourceT m b #

liftA2 :: (a -> b -> c) -> ResourceT m a -> ResourceT m b -> ResourceT m c #

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

(<*) :: ResourceT m a -> ResourceT m b -> ResourceT m a #

MonadIO m => MonadIO (ResourceT m) 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

liftIO :: IO a -> ResourceT m a #

Alternative m => Alternative (ResourceT m)

Since 1.1.5

Instance details

Defined in Control.Monad.Trans.Resource.Internal

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

Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

mzero :: ResourceT m a #

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

MonadUnliftIO m => MonadUnliftIO (ResourceT m)

Since: resourcet-1.1.10

Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

askUnliftIO :: ResourceT m (UnliftIO (ResourceT m)) #

withRunInIO :: ((forall a. ResourceT m a -> IO a) -> IO b) -> ResourceT m b #

PrimMonad m => PrimMonad (ResourceT m) 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

Associated Types

type PrimState (ResourceT m) :: * #

Methods

primitive :: (State# (PrimState (ResourceT m)) -> (#State# (PrimState (ResourceT m)), a#)) -> ResourceT m a #

MonadIO m => MonadResource (ResourceT m) 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

liftResourceT :: ResourceT IO a -> ResourceT m a #

MonadThrow m => MonadThrow (ResourceT m) 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

throwM :: Exception e => e -> ResourceT m a #

MonadCatch m => MonadCatch (ResourceT m) 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

catch :: Exception e => ResourceT m a -> (e -> ResourceT m a) -> ResourceT m a #

MonadMask m => MonadMask (ResourceT m) 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

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 #

generalBracket :: ResourceT m a -> (a -> ExitCase b -> ResourceT m c) -> (a -> ResourceT m b) -> ResourceT m (b, c) #

MonadCont m => MonadCont (ResourceT m) 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

callCC :: ((a -> ResourceT m b) -> ResourceT m a) -> ResourceT m a #

type PrimState (ResourceT m) 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

class MonadIO 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 MonadUnliftIO 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) 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

liftResourceT :: ResourceT IO a -> MaybeT m a #

MonadIO m => MonadResource (ResourceT m) 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

liftResourceT :: ResourceT IO a -> ResourceT m a #

MonadResource m => MonadResource (ListT m) 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

liftResourceT :: ResourceT IO a -> ListT m a #

MonadResource m => MonadResource (IdentityT m) 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

liftResourceT :: ResourceT IO a -> IdentityT m a #

(Monoid w, MonadResource m) => MonadResource (WriterT w m) 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

liftResourceT :: ResourceT IO a -> WriterT w m a #

(Monoid w, MonadResource m) => MonadResource (WriterT w m) 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

liftResourceT :: ResourceT IO a -> WriterT w m a #

MonadResource m => MonadResource (StateT s m) 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

liftResourceT :: ResourceT IO a -> StateT s m a #

MonadResource m => MonadResource (StateT s m) 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

liftResourceT :: ResourceT IO a -> StateT s m a #

MonadResource m => MonadResource (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

liftResourceT :: ResourceT IO a -> ExceptT e m a #

MonadResource m => MonadResource (ReaderT r m) 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

liftResourceT :: ResourceT IO a -> ReaderT r m a #

MonadResource m => MonadResource (ConduitT i o m) 
Instance details

Defined in Data.Conduit.Internal.Conduit

Methods

liftResourceT :: ResourceT IO a -> ConduitT i o m a #

MonadResource m => MonadResource (ContT r m) 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

liftResourceT :: ResourceT IO a -> ContT r m a #

(Monoid w, MonadResource m) => MonadResource (RWST r w s m) 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

liftResourceT :: ResourceT IO a -> RWST r w s m a #

(Monoid w, MonadResource m) => MonadResource (RWST r w s m) 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

liftResourceT :: ResourceT IO a -> RWST r w s m a #

MonadResource m => MonadResource (Pipe l i o u m) 
Instance details

Defined in Data.Conduit.Internal.Pipe

Methods

liftResourceT :: ResourceT IO a -> Pipe l i o u m a #

allocateAcquire :: MonadResource m => Acquire a -> m (ReleaseKey, a) #

Allocate a resource and register an action with the MonadResource to free the resource.

Since: resourcet-1.1.0

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

Longer name for with, in case with is not obvious enough in context.

Since: resourcet-1.2.0

runResourceT :: MonadUnliftIO 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.

NOTE Since version 1.2.0, this function will throw a ResourceCleanupException if any of the cleanup functions throw an exception.

Since: resourcet-0.3.0

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

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

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 CatchT 
Instance details

Defined in Control.Monad.Catch.Pure

Methods

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

MonadTrans ResourceT 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

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

MonadTrans Free

This is not a true monad transformer. It is only a monad transformer "up to retract".

Instance details

Defined in Control.Monad.Free

Methods

lift :: Monad m => m a -> Free 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 #

Monoid w => MonadTrans (WriterT w) 
Instance details

Defined in Control.Monad.Trans.Writer.Lazy

Methods

lift :: Monad m => m a -> WriterT w m a #

MonadTrans (StateT s) 
Instance details

Defined in Control.Monad.Trans.State.Strict

Methods

lift :: Monad m => m a -> StateT s 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 (ExceptT e) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

lift :: Monad m => m a -> ExceptT e m a #

MonadTrans (FreeT f) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

lift :: Monad m => m a -> FreeT f m a #

MonadTrans (ErrorT e) 
Instance details

Defined in Control.Monad.Trans.Error

Methods

lift :: Monad m => m a -> ErrorT e m a #

MonadTrans (ReaderT r :: (* -> *) -> * -> *) 
Instance details

Defined in Control.Monad.Trans.Reader

Methods

lift :: Monad m => m a -> ReaderT r m a #

MonadTrans (ConduitT i o) 
Instance details

Defined in Data.Conduit.Internal.Conduit

Methods

lift :: Monad m => m a -> ConduitT i o 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 #

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 #

MonadTrans (Pipe l i o u) 
Instance details

Defined in Data.Conduit.Internal.Pipe

Methods

lift :: Monad m => m a -> Pipe l i o u m a #

class Monad m => MonadThrow (m :: * -> *) #

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.

Minimal complete definition

throwM

Instances
MonadThrow [] 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> [a] #

MonadThrow Maybe 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> Maybe a #

MonadThrow IO 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> IO a #

MonadThrow Q 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> Q a #

MonadThrow STM 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> STM a #

e ~ SomeException => MonadThrow (Either e) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e0 => e0 -> Either e a #

MonadThrow m => MonadThrow (MaybeT m)

Throws exceptions into the base monad.

Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> MaybeT m a #

Monad m => MonadThrow (CatchT m) 
Instance details

Defined in Control.Monad.Catch.Pure

Methods

throwM :: Exception e => e -> CatchT m a #

MonadThrow m => MonadThrow (ResourceT m) 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

throwM :: Exception e => e -> ResourceT m a #

MonadThrow m => MonadThrow (ListT m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> ListT m a #

MonadThrow m => MonadThrow (IdentityT m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> IdentityT m a #

(MonadThrow m, Monoid w) => MonadThrow (WriterT w m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> WriterT w m a #

(MonadThrow m, Monoid w) => MonadThrow (WriterT w m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> WriterT w m a #

MonadThrow m => MonadThrow (StateT s m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> StateT s m a #

MonadThrow m => MonadThrow (StateT s m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> StateT s m a #

MonadThrow m => MonadThrow (ExceptT e m)

Throws exceptions into the base monad.

Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e0 => e0 -> ExceptT e m a #

(Functor f, MonadThrow m) => MonadThrow (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

throwM :: Exception e => e -> FreeT f m a #

(Error e, MonadThrow m) => MonadThrow (ErrorT e m)

Throws exceptions into the base monad.

Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e0 => e0 -> ErrorT e m a #

MonadThrow m => MonadThrow (ReaderT r m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> ReaderT r m a #

MonadThrow m => MonadThrow (ConduitT i o m) 
Instance details

Defined in Data.Conduit.Internal.Conduit

Methods

throwM :: Exception e => e -> ConduitT i o m a #

MonadThrow m => MonadThrow (ContT r m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> ContT r m a #

(MonadThrow m, Monoid w) => MonadThrow (RWST r w s m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> RWST r w s m a #

(MonadThrow m, Monoid w) => MonadThrow (RWST r w s m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> RWST r w s m a #

MonadThrow m => MonadThrow (Pipe l i o u m) 
Instance details

Defined in Data.Conduit.Internal.Pipe

Methods

throwM :: Exception e => e -> Pipe l i o u m a #