Safe Haskell | None |
---|---|
Language | GHC2021 |
Effects.FileSystem.FileReader
Contents
Description
Provides the MonadFileReader effect.
Since: 0.1
Synopsis
- class Monad m => MonadFileReader (m :: Type -> Type) where
- readBinaryFile :: OsPath -> m ByteString
- type OsPath = OsString
- readFileUtf8 :: (HasCallStack, MonadFileReader m) => OsPath -> m (Either UnicodeException Text)
- readFileUtf8Lenient :: (HasCallStack, MonadFileReader m) => OsPath -> m Text
- readFileUtf8ThrowM :: (HasCallStack, MonadFileReader m, MonadThrow m) => OsPath -> m Text
- decodeUtf8 :: ByteString -> Either UnicodeException Text
- decodeUtf8Lenient :: ByteString -> Text
- decodeUtf8ThrowM :: (HasCallStack, MonadThrow m) => ByteString -> m Text
- data ByteString
- data Text
- data UnicodeException
Effect
class Monad m => MonadFileReader (m :: Type -> Type) where Source #
Represents file-system reader effects.
Since: 0.1
Instances
MonadFileReader IO Source # | Since: 0.1 |
Defined in Effects.FileSystem.FileReader Methods readBinaryFile :: OsPath -> IO ByteString Source # | |
MonadFileReader m => MonadFileReader (ReaderT e m) Source # | Since: 0.1 |
Defined in Effects.FileSystem.FileReader Methods readBinaryFile :: OsPath -> ReaderT e m ByteString Source # |
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
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 # |