| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
ClassyPrelude.Conduit
Contents
Synopsis
- module ClassyPrelude
- class Monad m => PrimMonad (m :: Type -> Type) where
- type Conduit i (m :: Type -> Type) o = ConduitT i o m ()
- data Void
- class (forall (m :: Type -> Type). Monad m => Monad (t m)) => MonadTrans (t :: (Type -> Type) -> Type -> Type) where
- class Monad m => MonadIO (m :: Type -> Type) where
- yield :: forall (m :: Type -> Type) o i. Monad m => o -> ConduitT i o m ()
- newtype Identity a = Identity {
- runIdentity :: a
- sourceFile :: forall (m :: Type -> Type) i. MonadResource m => FilePath -> ConduitT i ByteString m ()
- data Flush a
- class MonadIO m => MonadUnliftIO (m :: Type -> Type) where
- withRunInIO :: ((forall a. m a -> IO a) -> IO b) -> m b
- type family PrimState (m :: Type -> Type)
- class Monad m => MonadThrow (m :: Type -> Type)
- runResourceT :: MonadUnliftIO m => ResourceT m a -> m a
- class MonadIO m => MonadResource (m :: Type -> Type)
- data ResourceT (m :: Type -> Type) a
- data ReleaseType where
- await :: forall (m :: Type -> Type) i o. Monad m => ConduitT i o m (Maybe i)
- awaitForever :: forall (m :: Type -> Type) i o r. Monad m => (i -> ConduitT i o m r) -> ConduitT i o m ()
- yieldM :: Monad m => m o -> ConduitT i o m ()
- leftover :: forall i o (m :: Type -> Type). i -> ConduitT i o m ()
- bracketP :: forall (m :: Type -> Type) a i o r. MonadResource m => IO a -> (a -> IO ()) -> (a -> ConduitT i o m r) -> ConduitT i o m r
- transPipe :: Monad m => (forall a. m a -> n a) -> ConduitT i o m r -> ConduitT i o n r
- mapOutput :: forall (m :: Type -> Type) o1 o2 i r. Monad m => (o1 -> o2) -> ConduitT i o1 m r -> ConduitT i o2 m r
- mapOutputMaybe :: forall (m :: Type -> Type) o1 o2 i r. Monad m => (o1 -> Maybe o2) -> ConduitT i o1 m r -> ConduitT i o2 m r
- mapInput :: forall (m :: Type -> Type) i1 i2 o r. Monad m => (i1 -> i2) -> (i2 -> Maybe i1) -> ConduitT i2 o m r -> ConduitT i1 o m r
- newtype ZipConduit i o (m :: Type -> Type) r = ZipConduit {
- getZipConduit :: ConduitT i o m r
- newtype ZipSink i (m :: Type -> Type) r = ZipSink {
- getZipSink :: ConduitT i Void m r
- newtype ZipSource (m :: Type -> Type) o = ZipSource {
- getZipSource :: ConduitT () o m ()
- type Consumer i (m :: Type -> Type) r = forall o. ConduitT i o m r
- type Sink i = ConduitT i Void
- type Producer (m :: Type -> Type) o = forall i. ConduitT i o m ()
- type Source (m :: Type -> Type) o = ConduitT () o m ()
- type ConduitM = ConduitT
- data SealedConduitT i o (m :: Type -> Type) r
- data ConduitT i o (m :: Type -> Type) r
- sealConduitT :: forall i o (m :: Type -> Type) r. ConduitT i o m r -> SealedConduitT i o m r
- unsealConduitT :: forall (m :: Type -> Type) i o r. Monad m => SealedConduitT i o m r -> ConduitT i o m r
- toProducer :: forall (m :: Type -> Type) a i. Monad m => ConduitT () a m () -> ConduitT i a m ()
- toConsumer :: forall (m :: Type -> Type) a b o. Monad m => ConduitT a Void m b -> ConduitT a o m b
- catchC :: forall (m :: Type -> Type) e i o r. (MonadUnliftIO m, Exception e) => ConduitT i o m r -> (e -> ConduitT i o m r) -> ConduitT i o m r
- handleC :: forall (m :: Type -> Type) e i o r. (MonadUnliftIO m, Exception e) => (e -> ConduitT i o m r) -> ConduitT i o m r -> ConduitT i o m r
- tryC :: forall (m :: Type -> Type) e i o r. (MonadUnliftIO m, Exception e) => ConduitT i o m r -> ConduitT i o m (Either e r)
- fuseReturnLeftovers :: forall (m :: Type -> Type) a b c r. Monad m => ConduitT a b m () -> ConduitT b c m r -> ConduitT a c m (r, [b])
- fuseLeftovers :: forall (m :: Type -> Type) b a c r. Monad m => ([b] -> [a]) -> ConduitT a b m () -> ConduitT b c m r -> ConduitT a c m r
- mergeSource :: forall (m :: Type -> Type) i a. Monad m => ConduitT () i m () -> ConduitT a (i, a) m ()
- passthroughSink :: Monad m => ConduitT i Void m r -> (r -> m ()) -> ConduitT i i m ()
- sourceToList :: Monad m => ConduitT () a m () -> m [a]
- connect :: Monad m => ConduitT () a m () -> ConduitT a Void m r -> m r
- fuse :: forall (m :: Type -> Type) a b c r. Monad m => ConduitT a b m () -> ConduitT b c m r -> ConduitT a c m r
- (.|) :: forall (m :: Type -> Type) a b c r. Monad m => ConduitT a b m () -> ConduitT b c m r -> ConduitT a c m r
- ($$) :: Monad m => Source m a -> Sink a m b -> m b
- ($=) :: forall (m :: Type -> Type) a b c r. Monad m => Conduit a m b -> ConduitT b c m r -> ConduitT a c m r
- (=$) :: forall (m :: Type -> Type) a b c r. Monad m => Conduit a m b -> ConduitT b c m r -> ConduitT a c m r
- (=$=) :: forall (m :: Type -> Type) a b c r. Monad m => Conduit a m b -> ConduitT b c m r -> ConduitT a c m r
- runConduit :: Monad m => ConduitT () Void m r -> m r
- mapInputM :: Monad m => (i1 -> m i2) -> (i2 -> m (Maybe i1)) -> ConduitT i2 o m r -> ConduitT i1 o m r
- ($$+) :: Monad m => ConduitT () a m () -> ConduitT a Void m b -> m (SealedConduitT () a m (), b)
- ($$++) :: Monad m => SealedConduitT () a m () -> ConduitT a Void m b -> m (SealedConduitT () a m (), b)
- ($$+-) :: Monad m => SealedConduitT () a m () -> ConduitT a Void m b -> m b
- ($=+) :: forall (m :: Type -> Type) a b. Monad m => SealedConduitT () a m () -> ConduitT a b m () -> SealedConduitT () b m ()
- sequenceSources :: forall f (m :: Type -> Type) o. (Traversable f, Monad m) => f (ConduitT () o m ()) -> ConduitT () (f o) m ()
- sequenceSinks :: forall f (m :: Type -> Type) i r. (Traversable f, Monad m) => f (ConduitT i Void m r) -> ConduitT i Void m (f r)
- (=$$+) :: forall (m :: Type -> Type) a b r. Monad m => ConduitT a b m () -> ConduitT b Void m r -> ConduitT a Void m (SealedConduitT a b m (), r)
- (=$$++) :: forall (m :: Type -> Type) i o r. Monad m => SealedConduitT i o m () -> ConduitT o Void m r -> ConduitT i Void m (SealedConduitT i o m (), r)
- (=$$+-) :: forall (m :: Type -> Type) i o r. Monad m => SealedConduitT i o m () -> ConduitT o Void m r -> ConduitT i Void m r
- sequenceConduits :: forall f (m :: Type -> Type) i o r. (Traversable f, Monad m) => f (ConduitT i o m r) -> ConduitT i o m (f r)
- fuseBoth :: forall (m :: Type -> Type) a b r1 c r2. Monad m => ConduitT a b m r1 -> ConduitT b c m r2 -> ConduitT a c m (r1, r2)
- fuseBothMaybe :: forall (m :: Type -> Type) a b r1 c r2. Monad m => ConduitT a b m r1 -> ConduitT b c m r2 -> ConduitT a c m (Maybe r1, r2)
- fuseUpstream :: forall (m :: Type -> Type) a b r c. Monad m => ConduitT a b m r -> ConduitT b c m () -> ConduitT a c m r
- runConduitPure :: ConduitT () Void Identity r -> r
- runConduitRes :: MonadUnliftIO m => ConduitT () Void (ResourceT m) r -> m r
- mapAccumS :: forall (m :: Type -> Type) a s b. Monad m => (a -> s -> ConduitT b Void m s) -> s -> ConduitT () b m () -> ConduitT a Void m s
- exceptC :: forall (m :: Type -> Type) i o e a. Monad m => ConduitT i o m (Either e a) -> ConduitT i o (ExceptT e m) a
- runExceptC :: forall (m :: Type -> Type) i o e r. Monad m => ConduitT i o (ExceptT e m) r -> ConduitT i o m (Either e r)
- catchExceptC :: forall (m :: Type -> Type) i o e r. Monad m => ConduitT i o (ExceptT e m) r -> (e -> ConduitT i o (ExceptT e m) r) -> ConduitT i o (ExceptT e m) r
- runCatchC :: forall (m :: Type -> Type) i o r. Monad m => ConduitT i o (CatchT m) r -> ConduitT i o m (Either SomeException r)
- catchCatchC :: forall (m :: Type -> Type) i o r. Monad m => ConduitT i o (CatchT m) r -> (SomeException -> ConduitT i o (CatchT m) r) -> ConduitT i o (CatchT m) r
- maybeC :: forall (m :: Type -> Type) i o a. Monad m => ConduitT i o m (Maybe a) -> ConduitT i o (MaybeT m) a
- runMaybeC :: forall (m :: Type -> Type) i o r. Monad m => ConduitT i o (MaybeT m) r -> ConduitT i o m (Maybe r)
- readerC :: forall (m :: Type -> Type) r i o a. Monad m => (r -> ConduitT i o m a) -> ConduitT i o (ReaderT r m) a
- runReaderC :: forall (m :: Type -> Type) r i o res. Monad m => r -> ConduitT i o (ReaderT r m) res -> ConduitT i o m res
- stateLC :: forall (m :: Type -> Type) s i o a. Monad m => (s -> ConduitT i o m (a, s)) -> ConduitT i o (StateT s m) a
- runStateLC :: forall (m :: Type -> Type) s i o r. Monad m => s -> ConduitT i o (StateT s m) r -> ConduitT i o m (r, s)
- evalStateLC :: forall (m :: Type -> Type) s i o r. Monad m => s -> ConduitT i o (StateT s m) r -> ConduitT i o m r
- execStateLC :: forall (m :: Type -> Type) s i o r. Monad m => s -> ConduitT i o (StateT s m) r -> ConduitT i o m s
- stateC :: forall (m :: Type -> Type) s i o a. Monad m => (s -> ConduitT i o m (a, s)) -> ConduitT i o (StateT s m) a
- runStateC :: forall (m :: Type -> Type) s i o r. Monad m => s -> ConduitT i o (StateT s m) r -> ConduitT i o m (r, s)
- evalStateC :: forall (m :: Type -> Type) s i o r. Monad m => s -> ConduitT i o (StateT s m) r -> ConduitT i o m r
- execStateC :: forall (m :: Type -> Type) s i o r. Monad m => s -> ConduitT i o (StateT s m) r -> ConduitT i o m s
- writerLC :: forall (m :: Type -> Type) w i o b. (Monad m, Monoid w) => ConduitT i o m (b, w) -> ConduitT i o (WriterT w m) b
- runWriterLC :: forall (m :: Type -> Type) w i o r. (Monad m, Monoid w) => ConduitT i o (WriterT w m) r -> ConduitT i o m (r, w)
- execWriterLC :: forall (m :: Type -> Type) w i o r. (Monad m, Monoid w) => ConduitT i o (WriterT w m) r -> ConduitT i o m w
- writerC :: forall (m :: Type -> Type) w i o b. (Monad m, Monoid w) => ConduitT i o m (b, w) -> ConduitT i o (WriterT w m) b
- runWriterC :: forall (m :: Type -> Type) w i o r. (Monad m, Monoid w) => ConduitT i o (WriterT w m) r -> ConduitT i o m (r, w)
- execWriterC :: forall (m :: Type -> Type) w i o r. (Monad m, Monoid w) => ConduitT i o (WriterT w m) r -> ConduitT i o m w
- rwsLC :: forall (m :: Type -> Type) w r s i o a. (Monad m, Monoid w) => (r -> s -> ConduitT i o m (a, s, w)) -> ConduitT i o (RWST r w s m) a
- runRWSLC :: forall (m :: Type -> Type) w r s i o res. (Monad m, Monoid w) => r -> s -> ConduitT i o (RWST r w s m) res -> ConduitT i o m (res, s, w)
- evalRWSLC :: forall (m :: Type -> Type) w r s i o res. (Monad m, Monoid w) => r -> s -> ConduitT i o (RWST r w s m) res -> ConduitT i o m (res, w)
- execRWSLC :: forall (m :: Type -> Type) w r s i o res. (Monad m, Monoid w) => r -> s -> ConduitT i o (RWST r w s m) res -> ConduitT i o m (s, w)
- rwsC :: forall (m :: Type -> Type) w r s i o a. (Monad m, Monoid w) => (r -> s -> ConduitT i o m (a, s, w)) -> ConduitT i o (RWST r w s m) a
- runRWSC :: forall (m :: Type -> Type) w r s i o res. (Monad m, Monoid w) => r -> s -> ConduitT i o (RWST r w s m) res -> ConduitT i o m (res, s, w)
- evalRWSC :: forall (m :: Type -> Type) w r s i o res. (Monad m, Monoid w) => r -> s -> ConduitT i o (RWST r w s m) res -> ConduitT i o m (res, w)
- execRWSC :: forall (m :: Type -> Type) w r s i o res. (Monad m, Monoid w) => r -> s -> ConduitT i o (RWST r w s m) res -> ConduitT i o m (s, w)
- sinkNull :: forall (m :: Type -> Type) a o. Monad m => ConduitT a o m ()
- type BufferAllocStrategy = (IO Buffer, Int -> Buffer -> IO (IO Buffer))
- yieldMany :: forall (m :: Type -> Type) mono i. (Monad m, MonoFoldable mono) => mono -> ConduitT i (Element mono) m ()
- sourceLazy :: forall (m :: Type -> Type) lazy strict i. (Monad m, LazySequence lazy strict) => lazy -> ConduitT i strict m ()
- sourceHandle :: forall (m :: Type -> Type) i. MonadIO m => Handle -> ConduitT i ByteString m ()
- sourceHandleUnsafe :: forall (m :: Type -> Type) i. MonadIO m => Handle -> ConduitT i ByteString m ()
- sourceIOHandle :: forall (m :: Type -> Type) i. MonadResource m => IO Handle -> ConduitT i ByteString m ()
- sourceFileBS :: forall (m :: Type -> Type) i. MonadResource m => FilePath -> ConduitT i ByteString m ()
- sinkFile :: forall (m :: Type -> Type) o. MonadResource m => FilePath -> ConduitT ByteString o m ()
- sinkFileCautious :: forall (m :: Type -> Type) o. MonadResource m => FilePath -> ConduitM ByteString o m ()
- withSinkFileCautious :: forall m (n :: Type -> Type) o a. (MonadUnliftIO m, MonadIO n) => FilePath -> (ConduitM ByteString o n () -> m a) -> m a
- sinkTempFile :: forall (m :: Type -> Type) o. MonadResource m => FilePath -> String -> ConduitM ByteString o m FilePath
- sinkSystemTempFile :: forall (m :: Type -> Type) o. MonadResource m => String -> ConduitM ByteString o m FilePath
- sinkHandle :: forall (m :: Type -> Type) o. MonadIO m => Handle -> ConduitT ByteString o m ()
- sinkHandleBuilder :: forall (m :: Type -> Type) o. MonadIO m => Handle -> ConduitM Builder o m ()
- sinkHandleFlush :: forall (m :: Type -> Type) o. MonadIO m => Handle -> ConduitM (Flush ByteString) o m ()
- sinkIOHandle :: forall (m :: Type -> Type) o. MonadResource m => IO Handle -> ConduitT ByteString o m ()
- withSourceFile :: forall m (n :: Type -> Type) i a. (MonadUnliftIO m, MonadIO n) => FilePath -> (ConduitM i ByteString n () -> m a) -> m a
- withSinkFile :: forall m (n :: Type -> Type) o a. (MonadUnliftIO m, MonadIO n) => FilePath -> (ConduitM ByteString o n () -> m a) -> m a
- withSinkFileBuilder :: forall m (n :: Type -> Type) o a. (MonadUnliftIO m, MonadIO n) => FilePath -> (ConduitM Builder o n () -> m a) -> m a
- sourceDirectory :: forall (m :: Type -> Type) i. MonadResource m => FilePath -> ConduitT i FilePath m ()
- sourceDirectoryDeep :: forall (m :: Type -> Type) i. MonadResource m => Bool -> FilePath -> ConduitT i FilePath m ()
- sinkLazy :: forall (m :: Type -> Type) lazy strict o. (Monad m, LazySequence lazy strict) => ConduitT strict o m lazy
- sinkList :: forall (m :: Type -> Type) a o. Monad m => ConduitT a o m [a]
- sinkVector :: forall v a (m :: Type -> Type) o. (Vector v a, PrimMonad m) => ConduitT a o m (v a)
- sinkVectorN :: forall v a (m :: Type -> Type) o. (Vector v a, PrimMonad m) => Int -> ConduitT a o m (v a)
- sinkLazyBuilder :: forall (m :: Type -> Type) o. Monad m => ConduitT Builder o m ByteString
- awaitNonNull :: forall (m :: Type -> Type) a o. (Monad m, MonoFoldable a) => ConduitT a o m (Maybe (NonNull a))
- sinkFileBS :: forall (m :: Type -> Type) o. MonadResource m => FilePath -> ConduitT ByteString o m ()
- conduitVector :: forall v a (m :: Type -> Type). (Vector v a, PrimMonad m) => Int -> ConduitT a (v a) m ()
- builderToByteString :: forall (m :: Type -> Type). PrimMonad m => ConduitT Builder ByteString m ()
- builderToByteStringFlush :: forall (m :: Type -> Type). PrimMonad m => ConduitT (Flush Builder) (Flush ByteString) m ()
- unsafeBuilderToByteString :: forall (m :: Type -> Type). PrimMonad m => ConduitT Builder ByteString m ()
- builderToByteStringWith :: forall (m :: Type -> Type). PrimMonad m => BufferAllocStrategy -> ConduitT Builder ByteString m ()
- builderToByteStringWithFlush :: forall (m :: Type -> Type). PrimMonad m => BufferAllocStrategy -> ConduitT (Flush Builder) (Flush ByteString) m ()
- allNewBuffersStrategy :: Int -> BufferAllocStrategy
- reuseBufferStrategy :: IO Buffer -> BufferAllocStrategy
- peekForever :: forall (m :: Type -> Type) i o. Monad m => ConduitT i o m () -> ConduitT i o m ()
- peekForeverE :: forall (m :: Type -> Type) i o. (Monad m, MonoFoldable i) => ConduitT i o m () -> ConduitT i o m ()
- unfoldC :: forall (m :: Type -> Type) b a i. Monad m => (b -> Maybe (a, b)) -> b -> ConduitT i a m ()
- enumFromToC :: forall (m :: Type -> Type) a i. (Monad m, Enum a, Ord a) => a -> a -> ConduitT i a m ()
- iterateC :: forall (m :: Type -> Type) a i. Monad m => (a -> a) -> a -> ConduitT i a m ()
- repeatC :: forall (m :: Type -> Type) a i. Monad m => a -> ConduitT i a m ()
- replicateC :: forall (m :: Type -> Type) a i. Monad m => Int -> a -> ConduitT i a m ()
- repeatMC :: Monad m => m a -> ConduitT i a m ()
- repeatWhileMC :: Monad m => m a -> (a -> Bool) -> ConduitT i a m ()
- replicateMC :: Monad m => Int -> m a -> ConduitT i a m ()
- stdinC :: forall (m :: Type -> Type) i. MonadIO m => ConduitT i ByteString m ()
- dropC :: forall (m :: Type -> Type) a o. Monad m => Int -> ConduitT a o m ()
- dropCE :: forall (m :: Type -> Type) seq o. (Monad m, IsSequence seq) => Index seq -> ConduitT seq o m ()
- dropWhileC :: forall (m :: Type -> Type) a o. Monad m => (a -> Bool) -> ConduitT a o m ()
- dropWhileCE :: forall (m :: Type -> Type) seq o. (Monad m, IsSequence seq) => (Element seq -> Bool) -> ConduitT seq o m ()
- foldC :: forall (m :: Type -> Type) a o. (Monad m, Monoid a) => ConduitT a o m a
- foldCE :: forall (m :: Type -> Type) mono o. (Monad m, MonoFoldable mono, Monoid (Element mono)) => ConduitT mono o m (Element mono)
- foldlC :: forall (m :: Type -> Type) a b o. Monad m => (a -> b -> a) -> a -> ConduitT b o m a
- foldlCE :: forall (m :: Type -> Type) mono a o. (Monad m, MonoFoldable mono) => (a -> Element mono -> a) -> a -> ConduitT mono o m a
- foldMapC :: forall (m :: Type -> Type) b a o. (Monad m, Monoid b) => (a -> b) -> ConduitT a o m b
- foldMapCE :: forall (m :: Type -> Type) mono w o. (Monad m, MonoFoldable mono, Monoid w) => (Element mono -> w) -> ConduitT mono o m w
- allC :: forall (m :: Type -> Type) a o. Monad m => (a -> Bool) -> ConduitT a o m Bool
- allCE :: forall (m :: Type -> Type) mono o. (Monad m, MonoFoldable mono) => (Element mono -> Bool) -> ConduitT mono o m Bool
- anyC :: forall (m :: Type -> Type) a o. Monad m => (a -> Bool) -> ConduitT a o m Bool
- anyCE :: forall (m :: Type -> Type) mono o. (Monad m, MonoFoldable mono) => (Element mono -> Bool) -> ConduitT mono o m Bool
- andC :: forall (m :: Type -> Type) o. Monad m => ConduitT Bool o m Bool
- andCE :: forall (m :: Type -> Type) mono o. (Monad m, MonoFoldable mono, Element mono ~ Bool) => ConduitT mono o m Bool
- orC :: forall (m :: Type -> Type) o. Monad m => ConduitT Bool o m Bool
- orCE :: forall (m :: Type -> Type) mono o. (Monad m, MonoFoldable mono, Element mono ~ Bool) => ConduitT mono o m Bool
- asumC :: forall (m :: Type -> Type) f a o. (Monad m, Alternative f) => ConduitT (f a) o m (f a)
- elemC :: forall (m :: Type -> Type) a o. (Monad m, Eq a) => a -> ConduitT a o m Bool
- elemCE :: forall (m :: Type -> Type) seq o. (Monad m, IsSequence seq, Eq (Element seq)) => Element seq -> ConduitT seq o m Bool
- notElemC :: forall (m :: Type -> Type) a o. (Monad m, Eq a) => a -> ConduitT a o m Bool
- notElemCE :: forall (m :: Type -> Type) seq o. (Monad m, IsSequence seq, Eq (Element seq)) => Element seq -> ConduitT seq o m Bool
- headC :: forall (m :: Type -> Type) a o. Monad m => ConduitT a o m (Maybe a)
- headDefC :: forall (m :: Type -> Type) a o. Monad m => a -> ConduitT a o m a
- headCE :: forall (m :: Type -> Type) seq o. (Monad m, IsSequence seq) => ConduitT seq o m (Maybe (Element seq))
- peekC :: forall (m :: Type -> Type) a o. Monad m => ConduitT a o m (Maybe a)
- peekCE :: forall (m :: Type -> Type) mono o. (Monad m, MonoFoldable mono) => ConduitT mono o m (Maybe (Element mono))
- lastC :: forall (m :: Type -> Type) a o. Monad m => ConduitT a o m (Maybe a)
- lastDefC :: forall (m :: Type -> Type) a o. Monad m => a -> ConduitT a o m a
- lastCE :: forall (m :: Type -> Type) seq o. (Monad m, IsSequence seq) => ConduitT seq o m (Maybe (Element seq))
- lengthC :: forall (m :: Type -> Type) len a o. (Monad m, Num len) => ConduitT a o m len
- lengthCE :: forall (m :: Type -> Type) len mono o. (Monad m, Num len, MonoFoldable mono) => ConduitT mono o m len
- lengthIfC :: forall (m :: Type -> Type) len a o. (Monad m, Num len) => (a -> Bool) -> ConduitT a o m len
- lengthIfCE :: forall (m :: Type -> Type) len mono o. (Monad m, Num len, MonoFoldable mono) => (Element mono -> Bool) -> ConduitT mono o m len
- maximumC :: forall (m :: Type -> Type) a o. (Monad m, Ord a) => ConduitT a o m (Maybe a)
- maximumCE :: forall (m :: Type -> Type) seq o. (Monad m, IsSequence seq, Ord (Element seq)) => ConduitT seq o m (Maybe (Element seq))
- minimumC :: forall (m :: Type -> Type) a o. (Monad m, Ord a) => ConduitT a o m (Maybe a)
- minimumCE :: forall (m :: Type -> Type) seq o. (Monad m, IsSequence seq, Ord (Element seq)) => ConduitT seq o m (Maybe (Element seq))
- nullC :: forall (m :: Type -> Type) a o. Monad m => ConduitT a o m Bool
- nullCE :: forall (m :: Type -> Type) mono o. (Monad m, MonoFoldable mono) => ConduitT mono o m Bool
- sumC :: forall (m :: Type -> Type) a o. (Monad m, Num a) => ConduitT a o m a
- sumCE :: forall (m :: Type -> Type) mono o. (Monad m, MonoFoldable mono, Num (Element mono)) => ConduitT mono o m (Element mono)
- productC :: forall (m :: Type -> Type) a o. (Monad m, Num a) => ConduitT a o m a
- productCE :: forall (m :: Type -> Type) mono o. (Monad m, MonoFoldable mono, Num (Element mono)) => ConduitT mono o m (Element mono)
- findC :: forall (m :: Type -> Type) a o. Monad m => (a -> Bool) -> ConduitT a o m (Maybe a)
- mapM_C :: Monad m => (a -> m ()) -> ConduitT a o m ()
- mapM_CE :: (Monad m, MonoFoldable mono) => (Element mono -> m ()) -> ConduitT mono o m ()
- foldMC :: Monad m => (a -> b -> m a) -> a -> ConduitT b o m a
- foldMCE :: (Monad m, MonoFoldable mono) => (a -> Element mono -> m a) -> a -> ConduitT mono o m a
- foldMapMC :: (Monad m, Monoid w) => (a -> m w) -> ConduitT a o m w
- foldMapMCE :: (Monad m, MonoFoldable mono, Monoid w) => (Element mono -> m w) -> ConduitT mono o m w
- printC :: forall a (m :: Type -> Type) o. (Show a, MonadIO m) => ConduitT a o m ()
- stdoutC :: forall (m :: Type -> Type) o. MonadIO m => ConduitT ByteString o m ()
- stderrC :: forall (m :: Type -> Type) o. MonadIO m => ConduitT ByteString o m ()
- mapC :: forall (m :: Type -> Type) a b. Monad m => (a -> b) -> ConduitT a b m ()
- mapCE :: forall (m :: Type -> Type) f a b. (Monad m, Functor f) => (a -> b) -> ConduitT (f a) (f b) m ()
- omapCE :: forall (m :: Type -> Type) mono. (Monad m, MonoFunctor mono) => (Element mono -> Element mono) -> ConduitT mono mono m ()
- concatMapC :: forall (m :: Type -> Type) mono a. (Monad m, MonoFoldable mono) => (a -> mono) -> ConduitT a (Element mono) m ()
- concatMapCE :: forall (m :: Type -> Type) mono w. (Monad m, MonoFoldable mono, Monoid w) => (Element mono -> w) -> ConduitT mono w m ()
- takeC :: forall (m :: Type -> Type) a. Monad m => Int -> ConduitT a a m ()
- takeCE :: forall (m :: Type -> Type) seq. (Monad m, IsSequence seq) => Index seq -> ConduitT seq seq m ()
- takeWhileC :: forall (m :: Type -> Type) a. Monad m => (a -> Bool) -> ConduitT a a m ()
- takeWhileCE :: forall (m :: Type -> Type) seq. (Monad m, IsSequence seq) => (Element seq -> Bool) -> ConduitT seq seq m ()
- takeExactlyC :: forall (m :: Type -> Type) a b r. Monad m => Int -> ConduitT a b m r -> ConduitT a b m r
- takeExactlyCE :: forall (m :: Type -> Type) a b r. (Monad m, IsSequence a) => Index a -> ConduitT a b m r -> ConduitT a b m r
- concatC :: forall (m :: Type -> Type) mono. (Monad m, MonoFoldable mono) => ConduitT mono (Element mono) m ()
- filterC :: forall (m :: Type -> Type) a. Monad m => (a -> Bool) -> ConduitT a a m ()
- filterCE :: forall seq (m :: Type -> Type). (IsSequence seq, Monad m) => (Element seq -> Bool) -> ConduitT seq seq m ()
- mapWhileC :: forall (m :: Type -> Type) a b. Monad m => (a -> Maybe b) -> ConduitT a b m ()
- scanlC :: forall (m :: Type -> Type) a b. Monad m => (a -> b -> a) -> a -> ConduitT b a m ()
- mapAccumWhileC :: forall (m :: Type -> Type) a s b. Monad m => (a -> s -> Either s (s, b)) -> s -> ConduitT a b m s
- concatMapAccumC :: forall (m :: Type -> Type) a accum b. Monad m => (a -> accum -> (accum, [b])) -> accum -> ConduitT a b m ()
- intersperseC :: forall (m :: Type -> Type) a. Monad m => a -> ConduitT a a m ()
- slidingWindowC :: forall (m :: Type -> Type) seq a. (Monad m, IsSequence seq, Element seq ~ a) => Int -> ConduitT a seq m ()
- chunksOfCE :: forall (m :: Type -> Type) seq. (Monad m, IsSequence seq) => Index seq -> ConduitT seq seq m ()
- chunksOfExactlyCE :: forall (m :: Type -> Type) seq. (Monad m, IsSequence seq) => Index seq -> ConduitT seq seq m ()
- mapMC :: Monad m => (a -> m b) -> ConduitT a b m ()
- mapMCE :: (Monad m, Traversable f) => (a -> m b) -> ConduitT (f a) (f b) m ()
- omapMCE :: (Monad m, MonoTraversable mono) => (Element mono -> m (Element mono)) -> ConduitT mono mono m ()
- concatMapMC :: (Monad m, MonoFoldable mono) => (a -> m mono) -> ConduitT a (Element mono) m ()
- filterMC :: Monad m => (a -> m Bool) -> ConduitT a a m ()
- filterMCE :: (Monad m, IsSequence seq) => (Element seq -> m Bool) -> ConduitT seq seq m ()
- iterMC :: Monad m => (a -> m ()) -> ConduitT a a m ()
- scanlMC :: Monad m => (a -> b -> m a) -> a -> ConduitT b a m ()
- mapAccumWhileMC :: Monad m => (a -> s -> m (Either s (s, b))) -> s -> ConduitT a b m s
- concatMapAccumMC :: Monad m => (a -> accum -> m (accum, [b])) -> accum -> ConduitT a b m ()
- encodeUtf8C :: forall (m :: Type -> Type) text binary. (Monad m, Utf8 text binary) => ConduitT text binary m ()
- decodeUtf8C :: forall (m :: Type -> Type). MonadThrow m => ConduitT ByteString Text m ()
- decodeUtf8LenientC :: forall (m :: Type -> Type). Monad m => ConduitT ByteString Text m ()
- lineC :: forall (m :: Type -> Type) seq o r. (Monad m, IsSequence seq, Element seq ~ Char) => ConduitT seq o m r -> ConduitT seq o m r
- lineAsciiC :: forall (m :: Type -> Type) seq o r. (Monad m, IsSequence seq, Element seq ~ Word8) => ConduitT seq o m r -> ConduitT seq o m r
- unlinesC :: forall (m :: Type -> Type) seq. (Monad m, IsSequence seq, Element seq ~ Char) => ConduitT seq seq m ()
- unlinesAsciiC :: forall (m :: Type -> Type) seq. (Monad m, IsSequence seq, Element seq ~ Word8) => ConduitT seq seq m ()
- linesUnboundedC :: forall (m :: Type -> Type) seq. (Monad m, IsSequence seq, Element seq ~ Char) => ConduitT seq seq m ()
- linesUnboundedAsciiC :: forall (m :: Type -> Type) seq. (Monad m, IsSequence seq, Element seq ~ Word8) => ConduitT seq seq m ()
- vectorBuilderC :: forall (m :: Type -> Type) v e n i r. (PrimMonad m, Vector v e, PrimMonad n, PrimState m ~ PrimState n) => Int -> ((e -> n ()) -> ConduitT i Void m r) -> ConduitT i (v e) m r
- allocateAcquire :: MonadResource m => Acquire a -> m (ReleaseKey, a)
- withAcquire :: MonadUnliftIO m => Acquire a -> (a -> m b) -> m b
- mkAcquire :: IO a -> (a -> IO ()) -> Acquire a
- mkAcquireType :: IO a -> (a -> ReleaseType -> IO ()) -> Acquire a
- data Acquire a
Re-export
module ClassyPrelude
class Monad m => PrimMonad (m :: Type -> Type) where #
Instances
type Conduit i (m :: Type -> Type) o = ConduitT i o m () Source #
Consumes a stream of input values and produces a stream of output values, without producing a final result.
Since 0.5.0
Uninhabited data type
Since: base-4.8.0.0
Instances
| NFData Void | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
| Semigroup Void | Since: base-4.9.0.0 |
| Exception Void | Since: base-4.8.0.0 |
Defined in GHC.Internal.Exception.Type Methods toException :: Void -> SomeException Source # fromException :: SomeException -> Maybe Void Source # displayException :: Void -> String Source # backtraceDesired :: Void -> Bool Source # | |
| Generic Void | |
| Read Void | Reading a Since: base-4.8.0.0 |
| Show Void | Since: base-4.8.0.0 |
| Eq Void | Since: base-4.8.0.0 |
| Ord Void | Since: base-4.8.0.0 |
| Hashable Void | |
Defined in Data.Hashable.Class | |
| type Rep Void | Since: base-4.8.0.0 |
class (forall (m :: Type -> Type). Monad m => Monad (t m)) => MonadTrans (t :: (Type -> Type) -> Type -> Type) where Source #
The class of monad transformers.
For any monad m, the result t m should also be a monad,
and lift should be a monad transformation from m to t m,
i.e. it should satisfy the following laws:
Since 0.6.0.0 and for GHC 8.6 and later, the requirement that t m
be a Monad is enforced by the implication constraint
forall m. enabled by the
Monad m => Monad (t m)QuantifiedConstraints extension.
Ambiguity error with GHC 9.0 to 9.2.2
These versions of GHC have a bug (https://gitlab.haskell.org/ghc/ghc/-/issues/20582) which causes constraints like
(MonadTrans t, forall m. Monad m => Monad (t m)) => ...
to be reported as ambiguous. For transformers 0.6 and later, this can be fixed by removing the second constraint, which is implied by the first.
Methods
lift :: Monad m => m a -> t m a Source #
Lift a computation from the argument monad to the constructed monad.
Instances
| MonadTrans CatchT | |
| MonadTrans Free | |
Defined in Control.Monad.Free | |
| MonadTrans ResourceT | |
| MonadTrans MaybeT | |
| Functor f => MonadTrans (FreeT f) | |
Defined in Control.Monad.Trans.Free | |
| Monoid w => MonadTrans (AccumT w) | |
| MonadTrans (ExceptT e) | |
| MonadTrans (IdentityT :: (Type -> Type) -> Type -> Type) | |
| MonadTrans (ReaderT r) | |
| MonadTrans (SelectT r) | |
| MonadTrans (StateT s) | |
| MonadTrans (StateT s) | |
| MonadTrans (WriterT w) | |
| Monoid w => MonadTrans (WriterT w) | |
| Monoid w => MonadTrans (WriterT w) | |
| MonadTrans (ConduitT i o) | |
| MonadTrans (ContT r) | |
| MonadTrans (RWST r w s) | |
| Monoid w => MonadTrans (RWST r w s) | |
| Monoid w => MonadTrans (RWST r w s) | |
| MonadTrans (Pipe l i o u) | |
class Monad m => MonadIO (m :: Type -> Type) where Source #
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:
Methods
liftIO :: IO a -> m a Source #
Lift a computation from the IO monad.
This allows us to run IO computations in any monadic stack, so long as it supports these kinds of operations
(i.e. IO is the base monad for the stack).
Example
import Control.Monad.Trans.State -- from the "transformers" library printState :: Show s => StateT s IO () printState = do state <- get liftIO $ print state
Had we omitted , we would have ended up with this error:liftIO
• Couldn't match type ‘IO’ with ‘StateT s IO’ Expected type: StateT s IO () Actual type: IO ()
The important part here is the mismatch between StateT s IO () and .IO ()
Luckily, we know of a function that takes an and returns an IO a(m a): ,
enabling us to run the program and see the expected results:liftIO
> evalStateT printState "hello" "hello" > evalStateT printState 3 3
Instances
| MonadIO IO | Since: base-4.9.0.0 |
| MonadIO Acquire | |
| MonadIO m => MonadIO (CatchT m) | |
| MonadIO m => MonadIO (ResourceT m) | |
| MonadIO m => MonadIO (MaybeT m) | |
| (Functor f, MonadIO m) => MonadIO (FreeT f m) | |
Defined in Control.Monad.Trans.Free | |
| (Monoid w, Functor m, MonadIO m) => MonadIO (AccumT w m) | |
| MonadIO m => MonadIO (ExceptT e m) | |
| MonadIO m => MonadIO (IdentityT m) | |
| MonadIO m => MonadIO (ReaderT r m) | |
| MonadIO m => MonadIO (SelectT r m) | |
| MonadIO m => MonadIO (StateT s m) | |
| MonadIO m => MonadIO (StateT s m) | |
| MonadIO m => MonadIO (WriterT w m) | |
| (Monoid w, MonadIO m) => MonadIO (WriterT w m) | |
| (Monoid w, MonadIO m) => MonadIO (WriterT w m) | |
| MonadIO m => MonadIO (ConduitT i o m) | |
| MonadIO m => MonadIO (ContT r m) | |
| MonadIO m => MonadIO (RWST r w s m) | |
| (Monoid w, MonadIO m) => MonadIO (RWST r w s m) | |
| (Monoid w, MonadIO m) => MonadIO (RWST r w s m) | |
| MonadIO m => MonadIO (Pipe l i o u 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
Identity functor and monad. (a non-strict monad)
Examples
>>>fmap (+1) (Identity 0)Identity 1
>>>Identity [1, 2, 3] <> Identity [4, 5, 6]Identity [1,2,3,4,5,6]
>>> do
x <- Identity 10
y <- Identity (x + 5)
pure (x + y)
Identity 25
Since: base-4.8.0.0
Constructors
| Identity | |
Fields
| |
Instances
| Representable Identity | |||||
Defined in Data.Functor.Rep Associated Types
| |||||
| MonadZip Identity | Since: base-4.8.0.0 | ||||
| Foldable1 Identity | Since: base-4.18.0.0 | ||||
Defined in Data.Foldable1 Methods fold1 :: Semigroup m => Identity m -> m Source # foldMap1 :: Semigroup m => (a -> m) -> Identity a -> m Source # foldMap1' :: Semigroup m => (a -> m) -> Identity a -> m Source # toNonEmpty :: Identity a -> NonEmpty a Source # maximum :: Ord a => Identity a -> a Source # minimum :: Ord a => Identity a -> a Source # head :: Identity a -> a Source # last :: Identity a -> a Source # foldrMap1 :: (a -> b) -> (a -> b -> b) -> Identity a -> b Source # foldlMap1' :: (a -> b) -> (b -> a -> b) -> Identity a -> b Source # foldlMap1 :: (a -> b) -> (b -> a -> b) -> Identity a -> b Source # foldrMap1' :: (a -> b) -> (a -> b -> b) -> Identity a -> b Source # | |||||
| Eq1 Identity | Since: base-4.9.0.0 | ||||
| Ord1 Identity | Since: base-4.9.0.0 | ||||
Defined in Data.Functor.Classes | |||||
| Read1 Identity | Since: base-4.9.0.0 | ||||
Defined in Data.Functor.Classes Methods liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (Identity a) Source # liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [Identity a] Source # liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (Identity a) Source # liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [Identity a] Source # | |||||
| Show1 Identity | Since: base-4.9.0.0 | ||||
| NFData1 Identity | Since: deepseq-1.4.3.0 | ||||
Defined in Control.DeepSeq | |||||
| Applicative Identity | Since: base-4.8.0.0 | ||||
Defined in GHC.Internal.Data.Functor.Identity | |||||
| Functor Identity | Since: base-4.8.0.0 | ||||
| Monad Identity | Since: base-4.8.0.0 | ||||
| MonadFix Identity | Since: base-4.8.0.0 | ||||
| Foldable Identity | Since: base-4.8.0.0 | ||||
Defined in GHC.Internal.Data.Functor.Identity Methods fold :: Monoid m => Identity m -> m Source # foldMap :: Monoid m => (a -> m) -> Identity a -> m Source # foldMap' :: Monoid m => (a -> m) -> Identity a -> m Source # foldr :: (a -> b -> b) -> b -> Identity a -> b Source # foldr' :: (a -> b -> b) -> b -> Identity a -> b Source # foldl :: (b -> a -> b) -> b -> Identity a -> b Source # foldl' :: (b -> a -> b) -> b -> Identity a -> b Source # foldr1 :: (a -> a -> a) -> Identity a -> a Source # foldl1 :: (a -> a -> a) -> Identity a -> a Source # toList :: Identity a -> [a] Source # null :: Identity a -> Bool Source # length :: Identity a -> Int Source # elem :: Eq a => a -> Identity a -> Bool Source # maximum :: Ord a => Identity a -> a Source # minimum :: Ord a => Identity a -> a Source # | |||||
| Traversable Identity | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Traversable | |||||
| Hashable1 Identity | |||||
Defined in Data.Hashable.Class | |||||
| Adjustable Identity | |||||
| FoldableWithKey Identity | |||||
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 | |||||
Defined in Data.Key Methods foldMapWithKey1 :: Semigroup m => (Key Identity -> a -> m) -> Identity a -> m | |||||
| Indexable Identity | |||||
| Keyed Identity | |||||
Defined in Data.Key Methods mapWithKey :: (Key Identity -> a -> b) -> Identity a -> Identity b | |||||
| Lookup Identity | |||||
| TraversableWithKey Identity | |||||
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 | |||||
Defined in Data.Key Methods traverseWithKey1 :: Apply f => (Key Identity -> a -> f b) -> Identity a -> f (Identity b) | |||||
| Zip Identity | |||||
| ZipWithKey Identity | |||||
| Generic1 Identity | |||||
Defined in GHC.Internal.Data.Functor.Identity Associated Types
| |||||
| MonadBaseControl Identity Identity | |||||
Defined in Control.Monad.Trans.Control Associated Types
| |||||
| Unbox a => Vector Vector (Identity a) | |||||
Defined in Data.Vector.Unboxed.Base Methods basicUnsafeFreeze :: Mutable Vector s (Identity a) -> ST s (Vector (Identity a)) basicUnsafeThaw :: Vector (Identity a) -> ST s (Mutable Vector s (Identity a)) basicLength :: Vector (Identity a) -> Int basicUnsafeSlice :: Int -> Int -> Vector (Identity a) -> Vector (Identity a) basicUnsafeIndexM :: Vector (Identity a) -> Int -> Box (Identity a) basicUnsafeCopy :: Mutable Vector s (Identity a) -> Vector (Identity a) -> ST s () | |||||
| Unbox a => MVector MVector (Identity a) | |||||
Defined in Data.Vector.Unboxed.Base Methods basicLength :: MVector s (Identity a) -> Int basicUnsafeSlice :: Int -> Int -> MVector s (Identity a) -> MVector s (Identity a) basicOverlaps :: MVector s (Identity a) -> MVector s (Identity a) -> Bool basicUnsafeNew :: Int -> ST s (MVector s (Identity a)) basicInitialize :: MVector s (Identity a) -> ST s () basicUnsafeReplicate :: Int -> Identity a -> ST s (MVector s (Identity a)) basicUnsafeRead :: MVector s (Identity a) -> Int -> ST s (Identity a) basicUnsafeWrite :: MVector s (Identity a) -> Int -> Identity a -> ST s () basicClear :: MVector s (Identity a) -> ST s () basicSet :: MVector s (Identity a) -> Identity a -> ST s () basicUnsafeCopy :: MVector s (Identity a) -> MVector s (Identity a) -> ST s () basicUnsafeMove :: MVector s (Identity a) -> MVector s (Identity a) -> ST s () basicUnsafeGrow :: MVector s (Identity a) -> Int -> ST s (MVector s (Identity a)) | |||||
| NFData a => NFData (Identity a) | Since: deepseq-1.4.0.0 | ||||
Defined in Control.DeepSeq | |||||
| Monoid a => Monoid (Identity a) | Since: base-4.9.0.0 | ||||
| Semigroup a => Semigroup (Identity a) | Since: base-4.9.0.0 | ||||
| Bits a => Bits (Identity a) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Functor.Identity Methods (.&.) :: Identity a -> Identity a -> Identity a Source # (.|.) :: Identity a -> Identity a -> Identity a Source # xor :: Identity a -> Identity a -> Identity a Source # complement :: Identity a -> Identity a Source # shift :: Identity a -> Int -> Identity a Source # rotate :: Identity a -> Int -> Identity a Source # zeroBits :: Identity a Source # bit :: Int -> Identity a Source # setBit :: Identity a -> Int -> Identity a Source # clearBit :: Identity a -> Int -> Identity a Source # complementBit :: Identity a -> Int -> Identity a Source # testBit :: Identity a -> Int -> Bool Source # bitSizeMaybe :: Identity a -> Maybe Int Source # bitSize :: Identity a -> Int Source # isSigned :: Identity a -> Bool Source # shiftL :: Identity a -> Int -> Identity a Source # unsafeShiftL :: Identity a -> Int -> Identity a Source # shiftR :: Identity a -> Int -> Identity a Source # unsafeShiftR :: Identity a -> Int -> Identity a Source # rotateL :: Identity a -> Int -> Identity a Source # | |||||
| FiniteBits a => FiniteBits (Identity a) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Functor.Identity Methods finiteBitSize :: Identity a -> Int Source # countLeadingZeros :: Identity a -> Int Source # countTrailingZeros :: Identity a -> Int Source # | |||||
| IsString a => IsString (Identity a) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.String Methods fromString :: String -> Identity a Source # | |||||
| Bounded a => Bounded (Identity a) | Since: base-4.9.0.0 | ||||
| Enum a => Enum (Identity a) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Functor.Identity Methods succ :: Identity a -> Identity a Source # pred :: Identity a -> Identity a Source # toEnum :: Int -> Identity a Source # fromEnum :: Identity a -> Int Source # enumFrom :: Identity a -> [Identity a] Source # enumFromThen :: Identity a -> Identity a -> [Identity a] Source # enumFromTo :: Identity a -> Identity a -> [Identity a] Source # enumFromThenTo :: Identity a -> Identity a -> Identity a -> [Identity a] Source # | |||||
| Floating a => Floating (Identity a) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Functor.Identity Methods exp :: Identity a -> Identity a Source # log :: Identity a -> Identity a Source # sqrt :: Identity a -> Identity a Source # (**) :: Identity a -> Identity a -> Identity a Source # logBase :: Identity a -> Identity a -> Identity a Source # sin :: Identity a -> Identity a Source # cos :: Identity a -> Identity a Source # tan :: Identity a -> Identity a Source # asin :: Identity a -> Identity a Source # acos :: Identity a -> Identity a Source # atan :: Identity a -> Identity a Source # sinh :: Identity a -> Identity a Source # cosh :: Identity a -> Identity a Source # tanh :: Identity a -> Identity a Source # asinh :: Identity a -> Identity a Source # acosh :: Identity a -> Identity a Source # atanh :: Identity a -> Identity a Source # log1p :: Identity a -> Identity a Source # expm1 :: Identity a -> Identity a Source # | |||||
| RealFloat a => RealFloat (Identity a) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Functor.Identity Methods floatRadix :: Identity a -> Integer Source # floatDigits :: Identity a -> Int Source # floatRange :: Identity a -> (Int, Int) Source # decodeFloat :: Identity a -> (Integer, Int) Source # encodeFloat :: Integer -> Int -> Identity a Source # exponent :: Identity a -> Int Source # significand :: Identity a -> Identity a Source # scaleFloat :: Int -> Identity a -> Identity a Source # isNaN :: Identity a -> Bool Source # isInfinite :: Identity a -> Bool Source # isDenormalized :: Identity a -> Bool Source # isNegativeZero :: Identity a -> Bool Source # | |||||
| Storable a => Storable (Identity a) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Functor.Identity Methods sizeOf :: Identity a -> Int Source # alignment :: Identity a -> Int Source # peekElemOff :: Ptr (Identity a) -> Int -> IO (Identity a) Source # pokeElemOff :: Ptr (Identity a) -> Int -> Identity a -> IO () Source # peekByteOff :: Ptr b -> Int -> IO (Identity a) Source # pokeByteOff :: Ptr b -> Int -> Identity a -> IO () Source # | |||||
| Generic (Identity a) | |||||
Defined in GHC.Internal.Data.Functor.Identity Associated Types
| |||||
| Ix a => Ix (Identity a) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Functor.Identity Methods range :: (Identity a, Identity a) -> [Identity a] Source # index :: (Identity a, Identity a) -> Identity a -> Int Source # unsafeIndex :: (Identity a, Identity a) -> Identity a -> Int Source # inRange :: (Identity a, Identity a) -> Identity a -> Bool Source # | |||||
| Num a => Num (Identity a) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Functor.Identity Methods (+) :: Identity a -> Identity a -> Identity a Source # (-) :: Identity a -> Identity a -> Identity a Source # (*) :: Identity a -> Identity a -> Identity a Source # negate :: Identity a -> Identity a Source # abs :: Identity a -> Identity a Source # signum :: Identity a -> Identity a Source # fromInteger :: Integer -> Identity a Source # | |||||
| Read a => Read (Identity a) | This instance would be equivalent to the derived instances of the
Since: base-4.8.0.0 | ||||
| Fractional a => Fractional (Identity a) | Since: base-4.9.0.0 | ||||
| Integral a => Integral (Identity a) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Functor.Identity Methods quot :: Identity a -> Identity a -> Identity a Source # rem :: Identity a -> Identity a -> Identity a Source # div :: Identity a -> Identity a -> Identity a Source # mod :: Identity a -> Identity a -> Identity a Source # quotRem :: Identity a -> Identity a -> (Identity a, Identity a) Source # divMod :: Identity a -> Identity a -> (Identity a, Identity a) Source # | |||||
| Real a => Real (Identity a) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Functor.Identity Methods toRational :: Identity a -> Rational Source # | |||||
| RealFrac a => RealFrac (Identity a) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Functor.Identity | |||||
| Show a => Show (Identity a) | This instance would be equivalent to the derived instances of the
Since: base-4.8.0.0 | ||||
| Eq a => Eq (Identity a) | Since: base-4.8.0.0 | ||||
| Ord a => Ord (Identity a) | Since: base-4.8.0.0 | ||||
Defined in GHC.Internal.Data.Functor.Identity Methods compare :: Identity a -> Identity a -> Ordering Source # (<) :: Identity a -> Identity a -> Bool Source # (<=) :: Identity a -> Identity a -> Bool Source # (>) :: Identity a -> Identity a -> Bool Source # (>=) :: Identity a -> Identity a -> Bool Source # | |||||
| Hashable a => Hashable (Identity a) | |||||
Defined in Data.Hashable.Class | |||||
| MonoComonad (Identity a) | |||||
| MonoFoldable (Identity a) | |||||
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 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) | |||||
| MonoFunctor (Identity a) | |||||
| MonoPointed (Identity a) | |||||
Defined in Data.MonoTraversable | |||||
| MonoTraversable (Identity a) | |||||
Defined in Data.MonoTraversable | |||||
| Prim a => Prim (Identity a) | |||||
Defined in Data.Primitive.Types Methods sizeOfType# :: Proxy (Identity a) -> Int# alignmentOfType# :: Proxy (Identity a) -> Int# alignment# :: Identity a -> Int# indexByteArray# :: ByteArray# -> Int# -> Identity a readByteArray# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, Identity a #) writeByteArray# :: MutableByteArray# s -> Int# -> Identity a -> State# s -> State# s setByteArray# :: MutableByteArray# s -> Int# -> Int# -> Identity a -> State# s -> State# s indexOffAddr# :: Addr# -> Int# -> Identity a readOffAddr# :: Addr# -> Int# -> State# s -> (# State# s, Identity a #) writeOffAddr# :: Addr# -> Int# -> Identity a -> State# s -> State# s setOffAddr# :: Addr# -> Int# -> Int# -> Identity a -> State# s -> State# s | |||||
| Unbox a => Unbox (Identity a) | |||||
Defined in Data.Vector.Unboxed.Base | |||||
| type Rep Identity | |||||
Defined in Data.Functor.Rep type Rep Identity = () | |||||
| type Key Identity | |||||
| type Rep1 Identity | Since: base-4.8.0.0 | ||||
Defined in GHC.Internal.Data.Functor.Identity | |||||
| type StM Identity a | |||||
Defined in Control.Monad.Trans.Control type StM Identity a = a | |||||
| newtype MVector s (Identity a) | |||||
Defined in Data.Vector.Unboxed.Base | |||||
| type Rep (Identity a) | Since: base-4.8.0.0 | ||||
Defined in GHC.Internal.Data.Functor.Identity | |||||
| type Element (Identity a) | |||||
Defined in Data.MonoTraversable type Element (Identity a) = a | |||||
| newtype Vector (Identity a) | |||||
Defined in Data.Vector.Unboxed.Base | |||||
sourceFile :: forall (m :: Type -> Type) i. MonadResource m => FilePath -> ConduitT i ByteString m () Source #
Stream the contents of a file as binary data.
Since: conduit-1.3.0
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
Instances
| Functor Flush | |
| Show a => Show (Flush a) | |
| Eq a => Eq (Flush a) | |
| Ord a => Ord (Flush a) | |
Defined in Data.Conduit.Internal.Conduit | |
class MonadIO m => MonadUnliftIO (m :: Type -> Type) where #
Methods
withRunInIO :: ((forall a. m a -> IO a) -> IO b) -> m b #
Instances
| MonadUnliftIO IO | |
Defined in Control.Monad.IO.Unlift | |
| MonadUnliftIO m => MonadUnliftIO (ResourceT m) | |
Defined in Control.Monad.Trans.Resource.Internal | |
| MonadUnliftIO m => MonadUnliftIO (IdentityT m) | |
Defined in Control.Monad.IO.Unlift | |
| MonadUnliftIO m => MonadUnliftIO (ReaderT r m) | |
Defined in Control.Monad.IO.Unlift | |
type family PrimState (m :: Type -> Type) #
Instances
| type PrimState IO | |
Defined in Control.Monad.Primitive | |
| type PrimState (ST s) | |
Defined in Control.Monad.Primitive | |
| type PrimState (ST s) | |
Defined in Control.Monad.Primitive | |
| type PrimState (ResourceT m) | |
Defined in Control.Monad.Trans.Resource.Internal | |
| type PrimState (MaybeT m) | |
Defined in Control.Monad.Primitive | |
| type PrimState (AccumT w m) | |
Defined in Control.Monad.Primitive | |
| type PrimState (ExceptT e m) | |
Defined in Control.Monad.Primitive | |
| type PrimState (IdentityT m) | |
Defined in Control.Monad.Primitive | |
| type PrimState (ReaderT r m) | |
Defined in Control.Monad.Primitive | |
| type PrimState (SelectT r m) | |
Defined in Control.Monad.Primitive | |
| type PrimState (StateT s m) | |
Defined in Control.Monad.Primitive | |
| type PrimState (StateT s m) | |
Defined in Control.Monad.Primitive | |
| type PrimState (WriterT w m) | |
Defined in Control.Monad.Primitive | |
| type PrimState (WriterT w m) | |
Defined in Control.Monad.Primitive | |
| type PrimState (WriterT w m) | |
Defined in Control.Monad.Primitive | |
| type PrimState (ConduitT i o m) | |
Defined in Data.Conduit.Internal.Conduit | |
| type PrimState (ContT r m) | |
Defined in Control.Monad.Primitive | |
| type PrimState (RWST r w s m) | |
Defined in Control.Monad.Primitive | |
| type PrimState (RWST r w s m) | |
Defined in Control.Monad.Primitive | |
| type PrimState (RWST r w s m) | |
Defined in Control.Monad.Primitive | |
| type PrimState (Pipe l i o u m) | |
Defined in Data.Conduit.Internal.Pipe | |
class Monad m => MonadThrow (m :: Type -> Type) Source #
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
Instances
| MonadThrow STM | |
Defined in Control.Monad.Catch | |
| MonadThrow IO | |
Defined in Control.Monad.Catch | |
| MonadThrow Q | |
Defined in Control.Monad.Catch | |
| MonadThrow Maybe | |
Defined in Control.Monad.Catch | |
| MonadThrow [] | |
Defined in Control.Monad.Catch Methods throwM :: (HasCallStack, Exception e) => e -> [a] Source # | |
| Monad m => MonadThrow (CatchT m) | |
Defined in Control.Monad.Catch.Pure | |
| e ~ SomeException => MonadThrow (Either e) | |
Defined in Control.Monad.Catch | |
| MonadThrow (ST s) | |
Defined in Control.Monad.Catch | |
| MonadThrow m => MonadThrow (ResourceT m) | |
Defined in Control.Monad.Trans.Resource.Internal | |
| MonadThrow m => MonadThrow (MaybeT m) | Throws exceptions into the base monad. |
Defined in Control.Monad.Catch | |
| (Functor f, MonadThrow m) => MonadThrow (FreeT f m) | |
Defined in Control.Monad.Trans.Free Methods throwM :: (HasCallStack, Exception e) => e -> FreeT f m a Source # | |
| MonadThrow m => MonadThrow (ExceptT e m) | Throws exceptions into the base monad. |
Defined in Control.Monad.Catch | |
| MonadThrow m => MonadThrow (IdentityT m) | |
Defined in Control.Monad.Catch | |
| MonadThrow m => MonadThrow (ReaderT r m) | |
Defined in Control.Monad.Catch | |
| MonadThrow m => MonadThrow (StateT s m) | |
Defined in Control.Monad.Catch | |
| MonadThrow m => MonadThrow (StateT s m) | |
Defined in Control.Monad.Catch | |
| (MonadThrow m, Monoid w) => MonadThrow (WriterT w m) | |
Defined in Control.Monad.Catch | |
| (MonadThrow m, Monoid w) => MonadThrow (WriterT w m) | |
Defined in Control.Monad.Catch | |
| MonadThrow m => MonadThrow (ConduitT i o m) | |
Defined in Data.Conduit.Internal.Conduit | |
| MonadThrow m => MonadThrow (ContT r m) | |
Defined in Control.Monad.Catch | |
| (MonadThrow m, Monoid w) => MonadThrow (RWST r w s m) | |
Defined in Control.Monad.Catch | |
| (MonadThrow m, Monoid w) => MonadThrow (RWST r w s m) | |
Defined in Control.Monad.Catch | |
| MonadThrow m => MonadThrow (Pipe l i o u m) | |
Defined in Data.Conduit.Internal.Pipe | |
runResourceT :: MonadUnliftIO m => ResourceT m a -> m a #
class MonadIO m => MonadResource (m :: Type -> Type) #
Minimal complete definition
liftResourceT
Instances
| MonadIO m => MonadResource (ResourceT m) | |
Defined in Control.Monad.Trans.Resource.Internal Methods liftResourceT :: ResourceT IO a -> ResourceT m a | |
| MonadResource m => MonadResource (MaybeT m) | |
Defined in Control.Monad.Trans.Resource.Internal Methods liftResourceT :: ResourceT IO a -> MaybeT m a | |
| MonadResource m => MonadResource (ExceptT e m) | |
Defined in Control.Monad.Trans.Resource.Internal Methods liftResourceT :: ResourceT IO a -> ExceptT e m a | |
| MonadResource m => MonadResource (IdentityT m) | |
Defined in Control.Monad.Trans.Resource.Internal Methods liftResourceT :: ResourceT IO a -> IdentityT m a | |
| MonadResource m => MonadResource (ReaderT r m) | |
Defined in Control.Monad.Trans.Resource.Internal Methods liftResourceT :: ResourceT IO a -> ReaderT r m a | |
| MonadResource m => MonadResource (StateT s m) | |
Defined in Control.Monad.Trans.Resource.Internal Methods liftResourceT :: ResourceT IO a -> StateT s m a | |
| MonadResource m => MonadResource (StateT s m) | |
Defined in Control.Monad.Trans.Resource.Internal Methods liftResourceT :: ResourceT IO a -> StateT s m a | |
| (Monoid w, MonadResource m) => MonadResource (WriterT w m) | |
Defined in Control.Monad.Trans.Resource.Internal Methods liftResourceT :: ResourceT IO a -> WriterT w m a | |
| (Monoid w, MonadResource m) => MonadResource (WriterT w m) | |
Defined in Control.Monad.Trans.Resource.Internal Methods liftResourceT :: ResourceT IO a -> WriterT w m a | |
| MonadResource m => MonadResource (ConduitT i o m) | |
Defined in Data.Conduit.Internal.Conduit Methods liftResourceT :: ResourceT IO a -> ConduitT i o m a | |
| MonadResource m => MonadResource (ContT r m) | |
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) | |
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) | |
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) | |
Defined in Data.Conduit.Internal.Pipe Methods liftResourceT :: ResourceT IO a -> Pipe l i o u m a | |
data ResourceT (m :: Type -> Type) a #
Instances
| MonadTrans ResourceT | |||||
| MonadRWS r w s m => MonadRWS r w s (ResourceT m) | |||||
Defined in Control.Monad.Trans.Resource.Internal | |||||
| MonadError e m => MonadError e (ResourceT m) | |||||
Defined in Control.Monad.Trans.Resource.Internal Methods throwError :: e -> ResourceT m a Source # catchError :: ResourceT m a -> (e -> ResourceT m a) -> ResourceT m a Source # | |||||
| MonadReader r m => MonadReader r (ResourceT m) | |||||
| MonadState s m => MonadState s (ResourceT m) | |||||
| MonadWriter w m => MonadWriter w (ResourceT m) | |||||
| MonadIO m => MonadIO (ResourceT m) | |||||
| MonadCatch m => MonadCatch (ResourceT m) | |||||
Defined in Control.Monad.Trans.Resource.Internal | |||||
| MonadMask m => MonadMask (ResourceT m) | |||||
Defined in Control.Monad.Trans.Resource.Internal Methods mask :: HasCallStack => ((forall a. ResourceT m a -> ResourceT m a) -> ResourceT m b) -> ResourceT m b Source # uninterruptibleMask :: HasCallStack => ((forall a. ResourceT m a -> ResourceT m a) -> ResourceT m b) -> ResourceT m b Source # generalBracket :: HasCallStack => ResourceT m a -> (a -> ExitCase b -> ResourceT m c) -> (a -> ResourceT m b) -> ResourceT m (b, c) Source # | |||||
| MonadThrow m => MonadThrow (ResourceT m) | |||||
Defined in Control.Monad.Trans.Resource.Internal | |||||
| Alternative m => Alternative (ResourceT m) | |||||
| Applicative m => Applicative (ResourceT m) | |||||
Defined in Control.Monad.Trans.Resource.Internal Methods pure :: a -> ResourceT m a Source # (<*>) :: ResourceT m (a -> b) -> ResourceT m a -> ResourceT m b Source # liftA2 :: (a -> b -> c) -> ResourceT m a -> ResourceT m b -> ResourceT m c Source # (*>) :: ResourceT m a -> ResourceT m b -> ResourceT m b Source # (<*) :: ResourceT m a -> ResourceT m b -> ResourceT m a Source # | |||||
| Functor m => Functor (ResourceT m) | |||||
| Monad m => Monad (ResourceT m) | |||||
| MonadPlus m => MonadPlus (ResourceT m) | |||||
| MonadFail m => MonadFail (ResourceT m) | |||||
| MonadFix m => MonadFix (ResourceT m) | |||||
| MonadCont m => MonadCont (ResourceT m) | |||||
| PrimMonad m => PrimMonad (ResourceT m) | |||||
Defined in Control.Monad.Trans.Resource.Internal Associated Types
| |||||
| MonadIO m => MonadResource (ResourceT m) | |||||
Defined in Control.Monad.Trans.Resource.Internal Methods liftResourceT :: ResourceT IO a -> ResourceT m a | |||||
| MonadUnliftIO m => MonadUnliftIO (ResourceT m) | |||||
Defined in Control.Monad.Trans.Resource.Internal | |||||
| type PrimState (ResourceT m) | |||||
Defined in Control.Monad.Trans.Resource.Internal | |||||
data ReleaseType #
Constructors
| ReleaseEarly | |
| ReleaseNormal | |
| ReleaseExceptionWith SomeException |
Bundled Patterns
| pattern ReleaseException :: ReleaseType |
Instances
| Show ReleaseType | |
Defined in Data.Acquire.Internal | |
await :: forall (m :: Type -> Type) i o. Monad m => ConduitT i o m (Maybe i) Source #
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
awaitForever :: forall (m :: Type -> Type) i o r. Monad m => (i -> ConduitT i o m r) -> ConduitT i o m () Source #
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
yieldM :: Monad m => m o -> ConduitT i o m () Source #
Send a monadic value downstream for the next component to consume.
Since: conduit-1.2.7
leftover :: forall i o (m :: Type -> Type). i -> ConduitT i o m () Source #
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
Arguments
| :: forall (m :: Type -> Type) a i o r. 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:
- It will be prompt. The finalization will be run as early as possible.
- It is exception safe. Due to usage of
resourcet, the finalization will be run in the event of any exceptions.
Since 0.5.0
transPipe :: Monad m => (forall a. m a -> n a) -> ConduitT i o m r -> ConduitT i o n r Source #
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
mapOutput :: forall (m :: Type -> Type) o1 o2 i r. Monad m => (o1 -> o2) -> ConduitT i o1 m r -> ConduitT i o2 m r Source #
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
mapOutputMaybe :: forall (m :: Type -> Type) o1 o2 i r. Monad m => (o1 -> Maybe o2) -> ConduitT i o1 m r -> ConduitT i o2 m r Source #
Same as mapOutput, but use a function that returns Maybe values.
Since 0.5.0
Arguments
| :: forall (m :: Type -> Type) i1 i2 o r. 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
newtype ZipConduit i o (m :: Type -> Type) r Source #
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
| Monad m => Applicative (ZipConduit i o m) | |
Defined in Data.Conduit.Internal.Conduit Methods pure :: a -> ZipConduit i o m a Source # (<*>) :: ZipConduit i o m (a -> b) -> ZipConduit i o m a -> ZipConduit i o m b Source # liftA2 :: (a -> b -> c) -> ZipConduit i o m a -> ZipConduit i o m b -> ZipConduit i o m c Source # (*>) :: ZipConduit i o m a -> ZipConduit i o m b -> ZipConduit i o m b Source # (<*) :: ZipConduit i o m a -> ZipConduit i o m b -> ZipConduit i o m a Source # | |
| Functor (ZipConduit i o m) | |
Defined in Data.Conduit.Internal.Conduit Methods fmap :: (a -> b) -> ZipConduit i o m a -> ZipConduit i o m b Source # (<$) :: a -> ZipConduit i o m b -> ZipConduit i o m a Source # | |
newtype ZipSink i (m :: Type -> Type) r Source #
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)
=> [ConduitT i Void m r] -> ConduitT i Void 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 => Applicative (ZipSink i m) | |
Defined in Data.Conduit.Internal.Conduit Methods pure :: a -> ZipSink i m a Source # (<*>) :: ZipSink i m (a -> b) -> ZipSink i m a -> ZipSink i m b Source # liftA2 :: (a -> b -> c) -> ZipSink i m a -> ZipSink i m b -> ZipSink i m c Source # (*>) :: ZipSink i m a -> ZipSink i m b -> ZipSink i m b Source # (<*) :: ZipSink i m a -> ZipSink i m b -> ZipSink i m a Source # | |
| Monad m => Functor (ZipSink i m) | |
newtype ZipSource (m :: Type -> Type) o Source #
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 => Applicative (ZipSource m) | |
Defined in Data.Conduit.Internal.Conduit Methods pure :: a -> ZipSource m a Source # (<*>) :: ZipSource m (a -> b) -> ZipSource m a -> ZipSource m b Source # liftA2 :: (a -> b -> c) -> ZipSource m a -> ZipSource m b -> ZipSource m c Source # (*>) :: ZipSource m a -> ZipSource m b -> ZipSource m b Source # (<*) :: ZipSource m a -> ZipSource m b -> ZipSource m a Source # | |
| Monad m => Functor (ZipSource m) | |
type Consumer i (m :: Type -> Type) r = forall o. ConduitT i o m r Source #
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 Sink i = ConduitT i Void Source #
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 Producer (m :: Type -> Type) o = forall i. ConduitT i o m () Source #
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 Source (m :: Type -> Type) o = ConduitT () o m () Source #
Provides a stream of output values, without consuming any input or producing a final result.
Since 0.5.0
data SealedConduitT i o (m :: Type -> Type) r Source #
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
data ConduitT i o (m :: Type -> Type) r Source #
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) | |||||
Defined in Data.Conduit.Internal.Conduit | |||||
| MonadError e m => MonadError e (ConduitT i o m) | |||||
Defined in Data.Conduit.Internal.Conduit Methods throwError :: e -> ConduitT i o m a Source # catchError :: ConduitT i o m a -> (e -> ConduitT i o m a) -> ConduitT i o m a Source # | |||||
| MonadReader r m => MonadReader r (ConduitT i o m) | |||||
| MonadState s m => MonadState s (ConduitT i o m) | |||||
| MonadWriter w m => MonadWriter w (ConduitT i o m) | |||||
| MonadTrans (ConduitT i o) | |||||
| MonadIO m => MonadIO (ConduitT i o m) | |||||
| MonadThrow m => MonadThrow (ConduitT i o m) | |||||
Defined in Data.Conduit.Internal.Conduit | |||||
| Applicative (ConduitT i o m) | |||||
Defined in Data.Conduit.Internal.Conduit Methods pure :: a -> ConduitT i o m a Source # (<*>) :: ConduitT i o m (a -> b) -> ConduitT i o m a -> ConduitT i o m b Source # liftA2 :: (a -> b -> c) -> ConduitT i o m a -> ConduitT i o m b -> ConduitT i o m c Source # (*>) :: ConduitT i o m a -> ConduitT i o m b -> ConduitT i o m b Source # (<*) :: ConduitT i o m a -> ConduitT i o m b -> ConduitT i o m a Source # | |||||
| Functor (ConduitT i o m) | |||||
| Monad (ConduitT i o m) | |||||
| MonadFail m => MonadFail (ConduitT i o m) | Since: conduit-1.3.1 | ||||
| PrimMonad m => PrimMonad (ConduitT i o m) | |||||
Defined in Data.Conduit.Internal.Conduit Associated Types
| |||||
| MonadResource m => MonadResource (ConduitT i o m) | |||||
Defined in Data.Conduit.Internal.Conduit Methods liftResourceT :: ResourceT IO a -> ConduitT i o m a | |||||
| Monad m => Monoid (ConduitT i o m ()) | |||||
| Monad m => Semigroup (ConduitT i o m ()) | |||||
| type PrimState (ConduitT i o m) | |||||
Defined in Data.Conduit.Internal.Conduit | |||||
sealConduitT :: forall i o (m :: Type -> Type) r. ConduitT i o m r -> SealedConduitT i o m r Source #
unsealConduitT :: forall (m :: Type -> Type) i o r. Monad m => SealedConduitT i o m r -> ConduitT i o m r Source #
toProducer :: forall (m :: Type -> Type) a i. Monad m => ConduitT () a m () -> ConduitT i a m () Source #
toConsumer :: forall (m :: Type -> Type) a b o. Monad m => ConduitT a Void m b -> ConduitT a o m b Source #
catchC :: forall (m :: Type -> Type) e i o r. (MonadUnliftIO m, Exception e) => ConduitT i o m r -> (e -> ConduitT i o m r) -> ConduitT i o m r Source #
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
handleC :: forall (m :: Type -> Type) e i o r. (MonadUnliftIO m, Exception e) => (e -> ConduitT i o m r) -> ConduitT i o m r -> ConduitT i o m r Source #
The same as flip catchC.
Since 1.0.11
tryC :: forall (m :: Type -> Type) e i o r. (MonadUnliftIO m, Exception e) => ConduitT i o m r -> ConduitT i o m (Either e r) Source #
A version of try for use within a pipeline. See the comments in catchC
for more details.
Since 1.0.11
fuseReturnLeftovers :: forall (m :: Type -> Type) a b c r. Monad m => ConduitT a b m () -> ConduitT b c m r -> ConduitT a c m (r, [b]) Source #
Same as normal fusion (e.g. =$=), except instead of discarding leftovers
from the downstream component, return them.
Since 1.0.17
fuseLeftovers :: forall (m :: Type -> Type) b a c r. Monad m => ([b] -> [a]) -> ConduitT a b m () -> ConduitT b c m r -> ConduitT a c m r Source #
Similar to fuseReturnLeftovers, but use the provided function to convert
downstream leftovers to upstream leftovers.
Since 1.0.17
mergeSource :: forall (m :: Type -> Type) i a. Monad m => ConduitT () i m () -> ConduitT a (i, a) m () Source #
Merge a Source into a Conduit.
The new conduit will stop processing once either source or upstream have been exhausted.
Turn a Sink into a Conduit in the following way:
- All input passed to the
Sinkis yielded downstream. - When the
Sinkfinishes 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
sourceToList :: Monad m => ConduitT () a m () -> m [a] Source #
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 lazy as the
underlying monad.
Since 1.2.6
connect :: Monad m => ConduitT () a m () -> ConduitT a Void m r -> m r Source #
Equivalent to using runConduit and .| together.
Since 1.2.3
fuse :: forall (m :: Type -> Type) a b c r. Monad m => ConduitT a b m () -> ConduitT b c m r -> ConduitT a c m r Source #
Arguments
| :: forall (m :: Type -> Type) a b c r. Monad m | |
| => ConduitT a b m () | upstream |
| -> ConduitT b c m r | downstream |
| -> ConduitT 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
ConduitTdo not match. We would need to changeConduitT i o m rtoConduitT r m i o, which would preclude aMonadorMonadTransinstance. - 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
Pipedatatype, but this is not generally recommended. See https://stackoverflow.com/a/15263700.
Since: conduit-1.2.8
($$) :: Monad m => Source m a -> Sink a m b -> m b infixr 0 Source #
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
($=) :: forall (m :: Type -> Type) a b c r. Monad m => Conduit a m b -> ConduitT b c m r -> ConduitT a c m r infixl 1 Source #
A synonym for =$= for backwards compatibility.
Since 0.4.0
(=$) :: forall (m :: Type -> Type) a b c r. Monad m => Conduit a m b -> ConduitT b c m r -> ConduitT a c m r infixr 2 Source #
A synonym for =$= for backwards compatibility.
Since 0.4.0
(=$=) :: forall (m :: Type -> Type) a b c r. Monad m => Conduit a m b -> ConduitT b c m r -> ConduitT a c m r infixr 2 Source #
Deprecated fusion operator.
Since 0.4.0
runConduit :: Monad m => ConduitT () Void m r -> m r Source #
Run a pipeline until processing completes.
Since 1.2.1
Arguments
| :: Monad m | |
| => (i1 -> m i2) | map initial input to new input |
| -> (i2 -> m (Maybe i1)) | map new leftovers to initial leftovers |
| -> ConduitT i2 o m r | |
| -> ConduitT i1 o m r |
Apply a monadic action to all the input values of a ConduitT.
Since 1.3.2
($$+) :: Monad m => ConduitT () a m () -> ConduitT a Void m b -> m (SealedConduitT () a m (), b) infixr 0 Source #
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
($$++) :: Monad m => SealedConduitT () a m () -> ConduitT a Void m b -> m (SealedConduitT () a m (), b) infixr 0 Source #
Continue processing after usage of $$+.
Since 0.5.0
($$+-) :: Monad m => SealedConduitT () a m () -> ConduitT a Void m b -> m b infixr 0 Source #
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
($=+) :: forall (m :: Type -> Type) a b. Monad m => SealedConduitT () a m () -> ConduitT a b m () -> SealedConduitT () b m () infixl 1 Source #
Left fusion for a sealed source.
Since 1.0.16
sequenceSources :: forall f (m :: Type -> Type) o. (Traversable f, Monad m) => f (ConduitT () o m ()) -> ConduitT () (f o) m () Source #
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
sequenceSinks :: forall f (m :: Type -> Type) i r. (Traversable f, Monad m) => f (ConduitT i Void m r) -> ConduitT i Void m (f r) Source #
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
(=$$+) :: forall (m :: Type -> Type) a b r. Monad m => ConduitT a b m () -> ConduitT b Void m r -> ConduitT a Void m (SealedConduitT a b m (), r) infixr 0 Source #
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
(=$$++) :: forall (m :: Type -> Type) i o r. Monad m => SealedConduitT i o m () -> ConduitT o Void m r -> ConduitT i Void m (SealedConduitT i o m (), r) infixr 0 Source #
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
(=$$+-) :: forall (m :: Type -> Type) i o r. Monad m => SealedConduitT i o m () -> ConduitT o Void m r -> ConduitT i Void m r infixr 0 Source #
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
sequenceConduits :: forall f (m :: Type -> Type) i o r. (Traversable f, Monad m) => f (ConduitT i o m r) -> ConduitT i o m (f r) Source #
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
fuseBoth :: forall (m :: Type -> Type) a b r1 c r2. Monad m => ConduitT a b m r1 -> ConduitT b c m r2 -> ConduitT a c m (r1, r2) Source #
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
fuseBothMaybe :: forall (m :: Type -> Type) a b r1 c r2. Monad m => ConduitT a b m r1 -> ConduitT b c m r2 -> ConduitT a c m (Maybe r1, r2) Source #
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
fuseUpstream :: forall (m :: Type -> Type) a b r c. Monad m => ConduitT a b m r -> ConduitT b c m () -> ConduitT a c m r Source #
Same as fuseBoth, but ignore the return value from the downstream
Conduit. Same caveats of forced consumption apply.
Since 1.1.5
runConduitPure :: ConduitT () Void Identity r -> r Source #
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
runConduitRes :: MonadUnliftIO m => ConduitT () Void (ResourceT m) r -> m r Source #
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
mapAccumS :: forall (m :: Type -> Type) a s b. Monad m => (a -> s -> ConduitT b Void m s) -> s -> ConduitT () b m () -> ConduitT a Void m s Source #
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]]
exceptC :: forall (m :: Type -> Type) i o e a. Monad m => ConduitT i o m (Either e a) -> ConduitT i o (ExceptT e m) a Source #
Wrap the base monad in ExceptT
Since 1.2.12
runExceptC :: forall (m :: Type -> Type) i o e r. Monad m => ConduitT i o (ExceptT e m) r -> ConduitT i o m (Either e r) Source #
Run ExceptT in the base monad
Since 1.2.12
catchExceptC :: forall (m :: Type -> Type) i o e r. Monad m => ConduitT i o (ExceptT e m) r -> (e -> ConduitT i o (ExceptT e m) r) -> ConduitT i o (ExceptT e m) r Source #
Catch an error in the base monad
Since 1.2.12
runCatchC :: forall (m :: Type -> Type) i o r. Monad m => ConduitT i o (CatchT m) r -> ConduitT i o m (Either SomeException r) Source #
Run CatchT in the base monad
Since 1.1.0
catchCatchC :: forall (m :: Type -> Type) i o r. Monad m => ConduitT i o (CatchT m) r -> (SomeException -> ConduitT i o (CatchT m) r) -> ConduitT i o (CatchT m) r Source #
Catch an exception in the base monad
Since 1.1.0
maybeC :: forall (m :: Type -> Type) i o a. Monad m => ConduitT i o m (Maybe a) -> ConduitT i o (MaybeT m) a Source #
Wrap the base monad in MaybeT
Since 1.0.11
runMaybeC :: forall (m :: Type -> Type) i o r. Monad m => ConduitT i o (MaybeT m) r -> ConduitT i o m (Maybe r) Source #
Run MaybeT in the base monad
Since 1.0.11
readerC :: forall (m :: Type -> Type) r i o a. Monad m => (r -> ConduitT i o m a) -> ConduitT i o (ReaderT r m) a Source #
Wrap the base monad in ReaderT
Since 1.0.11
runReaderC :: forall (m :: Type -> Type) r i o res. Monad m => r -> ConduitT i o (ReaderT r m) res -> ConduitT i o m res Source #
Run ReaderT in the base monad
Since 1.0.11
stateLC :: forall (m :: Type -> Type) s i o a. Monad m => (s -> ConduitT i o m (a, s)) -> ConduitT i o (StateT s m) a Source #
Wrap the base monad in StateT
Since 1.0.11
runStateLC :: forall (m :: Type -> Type) s i o r. Monad m => s -> ConduitT i o (StateT s m) r -> ConduitT i o m (r, s) Source #
Run StateT in the base monad
Since 1.0.11
evalStateLC :: forall (m :: Type -> Type) s i o r. Monad m => s -> ConduitT i o (StateT s m) r -> ConduitT i o m r Source #
Evaluate StateT in the base monad
Since 1.0.11
execStateLC :: forall (m :: Type -> Type) s i o r. Monad m => s -> ConduitT i o (StateT s m) r -> ConduitT i o m s Source #
Execute StateT in the base monad
Since 1.0.11
stateC :: forall (m :: Type -> Type) s i o a. Monad m => (s -> ConduitT i o m (a, s)) -> ConduitT i o (StateT s m) a Source #
Wrap the base monad in StateT
Since 1.0.11
runStateC :: forall (m :: Type -> Type) s i o r. Monad m => s -> ConduitT i o (StateT s m) r -> ConduitT i o m (r, s) Source #
Run StateT in the base monad
Since 1.0.11
evalStateC :: forall (m :: Type -> Type) s i o r. Monad m => s -> ConduitT i o (StateT s m) r -> ConduitT i o m r Source #
Evaluate StateT in the base monad
Since 1.0.11
execStateC :: forall (m :: Type -> Type) s i o r. Monad m => s -> ConduitT i o (StateT s m) r -> ConduitT i o m s Source #
Execute StateT in the base monad
Since 1.0.11
writerLC :: forall (m :: Type -> Type) w i o b. (Monad m, Monoid w) => ConduitT i o m (b, w) -> ConduitT i o (WriterT w m) b Source #
Wrap the base monad in WriterT
Since 1.0.11
runWriterLC :: forall (m :: Type -> Type) w i o r. (Monad m, Monoid w) => ConduitT i o (WriterT w m) r -> ConduitT i o m (r, w) Source #
Run WriterT in the base monad
Since 1.0.11
execWriterLC :: forall (m :: Type -> Type) w i o r. (Monad m, Monoid w) => ConduitT i o (WriterT w m) r -> ConduitT i o m w Source #
Execute WriterT in the base monad
Since 1.0.11
writerC :: forall (m :: Type -> Type) w i o b. (Monad m, Monoid w) => ConduitT i o m (b, w) -> ConduitT i o (WriterT w m) b Source #
Wrap the base monad in WriterT
Since 1.0.11
runWriterC :: forall (m :: Type -> Type) w i o r. (Monad m, Monoid w) => ConduitT i o (WriterT w m) r -> ConduitT i o m (r, w) Source #
Run WriterT in the base monad
Since 1.0.11
execWriterC :: forall (m :: Type -> Type) w i o r. (Monad m, Monoid w) => ConduitT i o (WriterT w m) r -> ConduitT i o m w Source #
Execute WriterT in the base monad
Since 1.0.11
rwsLC :: forall (m :: Type -> Type) w r s i o a. (Monad m, Monoid w) => (r -> s -> ConduitT i o m (a, s, w)) -> ConduitT i o (RWST r w s m) a Source #
Wrap the base monad in RWST
Since 1.0.11
runRWSLC :: forall (m :: Type -> Type) w r s i o res. (Monad m, Monoid w) => r -> s -> ConduitT i o (RWST r w s m) res -> ConduitT i o m (res, s, w) Source #
Run RWST in the base monad
Since 1.0.11
evalRWSLC :: forall (m :: Type -> Type) w r s i o res. (Monad m, Monoid w) => r -> s -> ConduitT i o (RWST r w s m) res -> ConduitT i o m (res, w) Source #
Evaluate RWST in the base monad
Since 1.0.11
execRWSLC :: forall (m :: Type -> Type) w r s i o res. (Monad m, Monoid w) => r -> s -> ConduitT i o (RWST r w s m) res -> ConduitT i o m (s, w) Source #
Execute RWST in the base monad
Since 1.0.11
rwsC :: forall (m :: Type -> Type) w r s i o a. (Monad m, Monoid w) => (r -> s -> ConduitT i o m (a, s, w)) -> ConduitT i o (RWST r w s m) a Source #
Wrap the base monad in RWST
Since 1.0.11
runRWSC :: forall (m :: Type -> Type) w r s i o res. (Monad m, Monoid w) => r -> s -> ConduitT i o (RWST r w s m) res -> ConduitT i o m (res, s, w) Source #
Run RWST in the base monad
Since 1.0.11
evalRWSC :: forall (m :: Type -> Type) w r s i o res. (Monad m, Monoid w) => r -> s -> ConduitT i o (RWST r w s m) res -> ConduitT i o m (res, w) Source #
Evaluate RWST in the base monad
Since 1.0.11
execRWSC :: forall (m :: Type -> Type) w r s i o res. (Monad m, Monoid w) => r -> s -> ConduitT i o (RWST r w s m) res -> ConduitT i o m (s, w) Source #
Execute RWST in the base monad
Since 1.0.11
sinkNull :: forall (m :: Type -> Type) a o. Monad m => ConduitT a o m () Source #
Consume and discard all remaining values in the stream.
Subject to fusion
Since: conduit-1.3.0
type BufferAllocStrategy = (IO Buffer, Int -> Buffer -> IO (IO Buffer)) Source #
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
yieldMany :: forall (m :: Type -> Type) mono i. (Monad m, MonoFoldable mono) => mono -> ConduitT i (Element mono) m () Source #
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
sourceLazy :: forall (m :: Type -> Type) lazy strict i. (Monad m, LazySequence lazy strict) => lazy -> ConduitT i strict m () Source #
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
sourceHandle :: forall (m :: Type -> Type) i. MonadIO m => Handle -> ConduitT i ByteString m () Source #
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
sourceHandleUnsafe :: forall (m :: Type -> Type) i. MonadIO m => Handle -> ConduitT i ByteString m () Source #
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
sourceIOHandle :: forall (m :: Type -> Type) i. MonadResource m => IO Handle -> ConduitT i ByteString m () Source #
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
sourceFileBS :: forall (m :: Type -> Type) i. MonadResource m => FilePath -> ConduitT i ByteString m () Source #
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
sinkFile :: forall (m :: Type -> Type) o. MonadResource m => FilePath -> ConduitT ByteString o m () Source #
Stream all incoming data to the given file.
Since: conduit-1.3.0
sinkFileCautious :: forall (m :: Type -> Type) o. MonadResource m => FilePath -> ConduitM ByteString o m () Source #
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
withSinkFileCautious :: forall m (n :: Type -> Type) o a. (MonadUnliftIO m, MonadIO n) => FilePath -> (ConduitM ByteString o n () -> m a) -> m a Source #
Like sinkFileCautious, but uses the with pattern instead of
MonadResource.
Since: conduit-1.3.0
Arguments
| :: forall (m :: Type -> Type) o. 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
Arguments
| :: forall (m :: Type -> Type) o. 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
sinkHandle :: forall (m :: Type -> Type) o. MonadIO m => Handle -> ConduitT ByteString o m () Source #
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
sinkHandleBuilder :: forall (m :: Type -> Type) o. MonadIO m => Handle -> ConduitM Builder o m () Source #
sinkHandleFlush :: forall (m :: Type -> Type) o. MonadIO m => Handle -> ConduitM (Flush ByteString) o m () Source #
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
sinkIOHandle :: forall (m :: Type -> Type) o. MonadResource m => IO Handle -> ConduitT ByteString o m () Source #
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
withSourceFile :: forall m (n :: Type -> Type) i a. (MonadUnliftIO m, MonadIO n) => FilePath -> (ConduitM i ByteString n () -> m a) -> m a Source #
Like withBinaryFile, but provides a source to read bytes from.
Since: conduit-1.3.0
withSinkFile :: forall m (n :: Type -> Type) o a. (MonadUnliftIO m, MonadIO n) => FilePath -> (ConduitM ByteString o n () -> m a) -> m a Source #
Like withBinaryFile, but provides a sink to write bytes to.
Since: conduit-1.3.0
withSinkFileBuilder :: forall m (n :: Type -> Type) o a. (MonadUnliftIO m, MonadIO n) => FilePath -> (ConduitM Builder o n () -> m a) -> m a Source #
Same as withSinkFile, but lets you use a Builder.
Since: conduit-1.3.0
sourceDirectory :: forall (m :: Type -> Type) i. MonadResource m => FilePath -> ConduitT i FilePath m () Source #
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
Arguments
| :: forall (m :: Type -> Type) i. 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
sinkLazy :: forall (m :: Type -> Type) lazy strict o. (Monad m, LazySequence lazy strict) => ConduitT strict o m lazy Source #
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
sinkList :: forall (m :: Type -> Type) a o. Monad m => ConduitT a o m [a] Source #
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
sinkVector :: forall v a (m :: Type -> Type) o. (Vector v a, PrimMonad m) => ConduitT a o m (v a) Source #
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
Arguments
| :: forall v a (m :: Type -> Type) o. (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
sinkLazyBuilder :: forall (m :: Type -> Type) o. Monad m => ConduitT Builder o m ByteString Source #
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
awaitNonNull :: forall (m :: Type -> Type) a o. (Monad m, MonoFoldable a) => ConduitT a o m (Maybe (NonNull a)) Source #
Same as await, but discards any leading onull values.
Since: conduit-1.3.0
sinkFileBS :: forall (m :: Type -> Type) o. MonadResource m => FilePath -> ConduitT ByteString o m () Source #
sinkFile specialized to ByteString to help with type
inference.
Since: conduit-1.3.0
Arguments
| :: forall v a (m :: Type -> Type). (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
builderToByteString :: forall (m :: Type -> Type). PrimMonad m => ConduitT Builder ByteString m () Source #
Incrementally execute builders and pass on the filled chunks as bytestrings.
Since: conduit-1.3.0
builderToByteStringFlush :: forall (m :: Type -> Type). PrimMonad m => ConduitT (Flush Builder) (Flush ByteString) m () Source #
Same as builderToByteString, but input and output are wrapped in
Flush.
Since: conduit-1.3.0
unsafeBuilderToByteString :: forall (m :: Type -> Type). PrimMonad m => ConduitT Builder ByteString m () Source #
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
builderToByteStringWith :: forall (m :: Type -> Type). PrimMonad m => BufferAllocStrategy -> ConduitT Builder ByteString m () Source #
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
builderToByteStringWithFlush :: forall (m :: Type -> Type). PrimMonad m => BufferAllocStrategy -> ConduitT (Flush Builder) (Flush ByteString) m () Source #
Since: conduit-1.3.0
allNewBuffersStrategy :: Int -> BufferAllocStrategy Source #
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
reuseBufferStrategy :: IO Buffer -> BufferAllocStrategy Source #
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
peekForever :: forall (m :: Type -> Type) i o. Monad m => ConduitT i o m () -> ConduitT i o m () Source #
Run a consuming conduit repeatedly, only stopping when there is no more data available from upstream.
Since: conduit-1.3.0
peekForeverE :: forall (m :: Type -> Type) i o. (Monad m, MonoFoldable i) => ConduitT i o m () -> ConduitT i o m () Source #
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
unfoldC :: forall (m :: Type -> Type) b a i. Monad m => (b -> Maybe (a, b)) -> b -> ConduitT i a m () Source #
Generate a producer from a seed value.
Since: conduit-1.3.0
enumFromToC :: forall (m :: Type -> Type) a i. (Monad m, Enum a, Ord a) => a -> a -> ConduitT i a m () Source #
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
iterateC :: forall (m :: Type -> Type) a i. Monad m => (a -> a) -> a -> ConduitT i a m () Source #
Produces an infinite stream of repeated applications of f to x.
Since: conduit-1.3.0
repeatC :: forall (m :: Type -> Type) a i. Monad m => a -> ConduitT i a m () Source #
Produce an infinite stream consisting entirely of the given value.
Since: conduit-1.3.0
replicateC :: forall (m :: Type -> Type) a i. Monad m => Int -> a -> ConduitT i a m () Source #
Produce a finite stream consisting of n copies of the given value.
Since: conduit-1.3.0
repeatMC :: Monad m => m a -> ConduitT i a m () Source #
Repeatedly run the given action and yield all values it produces.
Since: conduit-1.3.0
repeatWhileMC :: Monad m => m a -> (a -> Bool) -> ConduitT i a m () Source #
Repeatedly run the given action and yield all values it produces, until
the provided predicate returns False.
Since: conduit-1.3.0
replicateMC :: Monad m => Int -> m a -> ConduitT i a m () Source #
Perform the given action n times, yielding each result.
Since: conduit-1.3.0
stdinC :: forall (m :: Type -> Type) i. MonadIO m => ConduitT i ByteString m () Source #
sourceHandle applied to stdin.
Since: conduit-1.3.0
dropC :: forall (m :: Type -> Type) a o. Monad m => Int -> ConduitT a o m () Source #
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
dropCE :: forall (m :: Type -> Type) seq o. (Monad m, IsSequence seq) => Index seq -> ConduitT seq o m () Source #
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
dropWhileC :: forall (m :: Type -> Type) a o. Monad m => (a -> Bool) -> ConduitT a o m () Source #
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
dropWhileCE :: forall (m :: Type -> Type) seq o. (Monad m, IsSequence seq) => (Element seq -> Bool) -> ConduitT seq o m () Source #
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
foldC :: forall (m :: Type -> Type) a o. (Monad m, Monoid a) => ConduitT a o m a Source #
Monoidally combine all values in the stream.
Since: conduit-1.3.0
foldCE :: forall (m :: Type -> Type) mono o. (Monad m, MonoFoldable mono, Monoid (Element mono)) => ConduitT mono o m (Element mono) Source #
Monoidally combine all elements in the chunked stream.
Since: conduit-1.3.0
foldlC :: forall (m :: Type -> Type) a b o. Monad m => (a -> b -> a) -> a -> ConduitT b o m a Source #
A strict left fold.
Since: conduit-1.3.0
foldlCE :: forall (m :: Type -> Type) mono a o. (Monad m, MonoFoldable mono) => (a -> Element mono -> a) -> a -> ConduitT mono o m a Source #
A strict left fold on a chunked stream.
Since: conduit-1.3.0
foldMapC :: forall (m :: Type -> Type) b a o. (Monad m, Monoid b) => (a -> b) -> ConduitT a o m b Source #
Apply the provided mapping function and monoidal combine all values.
Since: conduit-1.3.0
foldMapCE :: forall (m :: Type -> Type) mono w o. (Monad m, MonoFoldable mono, Monoid w) => (Element mono -> w) -> ConduitT mono o m w Source #
Apply the provided mapping function and monoidal combine all elements of the chunked stream.
Since: conduit-1.3.0
allC :: forall (m :: Type -> Type) a o. Monad m => (a -> Bool) -> ConduitT a o m Bool Source #
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
allCE :: forall (m :: Type -> Type) mono o. (Monad m, MonoFoldable mono) => (Element mono -> Bool) -> ConduitT mono o m Bool Source #
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
anyC :: forall (m :: Type -> Type) a o. Monad m => (a -> Bool) -> ConduitT a o m Bool Source #
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
anyCE :: forall (m :: Type -> Type) mono o. (Monad m, MonoFoldable mono) => (Element mono -> Bool) -> ConduitT mono o m Bool Source #
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
andC :: forall (m :: Type -> Type) o. Monad m => ConduitT Bool o m Bool Source #
Are all values in the stream True?
Consumption stops once the first False is encountered.
Since: conduit-1.3.0
andCE :: forall (m :: Type -> Type) mono o. (Monad m, MonoFoldable mono, Element mono ~ Bool) => ConduitT mono o m Bool Source #
Are all elements in the chunked stream True?
Consumption stops once the first False is encountered.
Since: conduit-1.3.0
orC :: forall (m :: Type -> Type) o. Monad m => ConduitT Bool o m Bool Source #
Are any values in the stream True?
Consumption stops once the first True is encountered.
Since: conduit-1.3.0
orCE :: forall (m :: Type -> Type) mono o. (Monad m, MonoFoldable mono, Element mono ~ Bool) => ConduitT mono o m Bool Source #
Are any elements in the chunked stream True?
Consumption stops once the first True is encountered.
Since: conduit-1.3.0
asumC :: forall (m :: Type -> Type) f a o. (Monad m, Alternative f) => ConduitT (f a) o m (f a) Source #
Alternatively combine all values in the stream.
Since: conduit-1.3.0
elemC :: forall (m :: Type -> Type) a o. (Monad m, Eq a) => a -> ConduitT a o m Bool Source #
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
elemCE :: forall (m :: Type -> Type) seq o. (Monad m, IsSequence seq, Eq (Element seq)) => Element seq -> ConduitT seq o m Bool Source #
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
notElemC :: forall (m :: Type -> Type) a o. (Monad m, Eq a) => a -> ConduitT a o m Bool Source #
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
notElemCE :: forall (m :: Type -> Type) seq o. (Monad m, IsSequence seq, Eq (Element seq)) => Element seq -> ConduitT seq o m Bool Source #
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
headC :: forall (m :: Type -> Type) a o. Monad m => ConduitT a o m (Maybe a) Source #
Take a single value from the stream, if available.
Since: conduit-1.3.0
headDefC :: forall (m :: Type -> Type) a o. Monad m => a -> ConduitT a o m a Source #
Same as headC, but returns a default value if none are available from the stream.
Since: conduit-1.3.0
headCE :: forall (m :: Type -> Type) seq o. (Monad m, IsSequence seq) => ConduitT seq o m (Maybe (Element seq)) Source #
Get the next element in the chunked stream.
Since: conduit-1.3.0
peekC :: forall (m :: Type -> Type) a o. Monad m => ConduitT a o m (Maybe a) Source #
View the next value in the stream without consuming it.
Since: conduit-1.3.0
peekCE :: forall (m :: Type -> Type) mono o. (Monad m, MonoFoldable mono) => ConduitT mono o m (Maybe (Element mono)) Source #
View the next element in the chunked stream without consuming it.
Since: conduit-1.3.0
lastC :: forall (m :: Type -> Type) a o. Monad m => ConduitT a o m (Maybe a) Source #
Retrieve the last value in the stream, if present.
Since: conduit-1.3.0
lastDefC :: forall (m :: Type -> Type) a o. Monad m => a -> ConduitT a o m a Source #
Same as lastC, but returns a default value if none are available from the stream.
Since: conduit-1.3.0
lastCE :: forall (m :: Type -> Type) seq o. (Monad m, IsSequence seq) => ConduitT seq o m (Maybe (Element seq)) Source #
Retrieve the last element in the chunked stream, if present.
Since: conduit-1.3.0
lengthC :: forall (m :: Type -> Type) len a o. (Monad m, Num len) => ConduitT a o m len Source #
Count how many values are in the stream.
Since: conduit-1.3.0
lengthCE :: forall (m :: Type -> Type) len mono o. (Monad m, Num len, MonoFoldable mono) => ConduitT mono o m len Source #
Count how many elements are in the chunked stream.
Since: conduit-1.3.0
lengthIfC :: forall (m :: Type -> Type) len a o. (Monad m, Num len) => (a -> Bool) -> ConduitT a o m len Source #
Count how many values in the stream pass the given predicate.
Since: conduit-1.3.0
lengthIfCE :: forall (m :: Type -> Type) len mono o. (Monad m, Num len, MonoFoldable mono) => (Element mono -> Bool) -> ConduitT mono o m len Source #
Count how many elements in the chunked stream pass the given predicate.
Since: conduit-1.3.0
maximumC :: forall (m :: Type -> Type) a o. (Monad m, Ord a) => ConduitT a o m (Maybe a) Source #
Get the largest value in the stream, if present.
Since: conduit-1.3.0
maximumCE :: forall (m :: Type -> Type) seq o. (Monad m, IsSequence seq, Ord (Element seq)) => ConduitT seq o m (Maybe (Element seq)) Source #
Get the largest element in the chunked stream, if present.
Since: conduit-1.3.0
minimumC :: forall (m :: Type -> Type) a o. (Monad m, Ord a) => ConduitT a o m (Maybe a) Source #
Get the smallest value in the stream, if present.
Since: conduit-1.3.0
minimumCE :: forall (m :: Type -> Type) seq o. (Monad m, IsSequence seq, Ord (Element seq)) => ConduitT seq o m (Maybe (Element seq)) Source #
Get the smallest element in the chunked stream, if present.
Since: conduit-1.3.0
nullC :: forall (m :: Type -> Type) a o. Monad m => ConduitT a o m Bool Source #
True if there are no values in the stream.
This function does not modify the stream.
Since: conduit-1.3.0
nullCE :: forall (m :: Type -> Type) mono o. (Monad m, MonoFoldable mono) => ConduitT mono o m Bool Source #
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
sumC :: forall (m :: Type -> Type) a o. (Monad m, Num a) => ConduitT a o m a Source #
Get the sum of all values in the stream.
Since: conduit-1.3.0
sumCE :: forall (m :: Type -> Type) mono o. (Monad m, MonoFoldable mono, Num (Element mono)) => ConduitT mono o m (Element mono) Source #
Get the sum of all elements in the chunked stream.
Since: conduit-1.3.0
productC :: forall (m :: Type -> Type) a o. (Monad m, Num a) => ConduitT a o m a Source #
Get the product of all values in the stream.
Since: conduit-1.3.0
productCE :: forall (m :: Type -> Type) mono o. (Monad m, MonoFoldable mono, Num (Element mono)) => ConduitT mono o m (Element mono) Source #
Get the product of all elements in the chunked stream.
Since: conduit-1.3.0
findC :: forall (m :: Type -> Type) a o. Monad m => (a -> Bool) -> ConduitT a o m (Maybe a) Source #
Find the first matching value.
Since: conduit-1.3.0
mapM_C :: Monad m => (a -> m ()) -> ConduitT a o m () Source #
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
mapM_CE :: (Monad m, MonoFoldable mono) => (Element mono -> m ()) -> ConduitT mono o m () Source #
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
foldMC :: Monad m => (a -> b -> m a) -> a -> ConduitT b o m a Source #
A monadic strict left fold.
Since: conduit-1.3.0
foldMCE :: (Monad m, MonoFoldable mono) => (a -> Element mono -> m a) -> a -> ConduitT mono o m a Source #
A monadic strict left fold on a chunked stream.
Since: conduit-1.3.0
foldMapMC :: (Monad m, Monoid w) => (a -> m w) -> ConduitT a o m w Source #
Apply the provided monadic mapping function and monoidal combine all values.
Since: conduit-1.3.0
foldMapMCE :: (Monad m, MonoFoldable mono, Monoid w) => (Element mono -> m w) -> ConduitT mono o m w Source #
Apply the provided monadic mapping function and monoidal combine all elements in the chunked stream.
Since: conduit-1.3.0
printC :: forall a (m :: Type -> Type) o. (Show a, MonadIO m) => ConduitT a o m () Source #
Print all incoming values to stdout.
Since: conduit-1.3.0
stdoutC :: forall (m :: Type -> Type) o. MonadIO m => ConduitT ByteString o m () Source #
sinkHandle applied to stdout.
Since: conduit-1.3.0
stderrC :: forall (m :: Type -> Type) o. MonadIO m => ConduitT ByteString o m () Source #
sinkHandle applied to stderr.
Since: conduit-1.3.0
mapC :: forall (m :: Type -> Type) a b. Monad m => (a -> b) -> ConduitT a b m () Source #
Apply a transformation to all values in a stream.
Since: conduit-1.3.0
mapCE :: forall (m :: Type -> Type) f a b. (Monad m, Functor f) => (a -> b) -> ConduitT (f a) (f b) m () Source #
Apply a transformation to all elements in a chunked stream.
Since: conduit-1.3.0
omapCE :: forall (m :: Type -> Type) mono. (Monad m, MonoFunctor mono) => (Element mono -> Element mono) -> ConduitT mono mono m () Source #
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
concatMapC :: forall (m :: Type -> Type) mono a. (Monad m, MonoFoldable mono) => (a -> mono) -> ConduitT a (Element mono) m () Source #
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
concatMapCE :: forall (m :: Type -> Type) mono w. (Monad m, MonoFoldable mono, Monoid w) => (Element mono -> w) -> ConduitT mono w m () Source #
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
takeC :: forall (m :: Type -> Type) a. Monad m => Int -> ConduitT a a m () Source #
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
takeCE :: forall (m :: Type -> Type) seq. (Monad m, IsSequence seq) => Index seq -> ConduitT seq seq m () Source #
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
takeWhileC :: forall (m :: Type -> Type) a. Monad m => (a -> Bool) -> ConduitT a a m () Source #
Stream all values downstream that match the given predicate.
Same caveats regarding downstream termination apply as with take.
Since: conduit-1.3.0
takeWhileCE :: forall (m :: Type -> Type) seq. (Monad m, IsSequence seq) => (Element seq -> Bool) -> ConduitT seq seq m () Source #
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
takeExactlyC :: forall (m :: Type -> Type) a b r. Monad m => Int -> ConduitT a b m r -> ConduitT a b m r Source #
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
takeExactlyCE :: forall (m :: Type -> Type) a b r. (Monad m, IsSequence a) => Index a -> ConduitT a b m r -> ConduitT a b m r Source #
Same as takeExactly, but for chunked streams.
Since: conduit-1.3.0
concatC :: forall (m :: Type -> Type) mono. (Monad m, MonoFoldable mono) => ConduitT mono (Element mono) m () Source #
Flatten out a stream by yielding the values contained in an incoming
MonoFoldable as individually yielded values.
Since: conduit-1.3.0
filterC :: forall (m :: Type -> Type) a. Monad m => (a -> Bool) -> ConduitT a a m () Source #
Keep only values in the stream passing a given predicate.
Since: conduit-1.3.0
filterCE :: forall seq (m :: Type -> Type). (IsSequence seq, Monad m) => (Element seq -> Bool) -> ConduitT seq seq m () Source #
Keep only elements in the chunked stream passing a given predicate.
Since: conduit-1.3.0
mapWhileC :: forall (m :: Type -> Type) a b. Monad m => (a -> Maybe b) -> ConduitT a b m () Source #
Map values as long as the result is Just.
Since: conduit-1.3.0
scanlC :: forall (m :: Type -> Type) a b. Monad m => (a -> b -> a) -> a -> ConduitT b a m () Source #
Analog of scanl for lists.
Since: conduit-1.3.0
mapAccumWhileC :: forall (m :: Type -> Type) a s b. Monad m => (a -> s -> Either s (s, b)) -> s -> ConduitT a b m s Source #
concatMapAccumC :: forall (m :: Type -> Type) a accum b. Monad m => (a -> accum -> (accum, [b])) -> accum -> ConduitT a b m () Source #
concatMap with an accumulator.
Since: conduit-1.3.0
intersperseC :: forall (m :: Type -> Type) a. Monad m => a -> ConduitT a a m () Source #
Insert the given value between each two values in the stream.
Since: conduit-1.3.0
slidingWindowC :: forall (m :: Type -> Type) seq a. (Monad m, IsSequence seq, Element seq ~ a) => Int -> ConduitT a seq m () Source #
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
chunksOfCE :: forall (m :: Type -> Type) seq. (Monad m, IsSequence seq) => Index seq -> ConduitT seq seq m () Source #
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
chunksOfExactlyCE :: forall (m :: Type -> Type) seq. (Monad m, IsSequence seq) => Index seq -> ConduitT seq seq m () Source #
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
mapMC :: Monad m => (a -> m b) -> ConduitT a b m () Source #
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
mapMCE :: (Monad m, Traversable f) => (a -> m b) -> ConduitT (f a) (f b) m () Source #
Apply a monadic transformation to all elements in a chunked stream.
Since: conduit-1.3.0
omapMCE :: (Monad m, MonoTraversable mono) => (Element mono -> m (Element mono)) -> ConduitT mono mono m () Source #
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
concatMapMC :: (Monad m, MonoFoldable mono) => (a -> m mono) -> ConduitT a (Element mono) m () Source #
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
filterMC :: Monad m => (a -> m Bool) -> ConduitT a a m () Source #
Keep only values in the stream passing a given monadic predicate.
Since: conduit-1.3.0
filterMCE :: (Monad m, IsSequence seq) => (Element seq -> m Bool) -> ConduitT seq seq m () Source #
Keep only elements in the chunked stream passing a given monadic predicate.
Since: conduit-1.3.0
iterMC :: Monad m => (a -> m ()) -> ConduitT a a m () Source #
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
scanlMC :: Monad m => (a -> b -> m a) -> a -> ConduitT b a m () Source #
Analog of scanl for lists, monadic.
Since: conduit-1.3.0
mapAccumWhileMC :: Monad m => (a -> s -> m (Either s (s, b))) -> s -> ConduitT a b m s Source #
Monadic mapAccumWhileC.
concatMapAccumMC :: Monad m => (a -> accum -> m (accum, [b])) -> accum -> ConduitT a b m () Source #
concatMapM with an accumulator.
Since: conduit-1.3.0
encodeUtf8C :: forall (m :: Type -> Type) text binary. (Monad m, Utf8 text binary) => ConduitT text binary m () Source #
Encode a stream of text as UTF8.
Since: conduit-1.3.0
decodeUtf8C :: forall (m :: Type -> Type). MonadThrow m => ConduitT ByteString Text m () Source #
Decode a stream of binary data as UTF8.
Since: conduit-1.3.0
decodeUtf8LenientC :: forall (m :: Type -> Type). Monad m => ConduitT ByteString Text m () Source #
Decode a stream of binary data as UTF8, replacing any invalid bytes with the Unicode replacement character.
Since: conduit-1.3.0
lineC :: forall (m :: Type -> Type) seq o r. (Monad m, IsSequence seq, Element seq ~ Char) => ConduitT seq o m r -> ConduitT seq o m r Source #
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
lineAsciiC :: forall (m :: Type -> Type) seq o r. (Monad m, IsSequence seq, Element seq ~ Word8) => ConduitT seq o m r -> ConduitT seq o m r Source #
Same as line, but operates on ASCII/binary data.
Since: conduit-1.3.0
unlinesC :: forall (m :: Type -> Type) seq. (Monad m, IsSequence seq, Element seq ~ Char) => ConduitT seq seq m () Source #
Insert a newline character after each incoming chunk of data.
Since: conduit-1.3.0
unlinesAsciiC :: forall (m :: Type -> Type) seq. (Monad m, IsSequence seq, Element seq ~ Word8) => ConduitT seq seq m () Source #
Same as unlines, but operates on ASCII/binary data.
Since: conduit-1.3.0
linesUnboundedC :: forall (m :: Type -> Type) seq. (Monad m, IsSequence seq, Element seq ~ Char) => ConduitT seq seq m () Source #
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
linesUnboundedAsciiC :: forall (m :: Type -> Type) seq. (Monad m, IsSequence seq, Element seq ~ Word8) => ConduitT seq seq m () Source #
Same as linesUnbounded, but for ASCII/binary data.
Since: conduit-1.3.0
Arguments
| :: forall (m :: Type -> Type) v e n i r. (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
allocateAcquire :: MonadResource m => Acquire a -> m (ReleaseKey, a) #
withAcquire :: MonadUnliftIO m => Acquire a -> (a -> m b) -> m b #
mkAcquireType :: IO a -> (a -> ReleaseType -> IO ()) -> Acquire a #