effects-fs
Safe HaskellNone
LanguageGHC2021

Effects.FileSystem.HandleReader

Description

Provides the MonadHandleReader effect.

Since: 0.1

Synopsis

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

Instances details
MonadHandleReader IO Source #

Since: 0.1

Instance details

Defined in Effects.FileSystem.HandleReader

MonadHandleReader m => MonadHandleReader (ReaderT e m) Source #

Since: 0.1

Instance details

Defined in Effects.FileSystem.HandleReader

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

Instances details
NFData ByteString # 
Instance details

Defined in Data.ByteString.Internal.Type

Methods

rnf :: ByteString -> () #

Monoid ByteString # 
Instance details

Defined in Data.ByteString.Internal.Type

Semigroup ByteString # 
Instance details

Defined in Data.ByteString.Internal.Type

Data ByteString # 
Instance details

Defined in Data.ByteString.Internal.Type

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ByteString -> c ByteString #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ByteString #

toConstr :: ByteString -> Constr #

dataTypeOf :: ByteString -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ByteString) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ByteString) #

gmapT :: (forall b. Data b => b -> b) -> ByteString -> ByteString #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ByteString -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ByteString -> r #

gmapQ :: (forall d. Data d => d -> u) -> ByteString -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> ByteString -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> ByteString -> m ByteString #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ByteString -> m ByteString #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ByteString -> m ByteString #

IsString ByteString #

Beware: fromString truncates multi-byte characters to octets. e.g. "枯朶に烏のとまりけり秋の暮" becomes �6k�nh~�Q��n�

Instance details

Defined in Data.ByteString.Internal.Type

IsList ByteString #

Since: bytestring-0.10.12.0

Instance details

Defined in Data.ByteString.Internal.Type

Associated Types

type Item ByteString 
Instance details

Defined in Data.ByteString.Internal.Type

Read ByteString # 
Instance details

Defined in Data.ByteString.Internal.Type

Show ByteString # 
Instance details

Defined in Data.ByteString.Internal.Type

Eq ByteString # 
Instance details

Defined in Data.ByteString.Internal.Type

Ord ByteString # 
Instance details

Defined in Data.ByteString.Internal.Type

Lift ByteString #

Since: bytestring-0.11.2.0

Instance details

Defined in Data.ByteString.Internal.Type

Methods

lift :: Quote m => ByteString -> m Exp #

liftTyped :: forall (m :: Type -> Type). Quote m => ByteString -> Code m ByteString #

type Item ByteString # 
Instance details

Defined in Data.ByteString.Internal.Type

data Handle #

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

Instances details
Show Handle #

Since: base-4.1.0.0

Instance details

Defined in GHC.Internal.IO.Handle.Types

Eq Handle #

Since: base-4.1.0.0

Instance details

Defined in GHC.Internal.IO.Handle.Types

Methods

(==) :: Handle -> Handle -> Bool #

(/=) :: Handle -> Handle -> Bool #

data Text #

A space efficient, packed, unboxed Unicode text type.

Instances

Instances details
type Item Text # 
Instance details

Defined in Data.Text

type Item Text = Char