Safe Haskell | None |
---|---|
Language | GHC2021 |
Effects.FileSystem.HandleReader
Description
Provides the MonadHandleReader effect.
Since: 0.1
Synopsis
- class Monad m => MonadHandleReader (m :: Type -> Type) where
- hIsEOF :: Handle -> m Bool
- hGetBuffering :: Handle -> m BufferMode
- hIsOpen :: Handle -> m Bool
- hIsClosed :: Handle -> m Bool
- hIsReadable :: Handle -> m Bool
- hIsWritable :: Handle -> m Bool
- hIsSeekable :: Handle -> m Bool
- hIsTerminalDevice :: Handle -> m Bool
- hGetEcho :: Handle -> m Bool
- hWaitForInput :: Handle -> Int -> m Bool
- hReady :: Handle -> m Bool
- hGetChar :: Handle -> m Char
- hGetLine :: Handle -> m ByteString
- hGetContents :: Handle -> m ByteString
- hGet :: Handle -> Int -> m ByteString
- hGetSome :: Handle -> Int -> m ByteString
- hGetNonBlocking :: Handle -> Int -> m ByteString
- hGetLineUtf8 :: (HasCallStack, MonadHandleReader m) => Handle -> m (Either UnicodeException Text)
- hGetLineUtf8Lenient :: (HasCallStack, MonadHandleReader m) => Handle -> m Text
- hGetLineUtf8ThrowM :: (HasCallStack, MonadHandleReader m, MonadThrow m) => Handle -> m Text
- hGetContentsUtf8 :: (HasCallStack, MonadHandleReader m) => Handle -> m (Either UnicodeException Text)
- hGetContentsUtf8Lenient :: (HasCallStack, MonadHandleReader m) => Handle -> m Text
- hGetContentsUtf8ThrowM :: (HasCallStack, MonadHandleReader m, MonadThrow m) => Handle -> m Text
- hGetUtf8 :: (HasCallStack, MonadHandleReader m) => Handle -> Int -> m (Either UnicodeException Text)
- hGetUtf8Lenient :: (HasCallStack, MonadHandleReader m) => Handle -> Int -> m Text
- hGetUtf8ThrowM :: (HasCallStack, MonadHandleReader m, MonadThrow m) => Handle -> Int -> m Text
- hGetSomeUtf8 :: (HasCallStack, MonadHandleReader m) => Handle -> Int -> m (Either UnicodeException Text)
- hGetSomeUtf8Lenient :: (HasCallStack, MonadHandleReader m) => Handle -> Int -> m Text
- hGetSomeUtf8ThrowM :: (HasCallStack, MonadHandleReader m, MonadThrow m) => Handle -> Int -> m Text
- hGetNonBlockingUtf8 :: (HasCallStack, MonadHandleReader m) => Handle -> Int -> m (Either UnicodeException Text)
- hGetNonBlockingUtf8Lenient :: (HasCallStack, MonadHandleReader m) => Handle -> Int -> m Text
- hGetNonBlockingUtf8ThrowM :: (HasCallStack, MonadHandleReader m, MonadThrow m) => Handle -> Int -> m Text
- data ByteString
- data Handle
- data Text
- data UnicodeException
Effect
class Monad m => MonadHandleReader (m :: Type -> Type) where Source #
Represents handle reader effects.
Since: 0.1
Methods
hIsEOF :: Handle -> m Bool Source #
Lifted hIsEOF
.
Since: 0.1
hGetBuffering :: Handle -> m BufferMode Source #
Lifted hGetBuffering
.
Since: 0.1
hIsOpen :: Handle -> m Bool Source #
Lifted hIsOpen
.
Since: 0.1
hIsClosed :: Handle -> m Bool Source #
Lifted hIsClosed
.
Since: 0.1
hIsReadable :: Handle -> m Bool Source #
Lifted hIsReadable
.
Since: 0.1
hIsWritable :: Handle -> m Bool Source #
Lifted hIsWritable
.
Since: 0.1
hIsSeekable :: Handle -> m Bool Source #
Lifted hIsSeekable
.
Since: 0.1
hIsTerminalDevice :: Handle -> m Bool Source #
Lifted hIsTerminalDevice
.
Since: 0.1
hGetEcho :: Handle -> m Bool Source #
Lifted hGetEcho
.
Since: 0.1
hWaitForInput :: Handle -> Int -> m Bool Source #
Lifted hWaitForInput
.
Since: 0.1
hReady :: Handle -> m Bool Source #
Lifted hReady
.
Since: 0.1
hGetChar :: Handle -> m Char Source #
Lifted hGetChar
.
Since: 0.1
hGetLine :: Handle -> m ByteString Source #
Lifted hGetLine
.
Since: 0.1
hGetContents :: Handle -> m ByteString Source #
Lifted hGetContents
.
Since: 0.1
hGet :: Handle -> Int -> m ByteString Source #
Lifted hGet
.
Since: 0.1
hGetSome :: Handle -> Int -> m ByteString Source #
Lifted hGetSome
.
Since: 0.1
hGetNonBlocking :: Handle -> Int -> m ByteString Source #
Lifted hGetNonBlocking
.
Since: 0.1
Instances
UTF-8 Utils
GetLine
hGetLineUtf8 :: (HasCallStack, MonadHandleReader m) => Handle -> m (Either UnicodeException Text) Source #
hGetLine
that attempts a UTF-8 conversion.
Since: 0.1
hGetLineUtf8Lenient :: (HasCallStack, MonadHandleReader m) => Handle -> m Text Source #
hGetLine
that converts to UTF-8 in lenient mode.
Since: 0.1
hGetLineUtf8ThrowM :: (HasCallStack, MonadHandleReader m, MonadThrow m) => Handle -> m Text Source #
hGetLine
that throws UnicodeException
if UTF-8 conversion fails.
Since: 0.1
GetContents
hGetContentsUtf8 :: (HasCallStack, MonadHandleReader m) => Handle -> m (Either UnicodeException Text) Source #
hGetContents
that attempts a UTF-8 conversion.
Since: 0.1
hGetContentsUtf8Lenient :: (HasCallStack, MonadHandleReader m) => Handle -> m Text Source #
hGetContents
that converts to UTF-8 in lenient mode.
Since: 0.1
hGetContentsUtf8ThrowM :: (HasCallStack, MonadHandleReader m, MonadThrow m) => Handle -> m Text Source #
hGetContents
that throws UnicodeException
if UTF-8 conversion fails.
Since: 0.1
Get
hGetUtf8 :: (HasCallStack, MonadHandleReader m) => Handle -> Int -> m (Either UnicodeException Text) Source #
hGet
that attempts a UTF-8 conversion.
Since: 0.1
hGetUtf8Lenient :: (HasCallStack, MonadHandleReader m) => Handle -> Int -> m Text Source #
hGet
that converts to UTF-8 in lenient mode.
Since: 0.1
hGetUtf8ThrowM :: (HasCallStack, MonadHandleReader m, MonadThrow m) => Handle -> Int -> m Text Source #
hGet
that throws UnicodeException
if UTF-8 conversion fails.
Since: 0.1
GetSome
hGetSomeUtf8 :: (HasCallStack, MonadHandleReader m) => Handle -> Int -> m (Either UnicodeException Text) Source #
hGetSome
that attempts a UTF-8 conversion.
Since: 0.1
hGetSomeUtf8Lenient :: (HasCallStack, MonadHandleReader m) => Handle -> Int -> m Text Source #
hGetSome
that converts to UTF-8 in lenient mode.
Since: 0.1
hGetSomeUtf8ThrowM :: (HasCallStack, MonadHandleReader m, MonadThrow m) => Handle -> Int -> m Text Source #
hGetSome
that throws UnicodeException
if UTF-8 conversion fails.
Since: 0.1
GetNonBlocking
hGetNonBlockingUtf8 :: (HasCallStack, MonadHandleReader m) => Handle -> Int -> m (Either UnicodeException Text) Source #
hGetNonBlocking
that attempts a UTF-8 conversion.
Since: 0.1
hGetNonBlockingUtf8Lenient :: (HasCallStack, MonadHandleReader m) => Handle -> Int -> m Text Source #
hGetNonBlocking
that converts to UTF-8 in lenient mode.
Since: 0.1
hGetNonBlockingUtf8ThrowM :: (HasCallStack, MonadHandleReader m, MonadThrow m) => Handle -> Int -> m Text Source #
hGetNonBlocking
that throws UnicodeException
if UTF-8 conversion fails.
Since: 0.1
Reexports
data ByteString #
A space-efficient representation of a Word8
vector, supporting many
efficient operations.
A ByteString
contains 8-bit bytes, or by using the operations from
Data.ByteString.Char8 it can be interpreted as containing 8-bit
characters.
Instances
Haskell defines operations to read and write characters from and to files,
represented by values of type Handle
. Each value of this type is a
handle: a record used by the Haskell run-time system to manage I/O
with file system objects. A handle has at least the following properties:
- whether it manages input or output or both;
- whether it is open, closed or semi-closed;
- whether the object is seekable;
- whether buffering is disabled, or enabled on a line or block basis;
- a buffer (whose length may be zero).
Most handles will also have a current I/O position indicating where the next
input or output operation will occur. A handle is readable if it
manages only input or both input and output; likewise, it is writable if
it manages only output or both input and output. A handle is open when
first allocated.
Once it is closed it can no longer be used for either input or output,
though an implementation cannot re-use its storage while references
remain to it. Handles are in the Show
and Eq
classes. The string
produced by showing a handle is system dependent; it should include
enough information to identify the handle for debugging. A handle is
equal according to ==
only to itself; no attempt
is made to compare the internal state of different handles for equality.
Instances
A space efficient, packed, unboxed Unicode text type.
data UnicodeException #
An exception type for representing Unicode encoding errors.
Instances
Exception UnicodeException | |
Defined in Data.Text.Encoding.Error Methods toException :: UnicodeException -> SomeException # | |
Show UnicodeException | |
Defined in Data.Text.Encoding.Error Methods showsPrec :: Int -> UnicodeException -> ShowS # show :: UnicodeException -> String # showList :: [UnicodeException] -> ShowS # | |
NFData UnicodeException | |
Defined in Data.Text.Encoding.Error Methods rnf :: UnicodeException -> () # | |
Eq UnicodeException | |
Defined in Data.Text.Encoding.Error Methods (==) :: UnicodeException -> UnicodeException -> Bool # (/=) :: UnicodeException -> UnicodeException -> Bool # |