Copyright | (c) 2018 Composewell Technologies |
---|---|
License | BSD-3-Clause |
Maintainer | streamly@composewell.com |
Stability | experimental |
Portability | GHC |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- read :: MonadIO m => Stream m Word8
- readChars :: MonadIO m => Stream m Char
- readChunks :: MonadIO m => Stream m (Array Word8)
- reader :: MonadIO m => Unfold m () Word8
- chunkReader :: MonadIO m => Unfold m () (Array Word8)
- write :: MonadIO m => Fold m Word8 ()
- writeChunks :: MonadIO m => Fold m (Array Word8) ()
- writeErr :: MonadIO m => Fold m Word8 ()
- writeErrChunks :: MonadIO m => Fold m (Array Word8) ()
- putBytes :: MonadIO m => Stream m Word8 -> m ()
- putChars :: MonadIO m => Stream m Char -> m ()
- putChunks :: MonadIO m => Stream m (Array Word8) -> m ()
- putStringsWith :: MonadIO m => (Stream m Char -> Stream m Word8) -> Stream m String -> m ()
- putStrings :: MonadIO m => Stream m String -> m ()
- putStringsLn :: MonadIO m => Stream m String -> m ()
Streams
read :: MonadIO m => Stream m Word8 Source #
Read a byte stream from standard input.
read = Handle.read stdin read = Stream.unfold Stdio.reader ()
Pre-release
readChars :: MonadIO m => Stream m Char Source #
Read a character stream from Utf8 encoded standard input.
readChars = Unicode.decodeUtf8 Stdio.read
Pre-release
readChunks :: MonadIO m => Stream 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
.
readChunks = Handle.readChunks stdin readChunks = Stream.unfold Stdio.chunkReader ()
Pre-release
Unfolds
chunkReader :: MonadIO m => Unfold m () (Array Word8) Source #
Unfolds standard input into a stream of Word8
arrays.
Folds
writeChunks :: MonadIO m => Fold m (Array Word8) () Source #
Fold a stream of Array Word8
to standard output.
writeErrChunks :: MonadIO m => Fold m (Array Word8) () Source #
Fold a stream of Array Word8
to standard error.
Stream writes
putBytes :: MonadIO m => Stream 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 => Stream m Char -> m () Source #
Encode a character stream to Utf8 and write it to standard output.
putChars = Stdio.putBytes . Unicode.encodeUtf8
Pre-release
putChunks :: MonadIO m => Stream 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 => (Stream m Char -> Stream m Word8) -> Stream 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 => Stream 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 => Stream 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