HORIZON HASKELLDocslts/ghc-10.0.xfc4e5982026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 10.0.0.20260917 · lts/ghc-10.0.x · fc4e598 · 2026-10-11

Modulestreamly-core-0.3.1Haskell2010

Streamly.Console.Stdio

Combinators to work with standard input, output, and error streams. This module supports reading and writing binary data or UTF-8 encoded text only. However, it is possible to use specific encoders and decoders to implement other encodings.

These streaming APIs use the stdin and stdout handles for reading from and writing to the console. The reads and writes are buffered, meaning each stream has its own buffer. Be cautious when switching between these APIs and handle-based APIs (e.g., readChars, getLine), between different stream APIs (e.g., readChars, readChunks), or even between different calls to the same API (e.g., readChars, readChars). If you switch from one stream to another, you should drain the first stream completely if you care about preserving any buffered data.

See also: Streamly.Internal.Console.Stdio

  • 10 values

Streams (stdin)

3 declarations
valueread :: MonadIO m => Stream m Word8
#

Read a byte stream from standard input.

read = Handle.read stdin
read = Stream.unfold Stdio.reader ()

Pre-release

valuereadChars :: MonadIO m => Stream m Char
#

Read a character stream from Utf8 encoded standard input.

readChars = Unicode.decodeUtf8 Stdio.read

Pre-release

valuereadChunks :: MonadIO m => Stream m (Array Word8)
#

Read a stream of chunks from standard input. The maximum size of a single chunk is limited to defaultChunkSize. The actual size read may be less than defaultChunkSize.

readChunks = Handle.readChunks stdin
readChunks = Stream.unfold Stdio.chunkReader ()

Pre-release

Streams (srdout)

1 declaration
valueputChunks :: MonadIO m => Stream m (Array Word8) -> m ()
#

Write a stream of chunks to standard output.

putChunks = Handle.putChunks stdout
putChunks = Stream.fold Stdio.writeChunks

Pre-release

Unfolds (stdin)

2 declarations

Write (stdout)

2 declarations

Write (stderr)

2 declarations