{-# OPTIONS_GHC -Wno-redundant-constraints #-}
module Effectful.FileSystem.HandleReader.Static
(
HandleReader,
openBinaryFile,
withBinaryFile,
hIsEOF,
hGetBuffering,
hIsOpen,
hIsClosed,
hIsReadable,
hIsWritable,
hIsSeekable,
hIsTerminalDevice,
hGetEcho,
hWaitForInput,
hReady,
hGetChar,
hGetLine,
hGetContents,
hGet,
hGetSome,
hGetNonBlocking,
hLockRaw,
hTryLockRaw,
hUnlockRaw,
runHandleReader,
Handle,
HandleMode (HandleModeRead),
CanRead,
LockedHandle,
Internal.liftLocked,
withLockedFile,
withTryLockedFile,
hLock,
hTryLock,
hUnlock,
withLockedFileRaw,
withTryLockedFileRaw,
hGetLineUtf8,
hGetLineUtf8Lenient,
hGetLineUtf8ThrowM,
hGetContentsUtf8,
hGetContentsUtf8Lenient,
hGetContentsUtf8ThrowM,
hGetUtf8,
hGetUtf8Lenient,
hGetUtf8ThrowM,
hGetSomeUtf8,
hGetSomeUtf8Lenient,
hGetSomeUtf8ThrowM,
hGetNonBlockingUtf8,
hGetNonBlockingUtf8Lenient,
hGetNonBlockingUtf8ThrowM,
ByteString,
OsPath,
Text,
UnicodeException,
)
where
import Control.Monad ((>=>))
import Data.ByteString (ByteString)
import Data.ByteString.Char8 qualified as C8
import Data.Text (Text)
import Data.Text.Encoding.Error (UnicodeException)
import Effectful
( Dispatch (Static),
DispatchOf,
Eff,
Effect,
IOE,
type (:>),
)
import Effectful.Dispatch.Static
( HasCallStack,
SideEffects (WithSideEffects),
StaticRep,
evalStaticRep,
seqUnliftIO,
unsafeEff,
unsafeEff_,
)
import Effectful.Exception (bracket, bracket_)
import Effectful.FileSystem.Handle.Internal
( CanRead,
Handle (MkHandle),
HandleMode (HandleModeRead),
LockedHandle,
)
import Effectful.FileSystem.Handle.Internal qualified as Internal
import FileSystem.IO (openBinaryFileIO, withBinaryFileIO)
import FileSystem.OsPath (OsPath)
import FileSystem.UTF8 qualified as FS.UTF8
import GHC.IO.Handle.Lock qualified as Lock
import System.IO (BufferMode, IOMode (ReadMode))
import System.IO qualified as IO
data HandleReader :: Effect
type instance DispatchOf HandleReader = Static WithSideEffects
data instance StaticRep HandleReader = MkHandleReader
runHandleReader ::
(HasCallStack, IOE :> es) =>
Eff (HandleReader : es) a ->
Eff es a
runHandleReader :: forall (es :: [Effect]) a.
(HasCallStack, IOE :> es) =>
Eff (HandleReader : es) a -> Eff es a
runHandleReader = StaticRep HandleReader -> Eff (HandleReader : es) a -> Eff es a
forall (e :: Effect) (sideEffects :: SideEffects) (es :: [Effect])
a.
(HasCallStack, DispatchOf e ~ 'Static sideEffects,
MaybeIOE sideEffects es) =>
StaticRep e -> Eff (e : es) a -> Eff es a
evalStaticRep StaticRep HandleReader
MkHandleReader
openBinaryFile ::
( HandleReader :> es,
HasCallStack
) =>
OsPath ->
Eff es (Handle HandleModeRead)
openBinaryFile :: forall (es :: [Effect]).
(HandleReader :> es, HasCallStack) =>
OsPath -> Eff es (Handle 'HandleModeRead)
openBinaryFile =
IO (Handle 'HandleModeRead) -> Eff es (Handle 'HandleModeRead)
forall a (es :: [Effect]). IO a -> Eff es a
unsafeEff_
(IO (Handle 'HandleModeRead) -> Eff es (Handle 'HandleModeRead))
-> (OsPath -> IO (Handle 'HandleModeRead))
-> OsPath
-> Eff es (Handle 'HandleModeRead)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Handle -> Handle 'HandleModeRead)
-> IO Handle -> IO (Handle 'HandleModeRead)
forall a b. (a -> b) -> IO a -> IO b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Handle -> Handle 'HandleModeRead
forall (p :: HandleMode). Handle -> Handle p
MkHandle
(IO Handle -> IO (Handle 'HandleModeRead))
-> (OsPath -> IO Handle) -> OsPath -> IO (Handle 'HandleModeRead)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (\OsPath
p -> OsPath -> IOMode -> IO Handle
openBinaryFileIO OsPath
p IOMode
ReadMode)
withBinaryFile ::
( HandleReader :> es,
HasCallStack
) =>
OsPath ->
(Handle HandleModeRead -> Eff es a) ->
Eff es a
withBinaryFile :: forall (es :: [Effect]) a.
(HandleReader :> es, HasCallStack) =>
OsPath -> (Handle 'HandleModeRead -> Eff es a) -> Eff es a
withBinaryFile OsPath
p Handle 'HandleModeRead -> Eff es a
onHandle =
(Env es -> IO a) -> Eff es a
forall (es :: [Effect]) a. (Env es -> IO a) -> Eff es a
unsafeEff ((Env es -> IO a) -> Eff es a) -> (Env es -> IO a) -> Eff es a
forall a b. (a -> b) -> a -> b
$ \Env es
env -> Env es -> ((forall r. Eff es r -> IO r) -> IO a) -> IO a
forall (es :: [Effect]) a.
HasCallStack =>
Env es -> ((forall r. Eff es r -> IO r) -> IO a) -> IO a
seqUnliftIO Env es
env (((forall r. Eff es r -> IO r) -> IO a) -> IO a)
-> ((forall r. Eff es r -> IO r) -> IO a) -> IO a
forall a b. (a -> b) -> a -> b
$ \forall r. Eff es r -> IO r
unlift ->
OsPath -> IOMode -> (Handle -> IO a) -> IO a
forall a. OsPath -> IOMode -> (Handle -> IO a) -> IO a
withBinaryFileIO OsPath
p IOMode
ReadMode (Eff es a -> IO a
forall r. Eff es r -> IO r
unlift (Eff es a -> IO a) -> (Handle -> Eff es a) -> Handle -> IO a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle 'HandleModeRead -> Eff es a
onHandle (Handle 'HandleModeRead -> Eff es a)
-> (Handle -> Handle 'HandleModeRead) -> Handle -> Eff es a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle -> Handle 'HandleModeRead
forall (p :: HandleMode). Handle -> Handle p
MkHandle)
hIsEOF ::
( CanRead p,
HandleReader :> es,
HasCallStack
) =>
Handle p ->
Eff es Bool
hIsEOF :: forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Eff es Bool
hIsEOF = IO Bool -> Eff es Bool
forall a (es :: [Effect]). IO a -> Eff es a
unsafeEff_ (IO Bool -> Eff es Bool)
-> (Handle p -> IO Bool) -> Handle p -> Eff es Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle -> IO Bool
IO.hIsEOF (Handle -> IO Bool) -> (Handle p -> Handle) -> Handle p -> IO Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle p -> Handle
forall (p :: HandleMode). Handle p -> Handle
Internal.unHandle
hGetBuffering ::
( CanRead p,
HandleReader :> es,
HasCallStack
) =>
Handle p ->
Eff es BufferMode
hGetBuffering :: forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Eff es BufferMode
hGetBuffering = IO BufferMode -> Eff es BufferMode
forall a (es :: [Effect]). IO a -> Eff es a
unsafeEff_ (IO BufferMode -> Eff es BufferMode)
-> (Handle p -> IO BufferMode) -> Handle p -> Eff es BufferMode
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle -> IO BufferMode
IO.hGetBuffering (Handle -> IO BufferMode)
-> (Handle p -> Handle) -> Handle p -> IO BufferMode
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle p -> Handle
forall (p :: HandleMode). Handle p -> Handle
Internal.unHandle
hIsOpen ::
( CanRead p,
HandleReader :> es,
HasCallStack
) =>
Handle p ->
Eff es Bool
hIsOpen :: forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Eff es Bool
hIsOpen = IO Bool -> Eff es Bool
forall a (es :: [Effect]). IO a -> Eff es a
unsafeEff_ (IO Bool -> Eff es Bool)
-> (Handle p -> IO Bool) -> Handle p -> Eff es Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle -> IO Bool
IO.hIsOpen (Handle -> IO Bool) -> (Handle p -> Handle) -> Handle p -> IO Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle p -> Handle
forall (p :: HandleMode). Handle p -> Handle
Internal.unHandle
hIsClosed ::
( CanRead p,
HandleReader :> es,
HasCallStack
) =>
Handle p ->
Eff es Bool
hIsClosed :: forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Eff es Bool
hIsClosed = IO Bool -> Eff es Bool
forall a (es :: [Effect]). IO a -> Eff es a
unsafeEff_ (IO Bool -> Eff es Bool)
-> (Handle p -> IO Bool) -> Handle p -> Eff es Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle -> IO Bool
IO.hIsClosed (Handle -> IO Bool) -> (Handle p -> Handle) -> Handle p -> IO Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle p -> Handle
forall (p :: HandleMode). Handle p -> Handle
Internal.unHandle
hIsReadable ::
( CanRead p,
HandleReader :> es,
HasCallStack
) =>
Handle p ->
Eff es Bool
hIsReadable :: forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Eff es Bool
hIsReadable = IO Bool -> Eff es Bool
forall a (es :: [Effect]). IO a -> Eff es a
unsafeEff_ (IO Bool -> Eff es Bool)
-> (Handle p -> IO Bool) -> Handle p -> Eff es Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle -> IO Bool
IO.hIsReadable (Handle -> IO Bool) -> (Handle p -> Handle) -> Handle p -> IO Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle p -> Handle
forall (p :: HandleMode). Handle p -> Handle
Internal.unHandle
hIsWritable ::
( CanRead p,
HandleReader :> es,
HasCallStack
) =>
Handle p ->
Eff es Bool
hIsWritable :: forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Eff es Bool
hIsWritable = IO Bool -> Eff es Bool
forall a (es :: [Effect]). IO a -> Eff es a
unsafeEff_ (IO Bool -> Eff es Bool)
-> (Handle p -> IO Bool) -> Handle p -> Eff es Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle -> IO Bool
IO.hIsWritable (Handle -> IO Bool) -> (Handle p -> Handle) -> Handle p -> IO Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle p -> Handle
forall (p :: HandleMode). Handle p -> Handle
Internal.unHandle
hIsSeekable ::
( CanRead p,
HandleReader :> es,
HasCallStack
) =>
Handle p ->
Eff es Bool
hIsSeekable :: forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Eff es Bool
hIsSeekable = IO Bool -> Eff es Bool
forall a (es :: [Effect]). IO a -> Eff es a
unsafeEff_ (IO Bool -> Eff es Bool)
-> (Handle p -> IO Bool) -> Handle p -> Eff es Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle -> IO Bool
IO.hIsSeekable (Handle -> IO Bool) -> (Handle p -> Handle) -> Handle p -> IO Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle p -> Handle
forall (p :: HandleMode). Handle p -> Handle
Internal.unHandle
hIsTerminalDevice ::
( CanRead p,
HandleReader :> es,
HasCallStack
) =>
Handle p ->
Eff es Bool
hIsTerminalDevice :: forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Eff es Bool
hIsTerminalDevice = IO Bool -> Eff es Bool
forall a (es :: [Effect]). IO a -> Eff es a
unsafeEff_ (IO Bool -> Eff es Bool)
-> (Handle p -> IO Bool) -> Handle p -> Eff es Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle -> IO Bool
IO.hIsTerminalDevice (Handle -> IO Bool) -> (Handle p -> Handle) -> Handle p -> IO Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle p -> Handle
forall (p :: HandleMode). Handle p -> Handle
Internal.unHandle
hGetEcho ::
( CanRead p,
HandleReader :> es,
HasCallStack
) =>
Handle p ->
Eff es Bool
hGetEcho :: forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Eff es Bool
hGetEcho = IO Bool -> Eff es Bool
forall a (es :: [Effect]). IO a -> Eff es a
unsafeEff_ (IO Bool -> Eff es Bool)
-> (Handle p -> IO Bool) -> Handle p -> Eff es Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle -> IO Bool
IO.hGetEcho (Handle -> IO Bool) -> (Handle p -> Handle) -> Handle p -> IO Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle p -> Handle
forall (p :: HandleMode). Handle p -> Handle
Internal.unHandle
hWaitForInput ::
( CanRead p,
HandleReader :> es,
HasCallStack
) =>
Handle p ->
Int ->
Eff es Bool
hWaitForInput :: forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Int -> Eff es Bool
hWaitForInput Handle p
h = IO Bool -> Eff es Bool
forall a (es :: [Effect]). IO a -> Eff es a
unsafeEff_ (IO Bool -> Eff es Bool) -> (Int -> IO Bool) -> Int -> Eff es Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle -> Int -> IO Bool
IO.hWaitForInput (Handle p -> Handle
forall (p :: HandleMode). Handle p -> Handle
Internal.unHandle Handle p
h)
hReady ::
( CanRead p,
HandleReader :> es,
HasCallStack
) =>
Handle p ->
Eff es Bool
hReady :: forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Eff es Bool
hReady = IO Bool -> Eff es Bool
forall a (es :: [Effect]). IO a -> Eff es a
unsafeEff_ (IO Bool -> Eff es Bool)
-> (Handle p -> IO Bool) -> Handle p -> Eff es Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle -> IO Bool
IO.hReady (Handle -> IO Bool) -> (Handle p -> Handle) -> Handle p -> IO Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle p -> Handle
forall (p :: HandleMode). Handle p -> Handle
Internal.unHandle
hGetChar ::
( CanRead p,
HandleReader :> es,
HasCallStack
) =>
Handle p ->
Eff es Char
hGetChar :: forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Eff es Char
hGetChar = IO Char -> Eff es Char
forall a (es :: [Effect]). IO a -> Eff es a
unsafeEff_ (IO Char -> Eff es Char)
-> (Handle p -> IO Char) -> Handle p -> Eff es Char
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle -> IO Char
IO.hGetChar (Handle -> IO Char) -> (Handle p -> Handle) -> Handle p -> IO Char
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle p -> Handle
forall (p :: HandleMode). Handle p -> Handle
Internal.unHandle
hGetLine ::
( CanRead p,
HandleReader :> es,
HasCallStack
) =>
Handle p ->
Eff es ByteString
hGetLine :: forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Eff es ByteString
hGetLine = IO ByteString -> Eff es ByteString
forall a (es :: [Effect]). IO a -> Eff es a
unsafeEff_ (IO ByteString -> Eff es ByteString)
-> (Handle p -> IO ByteString) -> Handle p -> Eff es ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle -> IO ByteString
C8.hGetLine (Handle -> IO ByteString)
-> (Handle p -> Handle) -> Handle p -> IO ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle p -> Handle
forall (p :: HandleMode). Handle p -> Handle
Internal.unHandle
hGetContents ::
( CanRead p,
HandleReader :> es,
HasCallStack
) =>
Handle p ->
Eff es ByteString
hGetContents :: forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Eff es ByteString
hGetContents = IO ByteString -> Eff es ByteString
forall a (es :: [Effect]). IO a -> Eff es a
unsafeEff_ (IO ByteString -> Eff es ByteString)
-> (Handle p -> IO ByteString) -> Handle p -> Eff es ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle -> IO ByteString
C8.hGetContents (Handle -> IO ByteString)
-> (Handle p -> Handle) -> Handle p -> IO ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle p -> Handle
forall (p :: HandleMode). Handle p -> Handle
Internal.unHandle
hGet ::
( CanRead p,
HandleReader :> es,
HasCallStack
) =>
Handle p ->
Int ->
Eff es ByteString
hGet :: forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Int -> Eff es ByteString
hGet Handle p
h = IO ByteString -> Eff es ByteString
forall a (es :: [Effect]). IO a -> Eff es a
unsafeEff_ (IO ByteString -> Eff es ByteString)
-> (Int -> IO ByteString) -> Int -> Eff es ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle -> Int -> IO ByteString
C8.hGet (Handle p -> Handle
forall (p :: HandleMode). Handle p -> Handle
Internal.unHandle Handle p
h)
hGetSome ::
( CanRead p,
HandleReader :> es,
HasCallStack
) =>
Handle p ->
Int ->
Eff es ByteString
hGetSome :: forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Int -> Eff es ByteString
hGetSome Handle p
h = IO ByteString -> Eff es ByteString
forall a (es :: [Effect]). IO a -> Eff es a
unsafeEff_ (IO ByteString -> Eff es ByteString)
-> (Int -> IO ByteString) -> Int -> Eff es ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle -> Int -> IO ByteString
C8.hGetSome (Handle p -> Handle
forall (p :: HandleMode). Handle p -> Handle
Internal.unHandle Handle p
h)
hGetNonBlocking ::
( CanRead p,
HandleReader :> es,
HasCallStack
) =>
Handle p ->
Int ->
Eff es ByteString
hGetNonBlocking :: forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Int -> Eff es ByteString
hGetNonBlocking Handle p
h = IO ByteString -> Eff es ByteString
forall a (es :: [Effect]). IO a -> Eff es a
unsafeEff_ (IO ByteString -> Eff es ByteString)
-> (Int -> IO ByteString) -> Int -> Eff es ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle -> Int -> IO ByteString
C8.hGetNonBlocking (Handle p -> Handle
forall (p :: HandleMode). Handle p -> Handle
Internal.unHandle Handle p
h)
hLockRaw ::
( CanRead p,
HandleReader :> es,
HasCallStack
) =>
Handle p ->
Eff es ()
hLockRaw :: forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Eff es ()
hLockRaw Handle p
h = IO () -> Eff es ()
forall a (es :: [Effect]). IO a -> Eff es a
unsafeEff_ (IO () -> Eff es ()) -> IO () -> Eff es ()
forall a b. (a -> b) -> a -> b
$ Handle -> LockMode -> IO ()
Lock.hLock (Handle p -> Handle
forall (p :: HandleMode). Handle p -> Handle
Internal.unHandle Handle p
h) LockMode
Lock.SharedLock
hTryLockRaw ::
( CanRead p,
HandleReader :> es,
HasCallStack
) =>
Handle p ->
Eff es Bool
hTryLockRaw :: forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Eff es Bool
hTryLockRaw Handle p
h = IO Bool -> Eff es Bool
forall a (es :: [Effect]). IO a -> Eff es a
unsafeEff_ (IO Bool -> Eff es Bool) -> IO Bool -> Eff es Bool
forall a b. (a -> b) -> a -> b
$ Handle -> LockMode -> IO Bool
Lock.hTryLock (Handle p -> Handle
forall (p :: HandleMode). Handle p -> Handle
Internal.unHandle Handle p
h) LockMode
Lock.SharedLock
hUnlockRaw ::
( CanRead p,
HandleReader :> es,
HasCallStack
) =>
Handle p ->
Eff es ()
hUnlockRaw :: forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Eff es ()
hUnlockRaw = IO () -> Eff es ()
forall a (es :: [Effect]). IO a -> Eff es a
unsafeEff_ (IO () -> Eff es ())
-> (Handle p -> IO ()) -> Handle p -> Eff es ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle -> IO ()
Lock.hUnlock (Handle -> IO ()) -> (Handle p -> Handle) -> Handle p -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle p -> Handle
forall (p :: HandleMode). Handle p -> Handle
Internal.unHandle
hLock ::
( CanRead p,
HandleReader :> es,
HasCallStack
) =>
Handle p ->
Eff es (LockedHandle p)
hLock :: forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Eff es (LockedHandle p)
hLock = (Handle p -> Eff es ()) -> Handle p -> Eff es (LockedHandle p)
forall (f :: * -> *) (p :: HandleMode).
Functor f =>
(Handle p -> f ()) -> Handle p -> f (LockedHandle p)
Internal.liftLock Handle p -> Eff es ()
forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Eff es ()
hLockRaw
hTryLock ::
( CanRead p,
HandleReader :> es,
HasCallStack
) =>
Handle p ->
Eff es (Maybe (LockedHandle p))
hTryLock :: forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Eff es (Maybe (LockedHandle p))
hTryLock = (Handle p -> Eff es Bool)
-> Handle p -> Eff es (Maybe (LockedHandle p))
forall (f :: * -> *) (p :: HandleMode).
Functor f =>
(Handle p -> f Bool) -> Handle p -> f (Maybe (LockedHandle p))
Internal.liftTryLock Handle p -> Eff es Bool
forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Eff es Bool
hTryLockRaw
hUnlock ::
( CanRead p,
HandleReader :> es,
HasCallStack
) =>
LockedHandle p ->
Eff es (Handle p)
hUnlock :: forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
LockedHandle p -> Eff es (Handle p)
hUnlock = (Handle p -> Eff es ()) -> LockedHandle p -> Eff es (Handle p)
forall (f :: * -> *) (p :: HandleMode).
Functor f =>
(Handle p -> f ()) -> LockedHandle p -> f (Handle p)
Internal.liftUnlock Handle p -> Eff es ()
forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Eff es ()
hUnlockRaw
withLockedFile ::
( CanRead p,
HandleReader :> es,
HasCallStack
) =>
Handle p ->
(LockedHandle p -> Eff es a) ->
Eff es a
withLockedFile :: forall (p :: HandleMode) (es :: [Effect]) a.
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> (LockedHandle p -> Eff es a) -> Eff es a
withLockedFile = (Handle p -> Eff es ())
-> (Handle p -> Eff es ())
-> Handle p
-> (LockedHandle p -> Eff es a)
-> Eff es a
forall (p :: HandleMode) (es :: [Effect]) a.
HasCallStack =>
(Handle p -> Eff es ())
-> (Handle p -> Eff es ())
-> Handle p
-> (LockedHandle p -> Eff es a)
-> Eff es a
Internal.withLockedFile Handle p -> Eff es ()
forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Eff es ()
hLockRaw Handle p -> Eff es ()
forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Eff es ()
hUnlockRaw
withTryLockedFile ::
forall p a es.
( CanRead p,
HandleReader :> es,
HasCallStack
) =>
Handle p ->
(LockedHandle p -> Eff es a) ->
Eff es (Maybe a)
withTryLockedFile :: forall (p :: HandleMode) a (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> (LockedHandle p -> Eff es a) -> Eff es (Maybe a)
withTryLockedFile = (Handle p -> Eff es Bool)
-> (Handle p -> Eff es ())
-> Handle p
-> (LockedHandle p -> Eff es a)
-> Eff es (Maybe a)
forall (p :: HandleMode) a (es :: [Effect]).
HasCallStack =>
(Handle p -> Eff es Bool)
-> (Handle p -> Eff es ())
-> Handle p
-> (LockedHandle p -> Eff es a)
-> Eff es (Maybe a)
Internal.withTryLockedFile Handle p -> Eff es Bool
forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Eff es Bool
hTryLockRaw Handle p -> Eff es ()
forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Eff es ()
hUnlockRaw
withLockedFileRaw ::
( CanRead p,
HandleReader :> es,
HasCallStack
) =>
Handle p ->
Eff es a ->
Eff es a
withLockedFileRaw :: forall (p :: HandleMode) (es :: [Effect]) a.
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Eff es a -> Eff es a
withLockedFileRaw Handle p
h = Eff es () -> Eff es () -> Eff es a -> Eff es a
forall (es :: [Effect]) a b c.
Eff es a -> Eff es b -> Eff es c -> Eff es c
bracket_ (Handle p -> Eff es ()
forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Eff es ()
hLockRaw Handle p
h) (Handle p -> Eff es ()
forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Eff es ()
hUnlockRaw Handle p
h)
withTryLockedFileRaw ::
forall p a es.
( CanRead p,
HandleReader :> es,
HasCallStack
) =>
Handle p ->
Eff es a ->
Eff es (Maybe a)
withTryLockedFileRaw :: forall (p :: HandleMode) a (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Eff es a -> Eff es (Maybe a)
withTryLockedFileRaw Handle p
h Eff es a
m =
Eff es (Maybe ())
-> (Maybe () -> Eff es (Maybe ()))
-> (Maybe () -> Eff es (Maybe a))
-> Eff es (Maybe a)
forall (es :: [Effect]) a b c.
Eff es a -> (a -> Eff es b) -> (a -> Eff es c) -> Eff es c
bracket
( do
locked <- Handle p -> Eff es Bool
forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Eff es Bool
hTryLockRaw Handle p
h
pure $
if locked
then Just ()
else Nothing
)
((() -> Eff es ()) -> Maybe () -> Eff es (Maybe ())
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Maybe a -> f (Maybe b)
traverse (Eff es () -> () -> Eff es ()
forall a b. a -> b -> a
const (Handle p -> Eff es ()
forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Eff es ()
hUnlockRaw Handle p
h)))
((() -> Eff es a) -> Maybe () -> Eff es (Maybe a)
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Maybe a -> f (Maybe b)
traverse (Eff es a -> () -> Eff es a
forall a b. a -> b -> a
const Eff es a
m))
hGetLineUtf8 ::
( CanRead p,
HandleReader :> es,
HasCallStack
) =>
Handle p ->
Eff es (Either UnicodeException Text)
hGetLineUtf8 :: forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Eff es (Either UnicodeException Text)
hGetLineUtf8 = (ByteString -> Either UnicodeException Text)
-> Eff es ByteString -> Eff es (Either UnicodeException Text)
forall a b. (a -> b) -> Eff es a -> Eff es b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> Either UnicodeException Text
FS.UTF8.decodeUtf8 (Eff es ByteString -> Eff es (Either UnicodeException Text))
-> (Handle p -> Eff es ByteString)
-> Handle p
-> Eff es (Either UnicodeException Text)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle p -> Eff es ByteString
forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Eff es ByteString
hGetLine
hGetLineUtf8Lenient ::
( CanRead p,
HandleReader :> es,
HasCallStack
) =>
Handle p ->
Eff es Text
hGetLineUtf8Lenient :: forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Eff es Text
hGetLineUtf8Lenient = (ByteString -> Text) -> Eff es ByteString -> Eff es Text
forall a b. (a -> b) -> Eff es a -> Eff es b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> Text
FS.UTF8.decodeUtf8Lenient (Eff es ByteString -> Eff es Text)
-> (Handle p -> Eff es ByteString) -> Handle p -> Eff es Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle p -> Eff es ByteString
forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Eff es ByteString
hGetLine
hGetLineUtf8ThrowM ::
( CanRead p,
HandleReader :> es,
HasCallStack
) =>
Handle p ->
Eff es Text
hGetLineUtf8ThrowM :: forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Eff es Text
hGetLineUtf8ThrowM = Handle p -> Eff es ByteString
forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Eff es ByteString
hGetLine (Handle p -> Eff es ByteString)
-> (ByteString -> Eff es Text) -> Handle p -> Eff es Text
forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=> ByteString -> Eff es Text
forall (m :: * -> *).
(HasCallStack, MonadThrow m) =>
ByteString -> m Text
FS.UTF8.decodeUtf8ThrowM
hGetContentsUtf8 ::
( CanRead p,
HandleReader :> es,
HasCallStack
) =>
Handle p ->
Eff es (Either UnicodeException Text)
hGetContentsUtf8 :: forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Eff es (Either UnicodeException Text)
hGetContentsUtf8 = (ByteString -> Either UnicodeException Text)
-> Eff es ByteString -> Eff es (Either UnicodeException Text)
forall a b. (a -> b) -> Eff es a -> Eff es b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> Either UnicodeException Text
FS.UTF8.decodeUtf8 (Eff es ByteString -> Eff es (Either UnicodeException Text))
-> (Handle p -> Eff es ByteString)
-> Handle p
-> Eff es (Either UnicodeException Text)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle p -> Eff es ByteString
forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Eff es ByteString
hGetContents
hGetContentsUtf8Lenient ::
( CanRead p,
HandleReader :> es,
HasCallStack
) =>
Handle p ->
Eff es Text
hGetContentsUtf8Lenient :: forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Eff es Text
hGetContentsUtf8Lenient = (ByteString -> Text) -> Eff es ByteString -> Eff es Text
forall a b. (a -> b) -> Eff es a -> Eff es b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> Text
FS.UTF8.decodeUtf8Lenient (Eff es ByteString -> Eff es Text)
-> (Handle p -> Eff es ByteString) -> Handle p -> Eff es Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle p -> Eff es ByteString
forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Eff es ByteString
hGetContents
hGetContentsUtf8ThrowM ::
( CanRead p,
HandleReader :> es,
HasCallStack
) =>
Handle p ->
Eff es Text
hGetContentsUtf8ThrowM :: forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Eff es Text
hGetContentsUtf8ThrowM = Handle p -> Eff es ByteString
forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Eff es ByteString
hGetContents (Handle p -> Eff es ByteString)
-> (ByteString -> Eff es Text) -> Handle p -> Eff es Text
forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=> ByteString -> Eff es Text
forall (m :: * -> *).
(HasCallStack, MonadThrow m) =>
ByteString -> m Text
FS.UTF8.decodeUtf8ThrowM
hGetUtf8 ::
( CanRead p,
HandleReader :> es,
HasCallStack
) =>
Handle p ->
Int ->
Eff es (Either UnicodeException Text)
hGetUtf8 :: forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Int -> Eff es (Either UnicodeException Text)
hGetUtf8 Handle p
h = (ByteString -> Either UnicodeException Text)
-> Eff es ByteString -> Eff es (Either UnicodeException Text)
forall a b. (a -> b) -> Eff es a -> Eff es b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> Either UnicodeException Text
FS.UTF8.decodeUtf8 (Eff es ByteString -> Eff es (Either UnicodeException Text))
-> (Int -> Eff es ByteString)
-> Int
-> Eff es (Either UnicodeException Text)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle p -> Int -> Eff es ByteString
forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Int -> Eff es ByteString
hGet Handle p
h
hGetUtf8Lenient ::
( CanRead p,
HandleReader :> es,
HasCallStack
) =>
Handle p ->
Int ->
Eff es Text
hGetUtf8Lenient :: forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Int -> Eff es Text
hGetUtf8Lenient Handle p
h = (ByteString -> Text) -> Eff es ByteString -> Eff es Text
forall a b. (a -> b) -> Eff es a -> Eff es b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> Text
FS.UTF8.decodeUtf8Lenient (Eff es ByteString -> Eff es Text)
-> (Int -> Eff es ByteString) -> Int -> Eff es Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle p -> Int -> Eff es ByteString
forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Int -> Eff es ByteString
hGet Handle p
h
hGetUtf8ThrowM ::
( CanRead p,
HandleReader :> es,
HasCallStack
) =>
Handle p ->
Int ->
Eff es Text
hGetUtf8ThrowM :: forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Int -> Eff es Text
hGetUtf8ThrowM Handle p
h = Handle p -> Int -> Eff es ByteString
forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Int -> Eff es ByteString
hGet Handle p
h (Int -> Eff es ByteString)
-> (ByteString -> Eff es Text) -> Int -> Eff es Text
forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=> ByteString -> Eff es Text
forall (m :: * -> *).
(HasCallStack, MonadThrow m) =>
ByteString -> m Text
FS.UTF8.decodeUtf8ThrowM
hGetSomeUtf8 ::
( CanRead p,
HandleReader :> es,
HasCallStack
) =>
Handle p ->
Int ->
Eff es (Either UnicodeException Text)
hGetSomeUtf8 :: forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Int -> Eff es (Either UnicodeException Text)
hGetSomeUtf8 Handle p
h = (ByteString -> Either UnicodeException Text)
-> Eff es ByteString -> Eff es (Either UnicodeException Text)
forall a b. (a -> b) -> Eff es a -> Eff es b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> Either UnicodeException Text
FS.UTF8.decodeUtf8 (Eff es ByteString -> Eff es (Either UnicodeException Text))
-> (Int -> Eff es ByteString)
-> Int
-> Eff es (Either UnicodeException Text)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle p -> Int -> Eff es ByteString
forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Int -> Eff es ByteString
hGetSome Handle p
h
hGetSomeUtf8Lenient ::
( CanRead p,
HandleReader :> es,
HasCallStack
) =>
Handle p ->
Int ->
Eff es Text
hGetSomeUtf8Lenient :: forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Int -> Eff es Text
hGetSomeUtf8Lenient Handle p
h = (ByteString -> Text) -> Eff es ByteString -> Eff es Text
forall a b. (a -> b) -> Eff es a -> Eff es b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> Text
FS.UTF8.decodeUtf8Lenient (Eff es ByteString -> Eff es Text)
-> (Int -> Eff es ByteString) -> Int -> Eff es Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle p -> Int -> Eff es ByteString
forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Int -> Eff es ByteString
hGetSome Handle p
h
hGetSomeUtf8ThrowM ::
( CanRead p,
HandleReader :> es,
HasCallStack
) =>
Handle p ->
Int ->
Eff es Text
hGetSomeUtf8ThrowM :: forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Int -> Eff es Text
hGetSomeUtf8ThrowM Handle p
h = Handle p -> Int -> Eff es ByteString
forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Int -> Eff es ByteString
hGetSome Handle p
h (Int -> Eff es ByteString)
-> (ByteString -> Eff es Text) -> Int -> Eff es Text
forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=> ByteString -> Eff es Text
forall (m :: * -> *).
(HasCallStack, MonadThrow m) =>
ByteString -> m Text
FS.UTF8.decodeUtf8ThrowM
hGetNonBlockingUtf8 ::
( CanRead p,
HandleReader :> es,
HasCallStack
) =>
Handle p ->
Int ->
Eff es (Either UnicodeException Text)
hGetNonBlockingUtf8 :: forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Int -> Eff es (Either UnicodeException Text)
hGetNonBlockingUtf8 Handle p
h = (ByteString -> Either UnicodeException Text)
-> Eff es ByteString -> Eff es (Either UnicodeException Text)
forall a b. (a -> b) -> Eff es a -> Eff es b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> Either UnicodeException Text
FS.UTF8.decodeUtf8 (Eff es ByteString -> Eff es (Either UnicodeException Text))
-> (Int -> Eff es ByteString)
-> Int
-> Eff es (Either UnicodeException Text)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle p -> Int -> Eff es ByteString
forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Int -> Eff es ByteString
hGetNonBlocking Handle p
h
hGetNonBlockingUtf8Lenient ::
( CanRead p,
HandleReader :> es,
HasCallStack
) =>
Handle p ->
Int ->
Eff es Text
hGetNonBlockingUtf8Lenient :: forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Int -> Eff es Text
hGetNonBlockingUtf8Lenient Handle p
h = (ByteString -> Text) -> Eff es ByteString -> Eff es Text
forall a b. (a -> b) -> Eff es a -> Eff es b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> Text
FS.UTF8.decodeUtf8Lenient (Eff es ByteString -> Eff es Text)
-> (Int -> Eff es ByteString) -> Int -> Eff es Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle p -> Int -> Eff es ByteString
forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Int -> Eff es ByteString
hGetNonBlocking Handle p
h
hGetNonBlockingUtf8ThrowM ::
( CanRead p,
HandleReader :> es,
HasCallStack
) =>
Handle p ->
Int ->
Eff es Text
hGetNonBlockingUtf8ThrowM :: forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Int -> Eff es Text
hGetNonBlockingUtf8ThrowM Handle p
h = Handle p -> Int -> Eff es ByteString
forall (p :: HandleMode) (es :: [Effect]).
(CanRead p, HandleReader :> es, HasCallStack) =>
Handle p -> Int -> Eff es ByteString
hGetNonBlocking Handle p
h (Int -> Eff es ByteString)
-> (ByteString -> Eff es Text) -> Int -> Eff es Text
forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=> ByteString -> Eff es Text
forall (m :: * -> *).
(HasCallStack, MonadThrow m) =>
ByteString -> m Text
FS.UTF8.decodeUtf8ThrowM