-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Batteries included conduit: adapters for common libraries.
--   
--   The conduit package itself maintains relative small dependencies. The
--   purpose of this package is to collect commonly used utility functions
--   wrapping other library dependencies, without depending on
--   heavier-weight dependencies. The basic idea is that this package
--   should only depend on haskell-platform packages and conduit.
@package conduit-extra
@version 1.3.8


-- | Consume attoparsec parsers via conduit.
--   
--   This code was taken from attoparsec-enumerator and adapted for
--   conduits.
module Data.Conduit.Attoparsec

-- | Convert an Attoparsec <a>Parser</a> into a <a>Sink</a>. The parser
--   will be streamed bytes until it returns <a>Done</a> or <a>Fail</a>.
--   
--   If parsing fails, a <a>ParseError</a> will be thrown with
--   <a>throwM</a>.
--   
--   Since 0.5.0
sinkParser :: forall a (m :: Type -> Type) b o. (AttoparsecInput a, MonadThrow m) => Parser a b -> ConduitT a o m b

-- | Same as <a>sinkParser</a>, but we return an <a>Either</a> type instead
--   of raising an exception.
--   
--   Since 1.1.5
sinkParserEither :: forall a (m :: Type -> Type) b o. (AttoparsecInput a, Monad m) => Parser a b -> ConduitT a o m (Either ParseError b)

-- | Consume a stream of parsed tokens, returning both the token and the
--   position it appears at. This function will raise a <a>ParseError</a>
--   on bad input.
--   
--   Since 0.5.0
conduitParser :: forall a (m :: Type -> Type) b. (AttoparsecInput a, MonadThrow m) => Parser a b -> ConduitT a (PositionRange, b) m ()

-- | Same as <a>conduitParser</a>, but we return an <a>Either</a> type
--   instead of raising an exception.
conduitParserEither :: forall (m :: Type -> Type) a b. (Monad m, AttoparsecInput a) => Parser a b -> ConduitT a (Either ParseError (PositionRange, b)) m ()

