| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Effectful.FileSystem.FileReader.Static
Description
Provides a static effect for reading files.
Since: 0.1
Synopsis
- data FileReader (a :: Type -> Type) b
- readBinaryFile :: forall (es :: [Effect]). (FileReader :> es, HasCallStack) => OsPath -> Eff es ByteString
- runFileReader :: forall (es :: [Effect]) a. (HasCallStack, IOE :> es) => Eff (FileReader ': es) a -> Eff es a
- readFileUtf8 :: forall (es :: [Effect]). (FileReader :> es, HasCallStack) => OsPath -> Eff es (Either UnicodeException Text)
- readFileUtf8Lenient :: forall (es :: [Effect]). (FileReader :> es, HasCallStack) => OsPath -> Eff es Text
- readFileUtf8ThrowM :: forall (es :: [Effect]). (FileReader :> es, HasCallStack) => OsPath -> Eff es Text
- decodeUtf8 :: ByteString -> Either UnicodeException Text
- decodeUtf8Lenient :: ByteString -> Text
- decodeUtf8ThrowM :: (HasCallStack, MonadThrow m) => ByteString -> m Text
- data ByteString
- type OsPath = OsString
- data Text
- data UnicodeException
Effect
data FileReader (a :: Type -> Type) b Source #
Static effect for reading files.
Since: 0.1
Instances
| type DispatchOf FileReader Source # | |
Defined in Effectful.FileSystem.FileReader.Static | |
| data StaticRep FileReader Source # | |
Defined in Effectful.FileSystem.FileReader.Static | |
readBinaryFile :: forall (es :: [Effect]). (FileReader :> es, HasCallStack) => OsPath -> Eff es ByteString Source #
Since: 0.1
Handlers
runFileReader :: forall (es :: [Effect]) a. (HasCallStack, IOE :> es) => Eff (FileReader ': es) a -> Eff es a Source #
Runs FileReader in IO.
Since: 0.1
UTF-8 Utils
readFileUtf8 :: forall (es :: [Effect]). (FileReader :> es, HasCallStack) => OsPath -> Eff es (Either UnicodeException Text) Source #
Reads a file as UTF-8.
Since: 0.1
readFileUtf8Lenient :: forall (es :: [Effect]). (FileReader :> es, HasCallStack) => OsPath -> Eff es Text Source #
Reads a file as UTF-8 in lenient mode.
Since: 0.1
readFileUtf8ThrowM :: forall (es :: [Effect]). (FileReader :> es, HasCallStack) => OsPath -> Eff es 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
Re-exports
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
Type representing filenames/pathnames.
This type doesn't add any guarantees over OsString.
A space efficient, packed, unboxed Unicode text type.
Instances
| PrintfArg Text # | Since: text-1.2.2.0 |
Defined in Data.Text | |
| Binary Text # | Since: text-1.2.1.0 |
| NFData Text # | |
| Monoid Text # | |
| Semigroup Text # | Beware: Since: text-1.2.2.0 |
| Data Text # | This instance preserves data abstraction at the cost of inefficiency. We omit reflection services for the sake of data abstraction. This instance was created by copying the updated behavior of
The original discussion is archived here: could we get a Data instance for Data.Text.Text? The followup discussion that changed the behavior of |
Defined in Data.Text Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Text -> c Text # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Text # dataTypeOf :: Text -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Text) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Text) # gmapT :: (forall b. Data b => b -> b) -> Text -> Text # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Text -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Text -> r # gmapQ :: (forall d. Data d => d -> u) -> Text -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Text -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Text -> m Text # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Text -> m Text # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Text -> m Text # | |
| IsString Text # | Performs replacement on invalid scalar values:
|
Defined in Data.Text Methods fromString :: String -> Text # | |
| IsList Text # | Performs replacement on invalid scalar values:
Since: text-1.2.0.0 |
| Read Text # | |
| Show Text # | |
| Eq Text # | |
| Ord Text # | |
| Lift Text # | Since: text-1.2.4.0 |
| type Item Text # | |
data UnicodeException #
An exception type for representing Unicode encoding errors.
Instances
| NFData UnicodeException # | |
Defined in Data.Text.Encoding.Error Methods rnf :: UnicodeException -> () # | |
| Exception UnicodeException # | |
Defined in Data.Text.Encoding.Error Methods toException :: UnicodeException -> SomeException # fromException :: SomeException -> Maybe UnicodeException # | |
| Show UnicodeException # | |
Defined in Data.Text.Encoding.Error Methods showsPrec :: Int -> UnicodeException -> ShowS # show :: UnicodeException -> String # showList :: [UnicodeException] -> ShowS # | |
| Eq UnicodeException # | |
Defined in Data.Text.Encoding.Error Methods (==) :: UnicodeException -> UnicodeException -> Bool # (/=) :: UnicodeException -> UnicodeException -> Bool # | |