Read chunks of bytes from standard input
The chunks are not necessarily aligned to line boundaries
:: a typeCtrl KGHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27
Moduleturtle-1.6.2Haskell2010
This module provides ByteString analogs of several utilities in Turtle.Prelude. The main difference is that the chunks of bytes read by these utilities are not necessarily aligned to line boundaries.
Read chunks of bytes from standard input
The chunks are not necessarily aligned to line boundaries
Read chunks of bytes from a file
The chunks are not necessarily aligned to line boundaries
Read chunks of bytes from a Handle
The chunks are not necessarily aligned to line boundaries
Stream chunks of bytes to standard output
The chunks are not necessarily aligned to line boundaries
Stream chunks of bytes to a file
The chunks do not need to be aligned to line boundaries
Stream chunks of bytes to a Handle
The chunks do not need to be aligned to line boundaries
Append chunks of bytes to append to a file
The chunks do not need to be aligned to line boundaries
Stream chunks of bytes to standard error
The chunks do not need to be aligned to line boundaries
Read in a stream's contents strictly
Compress a stream using zlib
Note that this can decompress streams that are the concatenation of
multiple compressed streams (just like gzip)
let compressed = select [ "ABC", "DEF" ] & compress 0 defaultWindowBitscompressed & decompress defaultWindowBits & view"ABCDEF"(compressed <|> compressed) & decompress defaultWindowBits & view"ABCDEF""ABCDEF"
Decompress a stream using zlib (just like the gzip command)
This specifies the size of the compression window. Larger values of this parameter result in better compression at the expense of higher memory usage.
The compression window size is the value of the the window bits raised to
the power 2. The window bits must be in the range 9..15 which corresponds
to compression window sizes of 512b to 32Kb. The default is 15 which is also
the maximum size.
The total amount of memory used depends on the window bits and the MemoryLevel. See the MemoryLevel for the details.
Eq WindowBitsDefined in zlib-0.7.1.0 · Codec.Compression.Zlib.StreamOrd WindowBitsDefined in zlib-0.7.1.0 · Codec.Compression.Zlib.StreamShow WindowBitsDefined in zlib-0.7.1.0 · Codec.Compression.Zlib.StreamGeneric WindowBitsDefined in zlib-0.7.1.0 · Codec.Compression.Zlib.Streamtype Rep WindowBits = D1 ('MetaData "WindowBits"
"Codec.Compression.Zlib.Stream"
"zlib-0.7.1.0-FdzQBN8c1mMLTBR17egTes"
'True) (C1 ('MetaCons "WindowBits"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)))Defined in zlib-0.7.1.0 · Codec.Compression.Zlib.StreamThe default WindowBits. Equivalent to windowBits 15.
which is also the maximum size.
Encode a stream of bytes as UTF8 Text
proc Run a command using execvp, retrieving the exit code
The command inherits stdout and stderr for the current process
shell :: MonadIO io=> TextCommand line
-> Shell ByteStringChunks of bytes written to process input
-> io ExitCodeExit code
Run a command line using the shell, retrieving the exit code
This command is more powerful than proc, but highly vulnerable to code injection if you template the command line with untrusted input
The command inherits stdout and stderr for the current process
procs :: MonadIO io=> TextCommand
-> [Text]Arguments
-> Shell ByteStringChunks of bytes written to process input
-> io ()This function is identical to proc except this throws ProcFailed for non-zero exit codes
shells :: MonadIO io=> TextCommand line
-> Shell ByteStringChunks of bytes written to process input
-> io ()Exit code
This function is identical to shell except this throws ShellFailed for non-zero exit codes
inproc :: TextCommand
-> [Text]Arguments
-> Shell ByteStringChunks of bytes written to process input
-> Shell ByteStringChunks of bytes read from process output
Run a command using execvp, streaming stdout as chunks of ByteString
The command inherits stderr for the current process
inshell :: TextCommand line
-> Shell ByteStringChunks of bytes written to process input
-> Shell ByteStringChunks of bytes read from process output
Run a command line using the shell, streaming stdout as chunks of
ByteString
This command is more powerful than inproc, but highly vulnerable to code injection if you template the command line with untrusted input
The command inherits stderr for the current process
inprocWithErr :: TextCommand
-> [Text]Arguments
-> Shell ByteStringChunks of bytes written to process input
-> Shell (Either ByteString ByteString)Run a command using the shell, streaming stdout and stderr as chunks of
ByteString. Chunks from stdout are wrapped in Right and chunks from
stderr are wrapped in Left.
Throws an ExitCode exception if the command returns a non-zero exit code
inshellWithErr :: TextCommand line
-> Shell ByteStringChunks of bytes written to process input
-> Shell (Either ByteString ByteString)Run a command line using the shell, streaming stdout and stderr as
chunks of ByteString. Chunks from stdout are wrapped in Right and
chunks from stderr are wrapped in Left.
This command is more powerful than inprocWithErr, but highly vulnerable to code injection if you template the command line with untrusted input
Throws an ExitCode exception if the command returns a non-zero exit code
procStrict :: MonadIO io=> TextCommand
-> [Text]Arguments
-> Shell ByteStringChunks of bytes written to process input
-> io (ExitCode, ByteString)Exit code and stdout
Run a command using execvp, retrieving the exit code and stdout as a
non-lazy blob of Text
The command inherits stderr for the current process
shellStrict :: MonadIO io=> TextCommand line
-> Shell ByteStringChunks of bytes written to process input
-> io (ExitCode, ByteString)Exit code and stdout
Run a command line using the shell, retrieving the exit code and stdout as a non-lazy blob of Text
This command is more powerful than proc, but highly vulnerable to code injection if you template the command line with untrusted input
The command inherits stderr for the current process
procStrictWithErr :: MonadIO io=> TextCommand
-> [Text]Arguments
-> Shell ByteStringChunks of bytes written to process input
-> io (ExitCode, ByteString, ByteString)(Exit code, stdout, stderr)
Run a command using execvp, retrieving the exit code, stdout, and stderr
as a non-lazy blob of Text
shellStrictWithErr :: MonadIO io=> TextCommand line
-> Shell ByteStringChunks of bytes written to process input
-> io (ExitCode, ByteString, ByteString)(Exit code, stdout, stderr)
Run a command line using the shell, retrieving the exit code, stdout, and stderr as a non-lazy blob of Text
This command is more powerful than proc, but highly vulnerable to code injection if you template the command line with untrusted input
system :: MonadIO io=> CreateProcessCommand
-> Shell ByteStringChunks of bytes written to process input
-> io ExitCodeExit code
stream :: CreateProcessCommand
-> Shell ByteStringChunks of bytes written to process input
-> Shell ByteStringChunks of bytes read from process output
streamWithErr :: CreateProcessCommand
-> Shell ByteStringChunks of bytes written to process input
-> Shell (Either ByteString ByteString)Chunks of bytes read from process output
streamWithErr generalizes inprocWithErr and inshellWithErr by allowing
you to supply your own custom CreateProcess. This is for advanced users
who feel comfortable using the lower-level process API
Throws an ExitCode exception if the command returns a non-zero exit code
systemStrict :: MonadIO io=> CreateProcessCommand
-> Shell ByteStringChunks of bytes written to process input
-> io (ExitCode, ByteString)Exit code and stdout
systemStrict generalizes shellStrict and procStrict by allowing you to
supply your own custom CreateProcess. This is for advanced users who feel
comfortable using the lower-level process API
systemStrictWithErr :: MonadIO io=> CreateProcessCommand
-> Shell ByteStringChunks of bytes written to process input
-> io (ExitCode, ByteString, ByteString)Exit code and stdout
systemStrictWithErr generalizes shellStrictWithErr and
procStrictWithErr by allowing you to supply your own custom
CreateProcess. This is for advanced users who feel comfortable using
the lower-level process API