-- | The context and message from a <a>Fail</a> value.
data ParseError
ParseError :: [String] -> String -> Position -> ParseError
[errorContexts] :: ParseError -> [String]
[errorMessage] :: ParseError -> String
[errorPosition] :: ParseError -> Position
DivergentParser :: ParseError
data Position
Position :: {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> Position
[posLine] :: Position -> {-# UNPACK #-} !Int
[posCol] :: Position -> {-# UNPACK #-} !Int

[posOffset] :: Position -> {-# UNPACK #-} !Int
data PositionRange
PositionRange :: {-# UNPACK #-} !Position -> {-# UNPACK #-} !Position -> PositionRange
[posRangeStart] :: PositionRange -> {-# UNPACK #-} !Position
[posRangeEnd] :: PositionRange -> {-# UNPACK #-} !Position

-- | A class of types which may be consumed by an Attoparsec parser.
class AttoparsecInput a
instance Data.Conduit.Attoparsec.AttoparsecInput Data.ByteString.Internal.Type.ByteString
instance Data.Conduit.Attoparsec.AttoparsecInput Data.Text.Internal.Text
instance GHC.Classes.Eq Data.Conduit.Attoparsec.Position
instance GHC.Classes.Eq Data.Conduit.Attoparsec.PositionRange
instance GHC.Internal.Exception.Type.Exception Data.Conduit.Attoparsec.ParseError
instance GHC.Classes.Ord Data.Conduit.Attoparsec.Position
instance GHC.Classes.Ord Data.Conduit.Attoparsec.PositionRange
instance GHC.Internal.Show.Show Data.Conduit.Attoparsec.ParseError
instance GHC.Internal.Show.Show Data.Conduit.Attoparsec.Position
instance GHC.Internal.Show.Show Data.Conduit.Attoparsec.PositionRange


-- | <i>NOTE</i> It is recommended to start using
--   <a>Data.Conduit.Combinators</a> instead of this module.
--   
--   Functions for interacting with bytes.
--   
--   For many purposes, it's recommended to use the conduit-combinators
--   library, which provides a more complete set of functions.
module Data.Conduit.Binary

-- | Stream the contents of a file as binary data.
sourceFile :: forall (m :: Type -> Type) i. MonadResource m => FilePath -> ConduitT i ByteString m ()

-- | Stream the contents of a <a>Handle</a> as binary data. Note that this
--   function will <i>not</i> automatically close the <tt>Handle</tt> when
--   processing completes, since it did not acquire the <tt>Handle</tt> in
--   the first place.
sourceHandle :: forall (m :: Type -> Type) i. MonadIO m => Handle -> ConduitT i ByteString m ()

-- | Same as <tt>sourceHandle</tt>, but instead of allocating a new buffer
--   for each incoming chunk of data, reuses the same buffer. Therefore,
--   the <tt>ByteString</tt>s yielded by this function are not
--   referentially transparent between two different <tt>yield</tt>s.
--   
--   This function will be slightly more efficient than
--   <tt>sourceHandle</tt> by avoiding allocations and reducing garbage
--   collections, but should only be used if you can guarantee that you do
--   not reuse a <tt>ByteString</tt> (or any slice thereof) between two
--   calls to <tt>await</tt>.
sourceHandleUnsafe :: forall (m :: Type -> Type) i. MonadIO m => Handle -> ConduitT i ByteString m ()

-- | An alternative to <a>sourceHandle</a>. Instead of taking a pre-opened
--   <a>Handle</a>, it takes an action that opens a <a>Handle</a> (in read
--   mode), so that it can open it only when needed and close it as soon as
--   possible.
sourceIOHandle :: forall (m :: Type -> Type) i. MonadResource m => IO Handle -> ConduitT i ByteString m ()

-- | Stream the contents of a file as binary data, starting from a certain
--   offset and only consuming up to a certain number of bytes.
--   
--   Since 0.3.0
sourceFileRange :: forall (m :: Type -> Type) i. MonadResource m => FilePath -> Maybe Integer -> Maybe Integer -> ConduitT i ByteString m ()

-- | Stream the contents of a handle as binary data, starting from a
--   certain offset and only consuming up to a certain number of bytes.
--   
--   Since 1.0.8
sourceHandleRange :: forall (m :: Type -> Type) i. MonadIO m => Handle -> Maybe Integer -> Maybe Integer -> ConduitT i ByteString m ()

-- | Stream the contents of a handle as binary data, starting from a
--   certain offset and only consuming up to a certain number of bytes.
--   This function consumes chunks as specified by the buffer size.
--   
--   Since 1.1.8
sourceHandleRangeWithBuffer :: forall (m :: Type -> Type) i. MonadIO m => Handle -> Maybe Integer -> Maybe Integer -> Int -> ConduitT i ByteString m ()

-- | Like <a>withBinaryFile</a>, but provides a source to read bytes from.
withSourceFile :: forall m (n :: Type -> Type) i a. (MonadUnliftIO m, MonadIO n) => FilePath -> (ConduitM i ByteString n () -> m a) -> m a

-- | Stream all incoming data to the given file.
sinkFile :: forall (m :: Type -> Type) o. MonadResource m => FilePath -> ConduitT ByteString o m ()

-- | Cautious version of <a>sinkFile</a>. 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.
sinkFileCautious :: forall (m :: Type -> Type) o. MonadResource m => FilePath -> ConduitM ByteString o m ()

-- | 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
--   <tt>ResourceT</tt> block, if it still exists.
sinkTempFile :: forall (m :: Type -> Type) o. MonadResource m => FilePath -> String -> ConduitM ByteString o m FilePath

-- | Same as <a>sinkTempFile</a>, but will use the default temp file
--   directory for the system as the first argument.
sinkSystemTempFile :: forall (m :: Type -> Type) o. MonadResource m => String -> ConduitM ByteString o m FilePath

-- | Stream all incoming data to the given <a>Handle</a>. Note that this
--   function does <i>not</i> flush and will <i>not</i> close the
--   <tt>Handle</tt> when processing completes.
sinkHandle :: forall (m :: Type -> Type) o. MonadIO m => Handle -> ConduitT ByteString o m ()

-- | An alternative to <a>sinkHandle</a>. Instead of taking a pre-opened
--   <a>Handle</a>, it takes an action that opens a <a>Handle</a> (in write
--   mode), so that it can open it only when needed and close it as soon as
--   possible.
sinkIOHandle :: forall (m :: Type -> Type) o. MonadResource m => IO Handle -> ConduitT ByteString o m ()

-- | Stream incoming builders, executing them directly on the buffer of the
--   given <a>Handle</a>. Note that this function does <i>not</i>
--   automatically close the <tt>Handle</tt> when processing completes.
--   Pass <a>flush</a> to flush the buffer.
sinkHandleBuilder :: forall (m :: Type -> Type) o. MonadIO m => Handle -> ConduitM Builder o m ()

-- | Stream incoming <tt>Flush</tt>es, executing them on <tt>IO.Handle</tt>
--   Note that this function does <i>not</i> automatically close the
--   <tt>Handle</tt> when processing completes
sinkHandleFlush :: forall (m :: Type -> Type) o. MonadIO m => Handle -> ConduitM (Flush ByteString) o m ()

-- | Like <a>withBinaryFile</a>, but provides a sink to write bytes to.
withSinkFile :: forall m (n :: Type -> Type) o a. (MonadUnliftIO m, MonadIO n) => FilePath -> (ConduitM ByteString o n () -> m a) -> m a

-- | Same as <a>withSinkFile</a>, but lets you use a <a>Builder</a>.
withSinkFileBuilder :: forall m (n :: Type -> Type) o a. (MonadUnliftIO m, MonadIO n) => FilePath -> (ConduitM Builder o n () -> m a) -> m a

-- | Like <a>sinkFileCautious</a>, but uses the <tt>with</tt> pattern
--   instead of <tt>MonadResource</tt>.
withSinkFileCautious :: forall m (n :: Type -> Type) o a. (MonadUnliftIO m, MonadIO n) => FilePath -> (ConduitM ByteString o n () -> m a) -> m a

-- | Stream the contents of the input to a file, and also send it along the
--   pipeline. Similar in concept to the Unix command <tt>tee</tt>.
--   
--   Since 0.3.0
conduitFile :: forall (m :: Type -> Type). MonadResource m => FilePath -> ConduitT ByteString ByteString m ()

-- | Stream the contents of the input to a <tt>Handle</tt>, and also send
--   it along the pipeline. Similar in concept to the Unix command
--   <tt>tee</tt>. Like <tt>sourceHandle</tt>, does not close the handle on
--   completion. Related to: <tt>conduitFile</tt>.
--   
--   Since 1.0.9
conduitHandle :: forall (m :: Type -> Type). MonadIO m => Handle -> ConduitT ByteString ByteString m ()

-- | Stream the chunks from a lazy bytestring.
--   
--   Since 0.5.0
sourceLbs :: forall (m :: Type -> Type) i. Monad m => ByteString -> ConduitT i ByteString m ()

-- | Return the next byte from the stream, if available.
--   
--   Since 0.3.0
head :: forall (m :: Type -> Type) o. Monad m => ConduitT ByteString o m (Maybe Word8)

-- | Ignore all bytes while the predicate returns <tt>True</tt>.
--   
--   Since 0.3.0
dropWhile :: forall (m :: Type -> Type) o. Monad m => (Word8 -> Bool) -> ConduitT ByteString o m ()

-- | Take the given number of bytes, if available.
--   
--   Since 0.3.0
take :: forall (m :: Type -> Type) o. Monad m => Int -> ConduitT ByteString o m ByteString

-- | Drop up to the given number of bytes.
--   
--   Since 0.5.0
drop :: forall (m :: Type -> Type) o. Monad m => Int -> ConduitT ByteString o m ()

-- | Stream the input data into a temp file and count the number of bytes
--   present. When complete, return a new <tt>Source</tt> reading from the
--   temp file together with the length of the input in bytes.
--   
--   All resources will be cleaned up automatically.
--   
--   Since 1.0.5
sinkCacheLength :: forall (m1 :: Type -> Type) (m2 :: Type -> Type) o i. (MonadResource m1, MonadResource m2) => ConduitT ByteString o m1 (Word64, ConduitT i ByteString m2 ())

-- | Consume a stream of input into a lazy bytestring. Note that no lazy
--   I/O is performed, but rather all content is read into memory strictly.
--   
--   Since 1.0.5
sinkLbs :: forall (m :: Type -> Type) o. Monad m => ConduitT ByteString o m ByteString

-- | Perform a computation on each <tt>Word8</tt> in a stream.
--   
--   Since 1.0.10
mapM_ :: Monad m => (Word8 -> m ()) -> ConduitT ByteString o m ()

-- | Consume some instance of <tt>Storable</tt> from the incoming byte
--   stream. In the event of insufficient bytes in the stream, returns a
--   <tt>Nothing</tt> and returns all unused input as leftovers.
sinkStorable :: forall (m :: Type -> Type) a o. (Monad m, Storable a) => ConduitT ByteString o m (Maybe a)

-- | Same as <a>sinkStorable</a>, but throws a
--   <a>SinkStorableInsufficientBytes</a> exception (via <a>throwM</a>) in
--   the event of insufficient bytes. This can be more efficient to use
--   than <a>sinkStorable</a> as it avoids the need to
--   construct/deconstruct a <tt>Maybe</tt> wrapper in the success case.
sinkStorableEx :: forall (m :: Type -> Type) a o. (MonadThrow m, Storable a) => ConduitT ByteString o m a

-- | Ensure that only up to the given number of bytes are consumed by the
--   inner sink. Note that this does <i>not</i> ensure that all of those
--   bytes are in fact consumed.
--   
--   Since 0.3.0
isolate :: forall (m :: Type -> Type). Monad m => Int -> ConduitT ByteString ByteString m ()

-- | Return all bytes while the predicate returns <tt>True</tt>.
--   
--   Since 0.3.0
takeWhile :: forall (m :: Type -> Type). Monad m => (Word8 -> Bool) -> ConduitT ByteString ByteString m ()

-- | Split the input bytes into lines. In other words, split on the LF byte
--   (10), and strip it from the output.
--   
--   Since 0.3.0
lines :: forall (m :: Type -> Type). Monad m => ConduitT ByteString ByteString m ()
instance GHC.Internal.Exception.Type.Exception Data.Conduit.Binary.SinkStorableException
instance GHC.Internal.Show.Show Data.Conduit.Binary.SinkStorableException


-- | Convert a stream of blaze-builder <tt>Builder</tt>s into a stream of
--   <tt>ByteString</tt>s.
--   
--   Works with both blaze-builder &lt; 0.4's <tt>Builder</tt>s and
--   <a>Builder</a>.
--   
--   Adapted from blaze-builder-enumerator, written by myself and Simon
--   Meier.
--   
--   Note that the functions here can work in any monad built on top of
--   <tt>IO</tt> or <tt>ST</tt>.
--   
--   Since 1.1.7.0
module Data.Conduit.ByteString.Builder

-- | Incrementally execute builders and pass on the filled chunks as
--   bytestrings.
builderToByteString :: forall (m :: Type -> Type). PrimMonad m => ConduitT Builder ByteString m ()

-- | Incrementally execute builders on the given buffer and pass on the
--   filled chunks as bytestrings. Note that, if the given buffer is too
--   small for the execution of a build step, a larger one will be
--   allocated.
--   
--   WARNING: This conduit yields bytestrings that are NOT referentially
--   transparent. Their content will be overwritten as soon as control is
--   returned from the inner sink!
unsafeBuilderToByteString :: forall (m :: Type -> Type). PrimMonad m => ConduitT Builder ByteString m ()

-- | A conduit that incrementally executes builders and passes on the
--   filled chunks as bytestrings to an inner sink.
--   
--   INV: All bytestrings passed to the inner sink are non-empty.
builderToByteStringWith :: forall (m :: Type -> Type). PrimMonad m => BufferAllocStrategy -> ConduitT Builder ByteString m ()

-- | Same as <a>builderToByteString</a>, but input and output are wrapped
--   in <a>Flush</a>.
builderToByteStringFlush :: forall (m :: Type -> Type). PrimMonad m => ConduitT (Flush Builder) (Flush ByteString) m ()

builderToByteStringWithFlush :: forall (m :: Type -> Type). PrimMonad m => BufferAllocStrategy -> ConduitT (Flush Builder) (Flush ByteString) m ()

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

-- | 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.
allNewBuffersStrategy :: Int -> BufferAllocStrategy

-- | An unsafe, but possibly more efficient buffer allocation strategy:
--   reuse the buffer, if it is big enough for the next build step to
--   execute.
reuseBufferStrategy :: IO Buffer -> BufferAllocStrategy


-- | <i>NOTE</i> It is recommended to start using
--   <a>Data.Conduit.Combinators</a> instead of this module.
module Data.Conduit.Filesystem

-- | Stream the contents of the given directory, without traversing deeply.
--   
--   This function will return <i>all</i> 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 <tt>foo</tt>
--   containing files <tt>bar</tt> and <tt>baz</tt>, and you use
--   <tt>sourceDirectory</tt> on <tt>foo</tt>, the results will be
--   <tt>foo/bar</tt> and <tt>foo/baz</tt>.
sourceDirectory :: forall (m :: Type -> Type) i. MonadResource m => FilePath -> ConduitT i FilePath m ()

-- | Deeply stream the contents of the given directory.
--   
--   This works the same as <tt>sourceDirectory</tt>, but will not return
--   directories at all. This function also takes an extra parameter to
--   indicate whether symlinks will be followed.
sourceDirectoryDeep :: forall (m :: Type -> Type) i. MonadResource m => Bool -> FilePath -> ConduitT i FilePath m ()


-- | Adapter module to work with the <a>foldl</a> package.
module Data.Conduit.Foldl

-- | Convert a left fold into a <a>Consumer</a>. This function is intended
--   to be used with <tt>purely</tt> from the <a>foldl</a> package.
sinkFold :: forall (m :: Type -> Type) x a b o. Monad m => (x -> a -> x) -> x -> (x -> b) -> ConduitT a o m b

-- | Convert a monadic left fold into a <a>Consumer</a>. This function is
--   intended to be used with <tt>impurely</tt> from the <a>foldl</a>
--   package.
sinkFoldM :: Monad m => (x -> a -> m x) -> m x -> (x -> m b) -> ConduitT a o m b


-- | Use lazy I/O for consuming the contents of a source. Warning: All
--   normal warnings of lazy I/O apply. In particular, if you are using
--   this with a <tt>ResourceT</tt> transformer, you must force the list to
--   be evaluated before exiting the <tt>ResourceT</tt>.
module Data.Conduit.Lazy

-- | Use lazy I/O to consume all elements from a <tt>Source</tt>.
--   
--   This function relies on <a>monadActive</a> to determine if the
--   underlying monadic state has been closed.
--   
--   Since 0.3.0
lazyConsume :: (MonadUnliftIO m, MonadActive m) => Source m a -> m [a]

-- | Determine if some monad is still active. This is intended to prevent
--   usage of a monadic state after it has been closed. This is necessary
--   for such cases as lazy I/O, where an unevaluated thunk may still refer
--   to a closed <tt>ResourceT</tt>.
--   
--   Since 0.3.0
class Monad m => MonadActive (m :: Type -> Type)
monadActive :: MonadActive m => m Bool
instance Data.Conduit.Lazy.MonadActive m => Data.Conduit.Lazy.MonadActive (Data.Conduit.Internal.Conduit.ConduitT i o m)
instance Data.Conduit.Lazy.MonadActive GHC.Types.IO
instance Data.Conduit.Lazy.MonadActive GHC.Internal.Data.Functor.Identity.Identity
instance Data.Conduit.Lazy.MonadActive m => Data.Conduit.Lazy.MonadActive (Control.Monad.Trans.Identity.IdentityT m)
instance Data.Conduit.Lazy.MonadActive m => Data.Conduit.Lazy.MonadActive (Control.Monad.Trans.Maybe.MaybeT m)
instance Data.Conduit.Lazy.MonadActive m => Data.Conduit.Lazy.MonadActive (Data.Conduit.Internal.Pipe.Pipe l i o u m)
instance (GHC.Internal.Base.Monoid w, Data.Conduit.Lazy.MonadActive m) => Data.Conduit.Lazy.MonadActive (Control.Monad.Trans.RWS.Strict.RWST r w s m)
instance (GHC.Internal.Base.Monoid w, Data.Conduit.Lazy.MonadActive m) => Data.Conduit.Lazy.MonadActive (Control.Monad.Trans.RWS.Lazy.RWST r w s m)
instance Data.Conduit.Lazy.MonadActive m => Data.Conduit.Lazy.MonadActive (Control.Monad.Trans.Reader.ReaderT r m)
instance (Control.Monad.IO.Class.MonadIO m, Data.Conduit.Lazy.MonadActive m) => Data.Conduit.Lazy.MonadActive (Control.Monad.Trans.Resource.Internal.ResourceT m)
instance Data.Conduit.Lazy.MonadActive (GHC.Internal.Control.Monad.ST.Lazy.Imp.ST s)
instance Data.Conduit.Lazy.MonadActive (GHC.Internal.ST.ST s)
instance Data.Conduit.Lazy.MonadActive m => Data.Conduit.Lazy.MonadActive (Control.Monad.Trans.State.Strict.StateT s m)
instance Data.Conduit.Lazy.MonadActive m => Data.Conduit.Lazy.MonadActive (Control.Monad.Trans.State.Lazy.StateT s m)
instance (GHC.Internal.Base.Monoid w, Data.Conduit.Lazy.MonadActive m) => Data.Conduit.Lazy.MonadActive (Control.Monad.Trans.Writer.Strict.WriterT w m)
instance (GHC.Internal.Base.Monoid w, Data.Conduit.Lazy.MonadActive m) => Data.Conduit.Lazy.MonadActive (Control.Monad.Trans.Writer.Lazy.WriterT w m)

module Data.Conduit.Network

-- | Stream data from the socket.
--   
--   This function does <i>not</i> automatically close the socket.
--   
--   Since 0.0.0
sourceSocket :: forall (m :: Type -> Type) i. MonadIO m => Socket -> ConduitT i ByteString m ()

-- | Stream data to the socket.
--   
--   This function does <i>not</i> automatically close the socket.
--   
--   Since 0.0.0
sinkSocket :: forall (m :: Type -> Type) o. MonadIO m => Socket -> ConduitT ByteString o m ()
data AppData
appSource :: forall ad (m :: Type -> Type) i. (HasReadWrite ad, MonadIO m) => ad -> ConduitT i ByteString m ()
appSink :: forall ad (m :: Type -> Type) o. (HasReadWrite ad, MonadIO m) => ad -> ConduitT ByteString o m ()
appSockAddr :: AppData -> SockAddr
appLocalAddr :: AppData -> Maybe SockAddr
data ServerSettings
serverSettings :: Int -> HostPreference -> ServerSettings
runTCPServer :: ServerSettings -> (AppData -> IO ()) -> IO a
runTCPServerWithHandle :: ServerSettings -> ConnectionHandle -> IO a

-- | Fork a TCP Server
--   
--   Will fork the runGeneralTCPServer function but will only return from
--   this call when the server is bound to the port and accepting incoming
--   connections. Will return the thread id of the server
--   
--   Since 1.1.4
forkTCPServer :: MonadUnliftIO m => ServerSettings -> (AppData -> m ()) -> m ThreadId

-- | Run a general TCP server
--   
--   Same as <a>runTCPServer</a>, except monad can be any instance of
--   <a>MonadUnliftIO</a>.
--   
--   Note that any changes to the monadic state performed by individual
--   client handlers will be discarded. If you have mutable state you want
--   to share among multiple handlers, you need to use some kind of mutable
--   variables.
--   
--   Since 1.1.3
runGeneralTCPServer :: MonadUnliftIO m => ServerSettings -> (AppData -> m ()) -> m a
data ClientSettings
clientSettings :: Int -> ByteString -> ClientSettings
runTCPClient :: ClientSettings -> (AppData -> IO a) -> IO a

-- | Run a general TCP client
--   
--   Same as <a>runTCPClient</a>, except monad can be any instance of
--   <a>MonadUnliftIO</a>.
--   
--   Since 1.1.3
runGeneralTCPClient :: MonadUnliftIO m => ClientSettings -> (AppData -> m a) -> m a
getPort :: HasPort a => a -> Int
getHost :: ClientSettings -> ByteString
getAfterBind :: HasAfterBind a => a -> Socket -> IO ()
getNeedLocalAddr :: ServerSettings -> Bool
setPort :: HasPort a => Int -> a -> a
setHost :: ByteString -> ClientSettings -> ClientSettings
setAfterBind :: HasAfterBind a => (Socket -> IO ()) -> a -> a
setNeedLocalAddr :: Bool -> ServerSettings -> ServerSettings
data HostPreference

module Data.Conduit.Network.UDP
data Message
Message :: {-# UNPACK #-} !ByteString -> !SockAddr -> Message
[msgData] :: Message -> {-# UNPACK #-} !ByteString
[msgSender] :: Message -> !SockAddr

-- | Stream messages from the socket.
--   
--   The given <tt>len</tt> defines the maximum packet size. Every produced
--   item contains the message payload and the origin address.
--   
--   This function does <i>not</i> automatically close the socket.
sourceSocket :: forall (m :: Type -> Type) i. MonadIO m => Socket -> Int -> ConduitT i Message m ()

-- | Stream messages to the connected socket.
--   
--   The payload is sent using <tt>send</tt>, so some of it might be lost.
--   
--   This function does <i>not</i> automatically close the socket.
sinkSocket :: forall (m :: Type -> Type) o. MonadIO m => Socket -> ConduitT ByteString o m ()

-- | Stream messages to the connected socket.
--   
--   The payload is sent using <tt>sendAll</tt>, so it might end up in
--   multiple packets.
--   
--   This function does <i>not</i> automatically close the socket.
sinkAllSocket :: forall (m :: Type -> Type) o. MonadIO m => Socket -> ConduitT ByteString o m ()

-- | Stream messages to the socket.
--   
--   Every handled item contains the message payload and the destination
--   address. The payload is sent using <tt>sendTo</tt>, so some of it
--   might be lost.
--   
--   This function does <i>not</i> automatically close the socket.
sinkToSocket :: forall (m :: Type -> Type) o. MonadIO m => Socket -> ConduitT Message o m ()

-- | Stream messages to the socket.
--   
--   Every handled item contains the message payload and the destination
--   address. The payload is sent using <tt>sendAllTo</tt>, so it might end
--   up in multiple packets.
--   
--   This function does <i>not</i> automatically close the socket.
sinkAllToSocket :: forall (m :: Type -> Type) o. MonadIO m => Socket -> ConduitT Message o m ()
data HostPreference

module Data.Conduit.Network.Unix

-- | Stream data from the socket.
--   
--   This function does <i>not</i> automatically close the socket.
--   
--   Since 0.0.0
sourceSocket :: forall (m :: Type -> Type) i. MonadIO m => Socket -> ConduitT i ByteString m ()

-- | Stream data to the socket.
--   
--   This function does <i>not</i> automatically close the socket.
--   
--   Since 0.0.0
sinkSocket :: forall (m :: Type -> Type) o. MonadIO m => Socket -> ConduitT ByteString o m ()
data AppDataUnix
appSource :: forall ad (m :: Type -> Type) i. (HasReadWrite ad, MonadIO m) => ad -> ConduitT i ByteString m ()
appSink :: forall ad (m :: Type -> Type) o. (HasReadWrite ad, MonadIO m) => ad -> ConduitT ByteString o m ()
data ServerSettingsUnix
serverSettings :: FilePath -> ServerSettingsUnix
runUnixServer :: ServerSettingsUnix -> (AppDataUnix -> IO ()) -> IO a
data ClientSettingsUnix
clientSettings :: FilePath -> ClientSettingsUnix
runUnixClient :: ClientSettingsUnix -> (AppDataUnix -> IO a) -> IO a
getPath :: HasPath a => a -> FilePath
getAfterBind :: HasAfterBind a => a -> Socket -> IO ()
setPath :: HasPath a => FilePath -> a -> a
setAfterBind :: HasAfterBind a => (Socket -> IO ()) -> a -> a


-- | A full tutorial for this module is available at:
--   <a>https://github.com/snoyberg/conduit/blob/master/PROCESS.md</a>.
--   
--   Some utilities in this module require the threaded runtime because
--   they use <a>waitForProcess</a> internally.
--   
--   Note that this is a very thin layer around the
--   <tt>Data.Streaming.Process</tt> module. In particular, it:
--   
--   <ul>
--   <li>Provides orphan instances for conduit</li>
--   <li>Provides some useful helper functions</li>
--   </ul>
module Data.Conduit.Process

-- | Like <tt>sourceProcessWithConsumer</tt> but providing the command to
--   be run as a <tt>String</tt>.
--   
--   Requires the threaded runtime.
--   
--   Since 1.1.2
sourceCmdWithConsumer :: MonadIO m => String -> ConduitT ByteString Void m a -> m (ExitCode, a)

-- | Given a <tt>CreateProcess</tt>, run the process, with its output being
--   used as a <tt>Source</tt> to feed the provided <tt>Consumer</tt>. Once
--   the process has completed, return a tuple of the <tt>ExitCode</tt>
--   from the process and the output collected from the <tt>Consumer</tt>.
--   
--   Note that, if an exception is raised by the consumer, the process is
--   <i>not</i> terminated. This behavior is different from
--   <a>sourceProcessWithStreams</a> due to historical reasons.
--   
--   Requires the threaded runtime.
--   
--   Since 1.1.2
sourceProcessWithConsumer :: MonadIO m => CreateProcess -> ConduitT ByteString Void m a -> m (ExitCode, a)

-- | Like <tt>sourceProcessWithStreams</tt> but providing the command to be
--   run as a <tt>String</tt>.
--   
--   Requires the threaded runtime.
sourceCmdWithStreams :: MonadUnliftIO m => String -> ConduitT () ByteString m () -> ConduitT ByteString Void m a -> ConduitT ByteString Void m b -> m (ExitCode, a, b)

-- | Given a <tt>CreateProcess</tt>, run the process and feed the provided
--   <tt>Producer</tt> to the stdin <tt>Sink</tt> of the process. Use the
--   process outputs (stdout, stderr) as <tt>Source</tt>s and feed it to
--   the provided <tt>Consumer</tt>s. Once the process has completed,
--   return a tuple of the <tt>ExitCode</tt> from the process and the
--   results collected from the <tt>Consumer</tt>s.
--   
--   If an exception is raised by any of the streams, the process is
--   terminated.
--   
--   IO is required because the streams are run concurrently using the
--   <a>async</a> package
--   
--   Requires the threaded runtime.
sourceProcessWithStreams :: MonadUnliftIO m => CreateProcess -> ConduitT () ByteString m () -> ConduitT ByteString Void m a -> ConduitT ByteString Void m b -> m (ExitCode, a, b)

-- | Same as <a>withCheckedProcess</a>, but kills the child process in the
--   case of an exception being thrown by the provided callback function.
--   
--   Requires the threaded runtime.
withCheckedProcessCleanup :: (InputSource stdin, OutputSink stderr, OutputSink stdout, MonadUnliftIO m) => CreateProcess -> (stdin -> stdout -> stderr -> m b) -> m b

-- | Wrapper for input source which accepts <tt>Flush</tt>es. Note that the
--   pipe will <i>not</i> automatically close then processing completes.
newtype FlushInput o (m :: Type -> Type) r
FlushInput :: ConduitM (Flush ByteString) o m r -> FlushInput o (m :: Type -> Type) r

-- | Wrapper for input source which accepts <a>Builder</a>s. You can pass
--   <a>flush</a> to flush the input. Note that the pipe will <i>not</i>
--   automatically close when the processing completes.
newtype BuilderInput o (m :: Type -> Type) r
BuilderInput :: ConduitM Builder o m r -> BuilderInput o (m :: Type -> Type) r

-- | Waits for the specified process to terminate, and returns its exit
--   code. On Unix systems, may throw <tt>UserInterrupt</tt> when using
--   <a>delegate_ctlc</a>.
--   
--   GHC Note: in order to call <tt>waitForProcess</tt> without blocking
--   all the other threads in the system, you must compile the program with
--   <tt>-threaded</tt>.
--   
--   Note that it is safe to call <tt>waitForProcess</tt> for the same
--   process in multiple threads. When the process ends, threads blocking
--   on this call will wake in FIFO order. When using <a>delegate_ctlc</a>
--   and the process is interrupted, only the first waiting thread will
--   throw <tt>UserInterrupt</tt>.
--   
--   (<i>Since: 1.2.0.0</i>) On Unix systems, a negative value
--   <tt><a>ExitFailure</a> -<i>signum</i></tt> indicates that the child
--   was terminated by signal <tt><i>signum</i></tt>. The signal numbers
--   are platform-specific, so to test for a specific signal use the
--   constants provided by <a>System.Posix.Signals</a> in the <tt>unix</tt>
--   package. Note: core dumps are not reported, use
--   <a>System.Posix.Process</a> if you need this detail.
waitForProcess :: ProcessHandle -> IO ExitCode

-- | This is the most general way to spawn an external process. The process
--   can be a command line to be executed by a shell or a raw command with
--   a list of arguments. The stdin, stdout, and stderr streams of the new
--   process may individually be attached to new pipes, to existing
--   <a>Handle</a>s, or just inherited from the parent (the default.)
--   
--   The details of how to create the process are passed in the
--   <a>CreateProcess</a> record. To make it easier to construct a
--   <a>CreateProcess</a>, the functions <a>proc</a> and <a>shell</a> are
--   supplied that fill in the fields with default values which can be
--   overriden as needed.
--   
--   <a>createProcess</a> returns <tt>(<i>mb_stdin_hdl</i>,
--   <i>mb_stdout_hdl</i>, <i>mb_stderr_hdl</i>, <i>ph</i>)</tt>, where
--   
--   <ul>
--   <li>if <tt><a>std_in</a> == <a>CreatePipe</a></tt>, then
--   <tt><i>mb_stdin_hdl</i></tt> will be <tt>Just <i>h</i></tt>, where
--   <tt><i>h</i></tt> is the write end of the pipe connected to the child
--   process's <tt>stdin</tt>.</li>
--   <li>otherwise, <tt><i>mb_stdin_hdl</i> == Nothing</tt></li>
--   </ul>
--   
--   Similarly for <tt><i>mb_stdout_hdl</i></tt> and
--   <tt><i>mb_stderr_hdl</i></tt>.
--   
--   For example, to execute a simple <tt>ls</tt> command:
--   
--   <pre>
--   r &lt;- createProcess (proc "ls" [])
--   </pre>
--   
--   To create a pipe from which to read the output of <tt>ls</tt>:
--   
--   <pre>
--   (_, Just hout, _, _) &lt;-
--       createProcess (proc "ls" []){ std_out = CreatePipe }
--   </pre>
--   
--   To also set the directory in which to run <tt>ls</tt>:
--   
--   <pre>
--   (_, Just hout, _, _) &lt;-
--       createProcess (proc "ls" []){ cwd = Just "/home/bob",
--                                     std_out = CreatePipe }
--   </pre>
--   
--   Note that <tt>Handle</tt>s provided for <tt>std_in</tt>,
--   <tt>std_out</tt>, or <tt>std_err</tt> via the <tt>UseHandle</tt>
--   constructor will be closed by calling this function. This is not
--   always the desired behavior. In cases where you would like to leave
--   the <tt>Handle</tt> open after spawning the child process, please use
--   <a>createProcess_</a> instead. All created <tt>Handle</tt>s are
--   initially in text mode; if you need them to be in binary mode then use
--   <a>hSetBinaryMode</a>.
--   
--   <tt><i>ph</i></tt> contains a handle to the running process. On
--   Windows <a>use_process_jobs</a> can be set in CreateProcess in order
--   to create a Win32 Job object to monitor a process tree's progress. If
--   it is set then that job is also returned inside <tt><i>ph</i></tt>.
--   <tt><i>ph</i></tt> can be used to kill all running sub-processes. This
--   feature has been available since 1.5.0.0.
createProcess :: CreateProcess -> IO (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle)

-- | A handle to a process, which can be used to wait for termination of
--   the process using <a>waitForProcess</a>.
--   
--   None of the process-creation functions in this library wait for
--   termination: they all return a <a>ProcessHandle</a> which may be used
--   to wait for the process later.
--   
--   On Windows a second wait method can be used to block for event
--   completion. This requires two handles. A process job handle and a
--   events handle to monitor.
data ProcessHandle
data StdStream

-- | Inherit Handle from parent
Inherit :: StdStream

-- | Use the supplied Handle
UseHandle :: Handle -> StdStream

-- | Create a new pipe. The returned <tt>Handle</tt> will use the default
--   encoding and newline translation mode (just like <tt>Handle</tt>s
--   created by <tt>openFile</tt>).
CreatePipe :: StdStream

-- | Close the stream's file descriptor without passing a Handle. On POSIX
--   systems this may lead to strange behavior in the child process because
--   attempting to read or write after the file has been closed throws an
--   error. This should only be used with child processes that don't use
--   the file descriptor at all. If you wish to ignore the child process's
--   output you should either create a pipe and drain it manually or pass a
--   <tt>Handle</tt> that writes to <tt>/dev/null</tt>.
NoStream :: StdStream
data CmdSpec

-- | A command line to execute using the shell
ShellCommand :: String -> CmdSpec

-- | The name of an executable with a list of arguments
--   
--   The <a>FilePath</a> argument names the executable, and is interpreted
--   according to the platform's standard policy for searching for
--   executables. Specifically:
--   
--   <ul>
--   <li>on Unix systems the <a>execvp(3)</a> semantics is used, where if
--   the executable filename does not contain a slash (<tt>/</tt>) then the
--   <tt>PATH</tt> environment variable is searched for the
--   executable.</li>
--   <li>on Windows systems the Win32 <tt>CreateProcess</tt> semantics is
--   used. Briefly: if the filename does not contain a path, then the
--   directory containing the parent executable is searched, followed by
--   the current directory, then some standard locations, and finally the
--   current <tt>PATH</tt>. An <tt>.exe</tt> extension is added if the
--   filename does not already have an extension. For full details see the
--   <a>documentation</a> for the Windows <tt>SearchPath</tt> API.</li>
--   </ul>
--   
--   Windows does not have a mechanism for passing multiple arguments. When
--   using <tt>RawCommand</tt> on Windows, the command line is serialised
--   into a string, with arguments quoted separately. Command line parsing
--   is up individual programs, so the default behaviour may not work for
--   some programs. If you are not getting the desired results, construct
--   the command line yourself and use <a>ShellCommand</a>.
RawCommand :: FilePath -> [String] -> CmdSpec
data CreateProcess
CreateProcess :: CmdSpec -> Maybe FilePath -> Maybe [(String, String)] -> StdStream -> StdStream -> StdStream -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Maybe GroupID -> Maybe UserID -> Bool -> CreateProcess

-- | Executable &amp; arguments, or shell command. If <a>cwd</a> is
--   <a>Nothing</a>, relative paths are resolved with respect to the
--   current working directory. If <a>cwd</a> is provided, it is
--   implementation-dependent whether relative paths are resolved with
--   respect to <a>cwd</a> or the current working directory, so absolute
--   paths should be used to ensure portability.
[cmdspec] :: CreateProcess -> CmdSpec

-- | Optional path to the working directory for the new process
[cwd] :: CreateProcess -> Maybe FilePath

-- | Optional environment (otherwise inherit from the current process)
[env] :: CreateProcess -> Maybe [(String, String)]

-- | How to determine stdin
[std_in] :: CreateProcess -> StdStream

-- | How to determine stdout
[std_out] :: CreateProcess -> StdStream

-- | How to determine stderr XXX verify what happens with fds in nodejs
--   child processes
[std_err] :: CreateProcess -> StdStream

-- | Close all file descriptors except stdin, stdout and stderr in the new
--   process (on Windows, only works if std_in, std_out, and std_err are
--   all Inherit). This implementation will call close on every fd from 3
--   to the maximum of open files, which can be slow for high maximum of
--   open files.
[close_fds] :: CreateProcess -> Bool

-- | Create a new process group. On JavaScript this also creates a new
--   session.
[create_group] :: CreateProcess -> Bool

-- | Delegate control-C handling. Use this for interactive console
--   processes to let them handle control-C themselves (see below for
--   details).
[delegate_ctlc] :: CreateProcess -> Bool

-- | Use the windows DETACHED_PROCESS flag when creating the process; does
--   nothing on other platforms.
[detach_console] :: CreateProcess -> Bool

-- | Use the windows CREATE_NEW_CONSOLE flag when creating the process;
--   does nothing on other platforms.
--   
--   Default: <tt>False</tt>
[create_new_console] :: CreateProcess -> Bool

-- | Use posix setsid to start the new process in a new session; starts
--   process in a new session on JavaScript; does nothing on other
--   platforms.
[new_session] :: CreateProcess -> Bool

-- | Use posix setgid to set child process's group id; works for JavaScript
--   when system running nodejs is posix. does nothing on other platforms.
--   
--   Default: <tt>Nothing</tt>
[child_group] :: CreateProcess -> Maybe GroupID

-- | Use posix setuid to set child process's user id; works for JavaScript
--   when system running nodejs is posix. does nothing on other platforms.
--   
--   Default: <tt>Nothing</tt>
[child_user] :: CreateProcess -> Maybe UserID

-- | On Windows systems this flag indicates that we should wait for the
--   entire process tree to finish before unblocking. On POSIX systems this
--   flag is ignored. See $exec-on-windows for details.
--   
--   Default: <tt>False</tt>
[use_process_jobs] :: CreateProcess -> Bool

-- | This function is almost identical to <a>createProcess</a>. The only
--   differences are:
--   
--   <ul>
--   <li><a>Handle</a>s provided via <a>UseHandle</a> are not closed
--   automatically.</li>
--   <li>This function takes an extra <tt>String</tt> argument to be used
--   in creating error messages.</li>
--   </ul>
--   
--   This function has been available from the
--   <a>System.Process.Internals</a> module for some time, and is part of
--   the <a>System.Process</a> module since version 1.2.1.0.
createProcess_ :: String -> CreateProcess -> IO (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle)

-- | Create a pipe for interprocess communication and return a
--   <tt>(readEnd, writeEnd)</tt> <a>Handle</a> pair.
--   
--   <ul>
--   <li>WinIO Support</li>
--   </ul>
--   
--   When this function is used with WinIO enabled it's the caller's
--   responsibility to register the handles with the I/O manager. If this
--   is not done the operation will deadlock. Association can be done as
--   follows:
--   
--   <pre>
--   #if defined(<b>IO_MANAGER_WINIO</b>)
--   import GHC.IO.SubSystem ((<tt>&lt;!&gt;</tt>))
--   import GHC.IO.Handle.Windows (handleToHANDLE)
--   import GHC.Event.Windows (associateHandle')
--   #endif
--   
--   ...
--   
--   #if defined(<b>IO_MANAGER_WINIO</b>)
--   return () &lt;!&gt; do
--     associateHandle' =&lt;&lt; handleToHANDLE readEnd
--   #endif
--   </pre>
--   
--   Only associate handles that you are in charge of read/writing to. Do
--   not associate handles passed to another process. It's the process's
--   responsibility to register the handle if it supports async access.
createPipe :: IO (Handle, Handle)

-- | Create a pipe for interprocess communication and return a
--   <tt>(readEnd, writeEnd)</tt> <a>FD</a> pair.
createPipeFd :: IO (FD, FD)

-- | Sends an interrupt signal to the process group of the given process.
--   
--   On Unix systems, it sends the group the SIGINT signal.
--   
--   On Windows systems, it generates a CTRL_BREAK_EVENT and will only work
--   for processes created using <tt>createProcess</tt> and setting the
--   <a>create_group</a> flag
interruptProcessGroupOf :: ProcessHandle -> IO ()

-- | The platform specific type for a process identifier.
--   
--   This is always an integral type. Width and signedness are platform
--   specific.
type Pid = CPid

-- | Construct a <a>CreateProcess</a> record for passing to
--   <a>createProcess</a>, representing a raw command with arguments.
--   
--   See <a>RawCommand</a> for precise semantics of the specified
--   <tt>FilePath</tt>.
proc :: FilePath -> [String] -> CreateProcess

-- | Construct a <a>CreateProcess</a> record for passing to
--   <a>createProcess</a>, representing a command to be passed to the
--   shell.
shell :: String -> CreateProcess

-- | A <a>bracket</a>-style resource handler for <a>createProcess</a>.
--   
--   Does automatic cleanup when the action finishes. If there is an
--   exception in the body then it ensures that the process gets terminated
--   and any <a>CreatePipe</a> <a>Handle</a>s are closed. In particular
--   this means that if the Haskell thread is killed (e.g.
--   <a>killThread</a>), that the external process is also terminated.
--   
--   e.g.
--   
--   <pre>
--   withCreateProcess (proc cmd args) { ... }  $ \stdin stdout stderr ph -&gt; do
--     ...
--   </pre>
withCreateProcess :: CreateProcess -> (Maybe Handle -> Maybe Handle -> Maybe Handle -> ProcessHandle -> IO a) -> IO a

-- | Cleans up the process.
--   
--   This function is meant to be invoked from any application level
--   cleanup handler. It terminates the process, and closes any
--   <a>CreatePipe</a> <tt>handle</tt>s.
cleanupProcess :: (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle) -> IO ()

-- | Creates a new process to run the specified raw command with the given
--   arguments. It does not wait for the program to finish, but returns the
--   <a>ProcessHandle</a>.
spawnProcess :: FilePath -> [String] -> IO ProcessHandle

-- | Creates a new process to run the specified shell command. It does not
--   wait for the program to finish, but returns the <a>ProcessHandle</a>.
spawnCommand :: String -> IO ProcessHandle

-- | Creates a new process to run the specified command with the given
--   arguments, and wait for it to finish. If the command returns a
--   non-zero exit code, an exception is raised.
--   
--   If an asynchronous exception is thrown to the thread executing
--   <tt>callProcess</tt>, the forked process will be terminated and
--   <tt>callProcess</tt> will wait (block) until the process has been
--   terminated.
callProcess :: FilePath -> [String] -> IO ()

-- | Creates a new process to run the specified shell command. If the
--   command returns a non-zero exit code, an exception is raised.
--   
--   If an asynchronous exception is thrown to the thread executing
--   <tt>callCommand</tt>, the forked process will be terminated and
--   <tt>callCommand</tt> will wait (block) until the process has been
--   terminated.
callCommand :: String -> IO ()

-- | <tt>readProcess</tt> forks an external process, reads its standard
--   output strictly, blocking until the process terminates, and returns
--   the output string. The external process inherits the standard error.
--   
--   If an asynchronous exception is thrown to the thread executing
--   <tt>readProcess</tt>, the forked process will be terminated and
--   <tt>readProcess</tt> will wait (block) until the process has been
--   terminated.
--   
--   Output is returned strictly, so this is not suitable for launching
--   processes that require interaction over the standard file streams.
--   
--   This function throws an <a>IOError</a> if the process <a>ExitCode</a>
--   is anything other than <a>ExitSuccess</a>. If instead you want to get
--   the <a>ExitCode</a> then use <a>readProcessWithExitCode</a>.
--   
--   Users of this function should compile with <tt>-threaded</tt> if they
--   want other Haskell threads to keep running while waiting on the result
--   of readProcess.
--   
--   <pre>
--   &gt; readProcess "date" [] []
--   "Thu Feb  7 10:03:39 PST 2008\n"
--   </pre>
--   
--   The arguments are:
--   
--   <ul>
--   <li>The command to run, which must be in the $PATH, or an absolute or
--   relative path</li>
--   <li>A list of separate command line arguments to the program. See
--   <a>RawCommand</a> for further discussion of Windows semantics.</li>
--   <li>A string to pass on standard input to the forked process.</li>
--   </ul>
readProcess :: FilePath -> [String] -> String -> IO String

-- | <tt>readCreateProcess</tt> works exactly like <a>readProcess</a>
--   except that it lets you pass <a>CreateProcess</a> giving better
--   flexibility.
--   
--   <pre>
--   &gt; readCreateProcess ((shell "pwd") { cwd = Just "/etc/" }) ""
--   "/etc\n"
--   </pre>
--   
--   Note that <tt>Handle</tt>s provided for <tt>std_in</tt> or
--   <tt>std_out</tt> via the CreateProcess record will be ignored.
readCreateProcess :: CreateProcess -> String -> IO String

-- | <tt>readProcessWithExitCode</tt> is like <a>readProcess</a> but with
--   two differences:
--   
--   <ul>
--   <li>it returns the <a>ExitCode</a> of the process, and does not throw
--   any exception if the code is not <a>ExitSuccess</a>.</li>
--   <li>it reads and returns the output from process' standard error
--   handle, rather than the process inheriting the standard error
--   handle.</li>
--   </ul>
--   
--   On Unix systems, see <a>waitForProcess</a> for the meaning of exit
--   codes when the process died as the result of a signal.
readProcessWithExitCode :: FilePath -> [String] -> String -> IO (ExitCode, String, String)

-- | <tt>readCreateProcessWithExitCode</tt> works exactly like
--   <a>readProcessWithExitCode</a> except that it lets you pass
--   <a>CreateProcess</a> giving better flexibility.
--   
--   Note that <tt>Handle</tt>s provided for <tt>std_in</tt>,
--   <tt>std_out</tt>, or <tt>std_err</tt> via the CreateProcess record
--   will be ignored.
readCreateProcessWithExitCode :: CreateProcess -> String -> IO (ExitCode, String, String)

-- | Given a program <tt><i>p</i></tt> and arguments <tt><i>args</i></tt>,
--   <tt>showCommandForUser <i>p</i> <i>args</i></tt> returns a string
--   suitable for pasting into <tt>/bin/sh</tt> (on Unix systems) or
--   <tt>CMD.EXE</tt> (on Windows).
showCommandForUser :: FilePath -> [String] -> String

-- | Returns the PID (process ID) of a subprocess.
--   
--   <a>Nothing</a> is returned if the handle was already closed. Otherwise
--   a PID is returned that remains valid as long as the handle is open.
--   The operating system may reuse the PID as soon as the last handle to
--   the process is closed.
getPid :: ProcessHandle -> IO (Maybe Pid)

-- | Returns the PID (process ID) of the current process. On POSIX systems,
--   this calls <a>getProcessID</a> from <a>System.Posix.Process</a> in the
--   <tt>unix</tt> package. On Windows, this calls
--   <tt>getCurrentProcessId</tt> from <a>System.Win32.Process</a> in the
--   <tt>Win32</tt> package.
getCurrentPid :: IO Pid

-- | This is a non-blocking version of <a>waitForProcess</a>. If the
--   process is still running, <a>Nothing</a> is returned. If the process
--   has exited, then <tt><a>Just</a> e</tt> is returned where <tt>e</tt>
--   is the exit code of the process.
--   
--   On Unix systems, see <a>waitForProcess</a> for the meaning of exit
--   codes when the process died as the result of a signal. May throw
--   <tt>UserInterrupt</tt> when using <a>delegate_ctlc</a>.
getProcessExitCode :: ProcessHandle -> IO (Maybe ExitCode)

-- | Attempts to terminate the specified process. This function should not
--   be used under normal circumstances - no guarantees are given regarding
--   how cleanly the process is terminated. To check whether the process
--   has indeed terminated, use <a>getProcessExitCode</a>.
--   
--   On Unix systems, <a>terminateProcess</a> sends the process the SIGTERM
--   signal. On Windows systems, if <a>use_process_jobs</a> is <a>True</a>
--   then the Win32 <tt>TerminateJobObject</tt> function is called to kill
--   all processes associated with the job and passing the exit code of 1
--   to each of them. Otherwise if <a>use_process_jobs</a> is <a>False</a>
--   then the Win32 <tt>TerminateProcess</tt> function is called, passing
--   an exit code of 1.
--   
--   Note: on Windows, if the process was a shell command created by
--   <a>createProcess</a> with <a>shell</a>, or created by
--   <a>runCommand</a> or <a>runInteractiveCommand</a>, then
--   <a>terminateProcess</a> will only terminate the shell, not the command
--   itself. On Unix systems, both processes are in a process group and
--   will be terminated together.
terminateProcess :: ProcessHandle -> IO ()

-- | Runs a command using the shell.
runCommand :: String -> IO ProcessHandle

-- | Runs a raw command, optionally specifying <a>Handle</a>s from which to
--   take the <tt>stdin</tt>, <tt>stdout</tt> and <tt>stderr</tt> channels
--   for the new process (otherwise these handles are inherited from the
--   current process).
--   
--   Any <a>Handle</a>s passed to <a>runProcess</a> are placed immediately
--   in the closed state.
--   
--   Note: consider using the more general <a>createProcess</a> instead of
--   <a>runProcess</a>.
runProcess :: FilePath -> [String] -> Maybe FilePath -> Maybe [(String, String)] -> Maybe Handle -> Maybe Handle -> Maybe Handle -> IO ProcessHandle

-- | Runs a command using the shell, and returns <a>Handle</a>s that may be
--   used to communicate with the process via its <tt>stdin</tt>,
--   <tt>stdout</tt>, and <tt>stderr</tt> respectively.
runInteractiveCommand :: String -> IO (Handle, Handle, Handle, ProcessHandle)

-- | Runs a raw command, and returns <a>Handle</a>s that may be used to
--   communicate with the process via its <tt>stdin</tt>, <tt>stdout</tt>
--   and <tt>stderr</tt> respectively.
--   
--   For example, to start a process and feed a string to its stdin:
--   
--   <pre>
--   (inp,out,err,pid) &lt;- runInteractiveProcess "..."
--   forkIO (hPutStr inp str)
--   </pre>
runInteractiveProcess :: FilePath -> [String] -> Maybe FilePath -> Maybe [(String, String)] -> IO (Handle, Handle, Handle, ProcessHandle)

-- | Computation <tt>system cmd</tt> returns the exit code produced when
--   the operating system runs the shell command <tt>cmd</tt>.
--   
--   This computation may fail with one of the following <a>IOErrorType</a>
--   exceptions:
--   
--   <ul>
--   <li><i><tt>PermissionDenied</tt></i> The process has insufficient
--   privileges to perform the operation.</li>
--   <li><i><tt>ResourceExhausted</tt></i> Insufficient resources are
--   available to perform the operation.</li>
--   <li><i><tt>UnsupportedOperation</tt></i> The implementation does not
--   support system calls.</li>
--   </ul>
--   
--   On Windows, <a>system</a> passes the command to the Windows command
--   interpreter (<tt>CMD.EXE</tt> or <tt>COMMAND.COM</tt>), hence Unixy
--   shell tricks will not work.
--   
--   On Unix systems, see <a>waitForProcess</a> for the meaning of exit
--   codes when the process died as the result of a signal.
system :: String -> IO ExitCode

-- | The computation <tt><a>rawSystem</a> <i>cmd</i> <i>args</i></tt> runs
--   the operating system command <tt><i>cmd</i></tt> in such a way that it
--   receives as arguments the <tt><i>args</i></tt> strings exactly as
--   given, with no funny escaping or shell meta-syntax expansion. It will
--   therefore behave more portably between operating systems than
--   <a>system</a>.
--   
--   The return codes and possible failures are the same as for
--   <a>system</a>.
rawSystem :: String -> [String] -> IO ExitCode
data StreamingProcessHandle
class OutputSink a
class InputSource a
data ProcessExitedUnsuccessfully
ProcessExitedUnsuccessfully :: CreateProcess -> ExitCode -> ProcessExitedUnsuccessfully
data ClosedStream
ClosedStream :: ClosedStream
data Inherited
Inherited :: Inherited
data UseProvidedHandle
UseProvidedHandle :: UseProvidedHandle
waitForStreamingProcess :: MonadIO m => StreamingProcessHandle -> m ExitCode
waitForStreamingProcessSTM :: StreamingProcessHandle -> STM ExitCode
getStreamingProcessExitCode :: MonadIO m => StreamingProcessHandle -> m (Maybe ExitCode)
getStreamingProcessExitCodeSTM :: StreamingProcessHandle -> STM (Maybe ExitCode)
streamingProcessHandleRaw :: StreamingProcessHandle -> ProcessHandle
streamingProcessHandleTMVar :: StreamingProcessHandle -> TMVar ExitCode
streamingProcess :: (MonadIO m, InputSource stdin, OutputSink stdout, OutputSink stderr) => CreateProcess -> m (stdin, stdout, stderr, StreamingProcessHandle)
closeStreamingProcessHandle :: MonadIO m => StreamingProcessHandle -> m ()
withCheckedProcess :: (InputSource stdin, OutputSink stderr, OutputSink stdout, MonadIO m) => CreateProcess -> (stdin -> stdout -> stderr -> m b) -> m b
instance (Control.Monad.IO.Class.MonadIO m, r GHC.Types.~ ()) => Data.Streaming.Process.Internal.InputSource (Data.Conduit.Process.BuilderInput o m r)
instance (r GHC.Types.~ (), Control.Monad.IO.Class.MonadIO m, i GHC.Types.~ Data.ByteString.Internal.Type.ByteString) => Data.Streaming.Process.Internal.InputSource (Data.Conduit.Internal.Conduit.ConduitM i o m r)
instance (Control.Monad.IO.Class.MonadIO m, r GHC.Types.~ ()) => Data.Streaming.Process.Internal.InputSource (Data.Conduit.Process.FlushInput o m r)
instance (Control.Monad.IO.Class.MonadIO m, Control.Monad.IO.Class.MonadIO n, r GHC.Types.~ (), r' GHC.Types.~ ()) => Data.Streaming.Process.Internal.InputSource (Data.Conduit.Process.FlushInput o m r, n r')
instance (Control.Monad.IO.Class.MonadIO m, Control.Monad.IO.Class.MonadIO n, r GHC.Types.~ (), r' GHC.Types.~ ()) => Data.Streaming.Process.Internal.InputSource (Data.Conduit.Process.BuilderInput o m r, n r')
instance (r GHC.Types.~ (), r' GHC.Types.~ (), Control.Monad.IO.Class.MonadIO m, Control.Monad.IO.Class.MonadIO n, i GHC.Types.~ Data.ByteString.Internal.Type.ByteString) => Data.Streaming.Process.Internal.InputSource (Data.Conduit.Internal.Conduit.ConduitM i o m r, n r')
instance (r GHC.Types.~ (), Control.Monad.IO.Class.MonadIO m, o GHC.Types.~ Data.ByteString.Internal.Type.ByteString) => Data.Streaming.Process.Internal.OutputSink (Data.Conduit.Internal.Conduit.ConduitM i o m r)
instance (r GHC.Types.~ (), r' GHC.Types.~ (), Control.Monad.IO.Class.MonadIO m, Control.Monad.IO.Class.MonadIO n, o GHC.Types.~ Data.ByteString.Internal.Type.ByteString) => Data.Streaming.Process.Internal.OutputSink (Data.Conduit.Internal.Conduit.ConduitM i o m r, n r')


-- | The <a>System.Process.Typed</a> module from <tt>typed-process</tt>,
--   but with added conduit helpers.
module Data.Conduit.Process.Typed

-- | Provide input to a process by writing to a conduit. The sink provided
--   here will leave the pipe to the child open after the stream ends. This
--   allows the sink to be used multiple times, but may result in
--   surprising behavior. You may prefer <a>createSinkClose</a>, see
--   <a>https://github.com/snoyberg/conduit/issues/434</a>.
createSink :: forall (m :: Type -> Type) o. MonadIO m => StreamSpec 'STInput (ConduitM ByteString o m ())

-- | Like <a>createSink</a>, but closes the pipe to the child process as
--   soon as it runs out of data.
createSinkClose :: forall (m :: Type -> Type) o. MonadIO m => StreamSpec 'STInput (ConduitM ByteString o m ())

-- | Read output from a process by read from a conduit.
createSource :: forall (m :: Type -> Type) i. MonadIO m => StreamSpec 'STOutput (ConduitM i ByteString m ())

-- | Run a process, throwing an exception on a failure exit code. This will
--   store all output from stdout and stderr in memory for better error
--   messages. Note that this will require unbounded memory usage, so
--   caveat emptor.
--   
--   This will ignore any previous settings for the stdout and stderr
--   streams, and instead force them to use <a>createSource</a>.
withLoggedProcess_ :: MonadUnliftIO m => ProcessConfig stdin stdoutIgnored stderrIgnored -> (Process stdin (ConduitM () ByteString m ()) (ConduitM () ByteString m ()) -> m a) -> m a

-- | Defines the exit codes that a program can return.
data ExitCode

-- | indicates successful termination;
ExitSuccess :: ExitCode

-- | indicates program failure with an exit code. The exact interpretation
--   of the code is operating-system dependent. In particular, some values
--   may be prohibited (e.g. 0 on a POSIX-compliant system).
ExitFailure :: Int -> ExitCode
setEnv :: [(String, String)] -> ProcessConfig stdin stdout stderr -> ProcessConfig stdin stdout stderr
data StdStream

-- | Inherit Handle from parent
Inherit :: StdStream

-- | Use the supplied Handle
UseHandle :: Handle -> StdStream

-- | Create a new pipe. The returned <tt>Handle</tt> will use the default
--   encoding and newline translation mode (just like <tt>Handle</tt>s
--   created by <tt>openFile</tt>).
CreatePipe :: StdStream

-- | Close the stream's file descriptor without passing a Handle. On POSIX
--   systems this may lead to strange behavior in the child process because
--   attempting to read or write after the file has been closed throws an
--   error. This should only be used with child processes that don't use
--   the file descriptor at all. If you wish to ignore the child process's
--   output you should either create a pipe and drain it manually or pass a
--   <tt>Handle</tt> that writes to <tt>/dev/null</tt>.
NoStream :: StdStream
createPipe :: forall (anyStreamType :: StreamType). StreamSpec anyStreamType Handle

-- | The platform specific type for a process identifier.
--   
--   This is always an integral type. Width and signedness are platform
--   specific.
type Pid = CPid
proc :: FilePath -> [String] -> ProcessConfig () () ()
shell :: String -> ProcessConfig () () ()
readProcess :: MonadIO m => ProcessConfig stdin stdoutIgnored stderrIgnored -> m (ExitCode, ByteString, ByteString)
getPid :: Process stdin stdout stderr -> IO (Maybe Pid)
runProcess :: MonadIO m => ProcessConfig stdin stdout stderr -> m ExitCode
checkExitCode :: MonadIO m => Process stdin stdout stderr -> m ()
runProcess_ :: MonadIO m => ProcessConfig stdin stdout stderr -> m ()
readProcess_ :: MonadIO m => ProcessConfig stdin stdoutIgnored stderrIgnored -> m (ByteString, ByteString)
data ByteStringOutputException
ByteStringOutputException :: SomeException -> ProcessConfig () () () -> ByteStringOutputException
data ExitCodeException
ExitCodeException :: ExitCode -> ProcessConfig () () () -> ByteString -> ByteString -> ExitCodeException
[eceExitCode] :: ExitCodeException -> ExitCode
[eceProcessConfig] :: ExitCodeException -> ProcessConfig () () ()
[eceStdout] :: ExitCodeException -> ByteString
[eceStderr] :: ExitCodeException -> ByteString
data StreamSpec (streamType :: StreamType) a
data StreamType
STInput :: StreamType
STOutput :: StreamType
data ProcessConfig stdin stdout stderr
setStdin :: StreamSpec 'STInput stdin -> ProcessConfig stdin0 stdout stderr -> ProcessConfig stdin stdout stderr
setStdout :: StreamSpec 'STOutput stdout -> ProcessConfig stdin stdout0 stderr -> ProcessConfig stdin stdout stderr
setStderr :: StreamSpec 'STOutput stderr -> ProcessConfig stdin stdout stderr0 -> ProcessConfig stdin stdout stderr
setWorkingDir :: FilePath -> ProcessConfig stdin stdout stderr -> ProcessConfig stdin stdout stderr
setWorkingDirInherit :: ProcessConfig stdin stdout stderr -> ProcessConfig stdin stdout stderr
setEnvInherit :: ProcessConfig stdin stdout stderr -> ProcessConfig stdin stdout stderr
setCloseFds :: Bool -> ProcessConfig stdin stdout stderr -> ProcessConfig stdin stdout stderr
setCreateGroup :: Bool -> ProcessConfig stdin stdout stderr -> ProcessConfig stdin stdout stderr
setDelegateCtlc :: Bool -> ProcessConfig stdin stdout stderr -> ProcessConfig stdin stdout stderr
setDetachConsole :: Bool -> ProcessConfig stdin stdout stderr -> ProcessConfig stdin stdout stderr
setCreateNewConsole :: Bool -> ProcessConfig stdin stdout stderr -> ProcessConfig stdin stdout stderr
setNewSession :: Bool -> ProcessConfig stdin stdout stderr -> ProcessConfig stdin stdout stderr
setChildGroup :: GroupID -> ProcessConfig stdin stdout stderr -> ProcessConfig stdin stdout stderr
setChildGroupInherit :: ProcessConfig stdin stdout stderr -> ProcessConfig stdin stdout stderr
setChildUser :: UserID -> ProcessConfig stdin stdout stderr -> ProcessConfig stdin stdout stderr
setChildUserInherit :: ProcessConfig stdin stdout stderr -> ProcessConfig stdin stdout stderr
mkStreamSpec :: forall a (streamType :: StreamType). StdStream -> (ProcessConfig () () () -> Maybe Handle -> IO (a, IO ())) -> StreamSpec streamType a
mkPipeStreamSpec :: forall a (streamType :: StreamType). (ProcessConfig () () () -> Handle -> IO (a, IO ())) -> StreamSpec streamType a
inherit :: forall (anyStreamType :: StreamType). StreamSpec anyStreamType ()
nullStream :: forall (anyStreamType :: StreamType). StreamSpec anyStreamType ()
closed :: forall (anyStreamType :: StreamType). StreamSpec anyStreamType ()
byteStringInput :: ByteString -> StreamSpec 'STInput ()
byteStringOutput :: StreamSpec 'STOutput (STM ByteString)
useHandleOpen :: forall (anyStreamType :: StreamType). Handle -> StreamSpec anyStreamType ()
useHandleClose :: forall (anyStreamType :: StreamType). Handle -> StreamSpec anyStreamType ()
data Process stdin stdout stderr
startProcess :: MonadIO m => ProcessConfig stdin stdout stderr -> m (Process stdin stdout stderr)
stopProcess :: MonadIO m => Process stdin stdout stderr -> m ()
withProcessTerm :: MonadUnliftIO m => ProcessConfig stdin stdout stderr -> (Process stdin stdout stderr -> m a) -> m a
withProcessWait :: MonadUnliftIO m => ProcessConfig stdin stdout stderr -> (Process stdin stdout stderr -> m a) -> m a
withProcess :: MonadUnliftIO m => ProcessConfig stdin stdout stderr -> (Process stdin stdout stderr -> m a) -> m a
withProcessTerm_ :: MonadUnliftIO m => ProcessConfig stdin stdout stderr -> (Process stdin stdout stderr -> m a) -> m a
withProcessWait_ :: MonadUnliftIO m => ProcessConfig stdin stdout stderr -> (Process stdin stdout stderr -> m a) -> m a
withProcess_ :: MonadUnliftIO m => ProcessConfig stdin stdout stderr -> (Process stdin stdout stderr -> m a) -> m a
readProcessStdout :: MonadIO m => ProcessConfig stdin stdoutIgnored stderr -> m (ExitCode, ByteString)
readProcessStdout_ :: MonadIO m => ProcessConfig stdin stdoutIgnored stderr -> m ByteString
readProcessStderr :: MonadIO m => ProcessConfig stdin stdout stderrIgnored -> m (ExitCode, ByteString)
readProcessStderr_ :: MonadIO m => ProcessConfig stdin stdout stderrIgnored -> m ByteString
readProcessInterleaved :: MonadIO m => ProcessConfig stdin stdoutIgnored stderrIgnored -> m (ExitCode, ByteString)
readProcessInterleaved_ :: MonadIO m => ProcessConfig stdin stdoutIgnored stderrIgnored -> m ByteString
waitExitCode :: MonadIO m => Process stdin stdout stderr -> m ExitCode
waitExitCodeSTM :: Process stdin stdout stderr -> STM ExitCode
getExitCode :: MonadIO m => Process stdin stdout stderr -> m (Maybe ExitCode)
getExitCodeSTM :: Process stdin stdout stderr -> STM (Maybe ExitCode)
checkExitCodeSTM :: Process stdin stdout stderr -> STM ()
getStdin :: Process stdin stdout stderr -> stdin
getStdout :: Process stdin stdout stderr -> stdout
getStderr :: Process stdin stdout stderr -> stderr
unsafeProcessHandle :: Process stdin stdout stderr -> ProcessHandle
exitCodeExceptionWithOutput :: MonadIO m => Process stdin (STM ByteString) (STM ByteString) -> m ExitCodeException
exitCodeExceptionNoOutput :: Process stdin stdout stderr -> ExitCode -> ExitCodeException


-- | <i>NOTE</i> It is recommended to start using
--   <a>Data.Conduit.Combinators</a> instead of this module.
--   
--   Copyright: 2011 Michael Snoyman, 2010-2011 John Millikin License: MIT
--   
--   Handle streams of text.
--   
--   Parts of this code were taken from enumerator and adapted for
--   conduits.
--   
--   For many purposes, it's recommended to use the conduit-combinators
--   library, which provides a more complete set of functions.
module Data.Conduit.Text

-- | A specific character encoding.
--   
--   Since 0.3.0
data Codec

-- | Convert text into bytes, using the provided codec. If the codec is not
--   capable of representing an input character, an exception will be
--   thrown.
--   
--   Since 0.3.0
encode :: forall (m :: Type -> Type). MonadThrow m => Codec -> ConduitT Text ByteString m ()

-- | Convert bytes into text, using the provided codec. If the codec is not
--   capable of decoding an input byte sequence, an exception will be
--   thrown.
--   
--   Since 0.3.0
decode :: forall (m :: Type -> Type). MonadThrow m => Codec -> ConduitT ByteString Text m ()

-- | Since 0.3.0
utf8 :: Codec

-- | Since 0.3.0
utf16_le :: Codec

-- | Since 0.3.0
utf16_be :: Codec

-- | Since 0.3.0
utf32_le :: Codec

-- | Since 0.3.0
utf32_be :: Codec

-- | Since 0.3.0
ascii :: Codec

-- | Since 0.3.0
iso8859_1 :: Codec

-- | Emit each line separately
--   
--   Since 0.4.1
lines :: forall (m :: Type -> Type). Monad m => ConduitT Text Text m ()

-- | Variant of the lines function with an integer parameter. The text
--   length of any emitted line never exceeds the value of the parameter.
--   Whenever this is about to happen a LengthExceeded exception is thrown.
--   This function should be used instead of the lines function whenever we
--   are dealing with user input (e.g. a file upload) because we can't be
--   sure that user input won't have extraordinarily large lines which
--   would require large amounts of memory if consumed.
linesBounded :: forall (m :: Type -> Type). MonadThrow m => Int -> ConduitT Text Text m ()

-- | Since 0.3.0
data TextException
DecodeException :: Codec -> Word8 -> TextException
EncodeException :: Codec -> Char -> TextException
LengthExceeded :: Int -> TextException
TextException :: SomeException -> TextException
NewDecodeException :: !Text -> !Int -> !ByteString -> TextException

-- | Since 1.0.8
takeWhile :: forall (m :: Type -> Type). Monad m => (Char -> Bool) -> ConduitT Text Text m ()

-- | Since 1.0.8
dropWhile :: forall (m :: Type -> Type) o. Monad m => (Char -> Bool) -> ConduitT Text o m ()

-- | Since 1.0.8
take :: forall (m :: Type -> Type). Monad m => Int -> ConduitT Text Text m ()

-- | Since 1.0.8
drop :: forall (m :: Type -> Type) o. Monad m => Int -> ConduitT Text o m ()

-- | Since 1.0.8
foldLines :: forall (m :: Type -> Type) a o. Monad m => (a -> ConduitM Text o m a) -> a -> ConduitT Text o m a

-- | Since 1.0.8
withLine :: forall (m :: Type -> Type) a o. Monad m => ConduitT Text Void m a -> ConduitT Text o m (Maybe a)

-- | Decode a stream of binary data as UTF8.
decodeUtf8 :: forall (m :: Type -> Type). MonadThrow m => ConduitT ByteString Text m ()

-- | Decode a stream of binary data as UTF8, replacing any invalid bytes
--   with the Unicode replacement character.
decodeUtf8Lenient :: forall (m :: Type -> Type). Monad m => ConduitT ByteString Text m ()

-- | Encode a stream of text as UTF8.
--   
--   Subject to fusion
encodeUtf8 :: forall (m :: Type -> Type) text binary. (Monad m, Utf8 text binary) => ConduitT text binary m ()

-- | Automatically determine which UTF variant is being used. This function
--   checks for BOMs, removing them as necessary. It defaults to assuming
--   UTF-8.
--   
--   Since 1.1.9
detectUtf :: forall (m :: Type -> Type). MonadThrow m => ConduitT ByteString Text m ()
instance GHC.Internal.Exception.Type.Exception Data.Conduit.Text.TextException
instance GHC.Internal.Show.Show Data.Conduit.Text.Codec
instance GHC.Internal.Show.Show Data.Conduit.Text.TextException


-- | Streaming compression and decompression using conduits.
--   
--   Parts of this code were taken from zlib-enum and adapted for conduits.
module Data.Conduit.Zlib

-- | Compress (deflate) a stream of <a>ByteString</a>s. The
--   <a>WindowBits</a> also control the format (zlib vs. gzip).
compress :: forall (m :: Type -> Type). (PrimMonad m, MonadThrow m) => Int -> WindowBits -> ConduitT ByteString ByteString m ()

-- | Decompress (inflate) a stream of <a>ByteString</a>s. For example:
--   
--   <pre>
--   sourceFile "test.z" $= decompress defaultWindowBits $$ sinkFile "test"
--   </pre>
decompress :: forall (m :: Type -> Type). (PrimMonad m, MonadThrow m) => WindowBits -> ConduitT ByteString ByteString m ()

-- | Gzip compression with default parameters.
gzip :: forall (m :: Type -> Type). (MonadThrow m, PrimMonad m) => ConduitT ByteString ByteString m ()

-- | Gzip decompression with default parameters.
ungzip :: forall (m :: Type -> Type). (PrimMonad m, MonadThrow m) => ConduitT ByteString ByteString m ()

-- | Same as <a>compress</a>, but allows you to explicitly flush the
--   stream.
compressFlush :: forall (m :: Type -> Type). (PrimMonad m, MonadThrow m) => Int -> WindowBits -> ConduitT (Flush ByteString) (Flush ByteString) m ()

-- | Same as <a>decompress</a>, but allows you to explicitly flush the
--   stream.
decompressFlush :: forall (m :: Type -> Type). (PrimMonad m, MonadThrow m) => WindowBits -> ConduitT (Flush ByteString) (Flush ByteString) m ()

-- | The standard <a>decompress</a> and <a>ungzip</a> functions will only
--   decompress a single compressed entity from the stream. This combinator
--   will exhaust the stream completely of all individual compressed
--   entities. This is useful for cases where you have a concatenated
--   archive, e.g. <tt>cat file1.gz file2.gz &gt; combined.gz</tt>.
--   
--   Usage:
--   
--   <pre>
--   sourceFile "combined.gz" $$ multiple ungzip =$ consume
--   </pre>
--   
--   This combinator will not fail on an empty stream. If you want to
--   ensure that at least one compressed entity in the stream exists,
--   consider a usage such as:
--   
--   <pre>
--   sourceFile "combined.gz" $$ (ungzip &gt;&gt; multiple ungzip) =$ consume
--   </pre>
multiple :: forall (m :: Type -> Type) a. Monad m => ConduitT ByteString a m () -> ConduitT ByteString a m ()
newtype WindowBits
WindowBits :: Int -> WindowBits
defaultWindowBits :: WindowBits
