> interface PreludeReadTextIO where > import PreludeMonadicIO > import PreludeIOError > import PreludeStdIO
> hReady :: Handle -> IO Bool
Computation hReady
hdl indicates whether at least
one item is available for input from handle hdl.
The computation may fail with:
HardwareFault
EIO
]
ResourceExhausted
ENOMEM
]
IllegalOperation
EOF
> getChar :: IO Char > hGetChar :: Handle -> IO Char > getChar = hGetChar stdin
Computation hGetChar
hdl reads the next
character from handle hdl, blocking until a character is
available.
The computation may fail with:
HardwareFault
EIO
]
ResourceExhausted
ENOMEM
]
IllegalOperation
EOF
getChar
reads the next character from stdin
.
The computation may fail with the same errors as hGetChar
.
> hLookAhead :: Handle -> IO Char
Computation hLookAhead
hdl returns the next
character from handle hdl without removing it from
the input buffer, blocking until
a character is available.
The computation may fail with:
HardwareFault
EIO
]
ResourceExhausted
ENOMEM
]
IllegalOperation
EOF
> hGetContents :: Handle -> IO String
Computation hGetContents
hdl returns the list of
characters corresponding to the unread portion of the channel or file managed
by hdl, which is made semi-closed.
The computation may fail with:
ResourceExhausted
IllegalOperation
> readFile :: FilePath -> IO String > readFile name = openFile name ReadMode >>= hGetContents
readFile
file returns the contents of
file as a lazy string.
The computation may fail with:
ResourceExhausted