streamly-0.8.3: Dataflow programming and declarative concurrency
Copyright(c) 2018 Composewell Technologies
LicenseBSD-3-Clause
Maintainerstreamly@composewell.com
Stabilityexperimental
PortabilityGHC
Safe HaskellSafe-Inferred
LanguageHaskell2010

Streamly.Internal.Console.Stdio

Contents

Description

 
Synopsis

Read

read :: MonadIO m => Unfold m () Word8 Source #

Unfold standard input into a stream of Word8.

Since: 0.8.0

getBytes :: MonadIO m => SerialT m Word8 Source #

Read a byte stream from standard input.

getBytes = Handle.toBytes stdin
getBytes = Stream.unfold Stdio.read ()

Pre-release

getChars :: MonadIO m => SerialT m Char Source #

Read a character stream from Utf8 encoded standard input.

getChars = Unicode.decodeUtf8 Stdio.getBytes

Pre-release

readChunks :: MonadIO m => Unfold m () (Array Word8) Source #

Unfolds standard input into a stream of Word8 arrays.

Since: 0.8.0

getChunks :: MonadIO m => SerialT m (Array Word8) Source #

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.

getChunks = Handle.toChunks stdin
getChunks = Stream.unfold Stdio.readChunks ()

Pre-release

Write

write :: MonadIO m => Fold m Word8 () Source #

Fold a stream of Word8 to standard output.

Since: 0.8.0

writeErr :: MonadIO m => Fold m Word8 () Source #

Fold a stream of Word8 to standard error.

Since: 0.8.0

putBytes :: MonadIO m => SerialT m Word8 -> m () Source #

Write a stream of bytes to standard output.

putBytes = Handle.putBytes stdout
putBytes = Stream.fold Stdio.write

Pre-release

putChars :: MonadIO m => SerialT m Char -> m () Source #

Encode a character stream to Utf8 and write it to standard output.

putChars = Stdio.putBytes . Unicode.encodeUtf8

Pre-release

writeChunks :: MonadIO m => Fold m (Array Word8) () Source #

Fold a stream of Array Word8 to standard output.

Since: 0.8.0

writeErrChunks :: MonadIO m => Fold m (Array Word8) () Source #

Fold a stream of Array Word8 to standard error.

Since: 0.8.0

putChunks :: MonadIO m => SerialT m (Array Word8) -> m () Source #

Write a stream of chunks to standard output.

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

Pre-release

putStringsWith :: MonadIO m => (SerialT m Char -> SerialT m Word8) -> SerialT m String -> m () Source #

Write a stream of strings to standard output using the supplied encoding. Output is flushed to the device for each string.

Pre-release

putStrings :: MonadIO m => SerialT m String -> m () Source #

Write a stream of strings to standard output using UTF8 encoding. Output is flushed to the device for each string.

Pre-release

putStringsLn :: MonadIO m => SerialT m String -> m () Source #

Like putStrings but adds a newline at the end of each string.

XXX This is not portable, on Windows we need to use "rn" instead.

Pre-release