Copyright | (c) Dong Han 2018~2019 |
---|---|
License | BSD |
Maintainer | winterland1989@gmail.com |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
This module provides stdin/stderr/stdout reading and writings. Usually you don't have to use stderr
or stderrBuf
directly, Logger
provides more logging utilities through stderr
. While stdinBuf
and stdoutBuf
is useful when you write interactive programs, Buffered
module provide many reading and writing operations. Example:
import Std.IO.LowResTimer import Std.IO.Buffered import Std.IO.StdStream main = do -- read by '\n' b1 <- readLineStd -- read whatever user input in 3s, otherwise get Nothing b2 <- timeoutLowRes 30 $ readBuffered stdinBuf ... putStd "hello world!"
Synopsis
Standard input & output streams
Standard input and output streams
We support both regular file and TTY based streams, when initialized
uv_guess_handle
is called to decide which type of devices are connected
to standard streams.
StdStream
is different from other UVStream
in that exception during reading & writing
won't close StdStream
.
isStdStreamTTY :: StdStream -> Bool Source #
utils
readLineStd :: IO Bytes Source #
read a line from stdin