effects-fs-0.1: FileSystem effects
Safe HaskellNone
LanguageGHC2021

Effects.FileSystem.FileReader

Description

Provides the MonadFileReader effect.

Since: 0.1

Synopsis

Effect

class Monad m => MonadFileReader (m :: Type -> Type) where Source #

Represents file-system reader effects.

Since: 0.1

Methods

readBinaryFile :: OsPath -> m ByteString Source #

Reads a file.

Since: 0.1

Instances

Instances details
MonadFileReader IO Source #

Since: 0.1

Instance details

Defined in Effects.FileSystem.FileReader

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

Since: 0.1

Instance details

Defined in Effects.FileSystem.FileReader

type OsPath = OsString #

Type representing filenames/pathnames.

This type doesn't add any guarantees over OsString.

UTF-8 Utils

readFileUtf8 :: (HasCallStack, MonadFileReader m) => OsPath -> m (Either UnicodeException Text) Source #

Reads a file as UTF-8.

Since: 0.1

readFileUtf8Lenient :: (HasCallStack, MonadFileReader m) => OsPath -> m Text Source #

Reads a file as UTF-8 in lenient mode.

Since: 0.1

readFileUtf8ThrowM :: (HasCallStack, MonadFileReader m, MonadThrow m) => OsPath -> m Text Source #

Decodes a file as UTF-8. Throws UnicodeException for decode errors.

Since: 0.1

decodeUtf8 :: ByteString -> Either UnicodeException Text Source #

Decodes a ByteString to UTF-8.

Since: fs-utils-0.1

decodeUtf8Lenient :: ByteString -> Text Source #

Leniently decodes a ByteString to UTF-8.

Since: fs-utils-0.1

decodeUtf8ThrowM :: (HasCallStack, MonadThrow m) => ByteString -> m Text Source #

Decodes a ByteString to UTF-8. Can throw UnicodeException.

Since: fs-utils-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
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

Monoid ByteString 
Instance details

Defined in Data.ByteString.Internal.Type

Semigroup ByteString 
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

NFData ByteString 
Instance details

Defined in Data.ByteString.Internal.Type

Methods

rnf :: ByteString -> () #

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 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