module Effects.FileSystem.HandleReader
(
MonadHandleReader (..),
hGetLineUtf8,
hGetLineUtf8Lenient,
hGetLineUtf8ThrowM,
hGetContentsUtf8,
hGetContentsUtf8Lenient,
hGetContentsUtf8ThrowM,
hGetUtf8,
hGetUtf8Lenient,
hGetUtf8ThrowM,
hGetSomeUtf8,
hGetSomeUtf8Lenient,
hGetSomeUtf8ThrowM,
hGetNonBlockingUtf8,
hGetNonBlockingUtf8Lenient,
hGetNonBlockingUtf8ThrowM,
ByteString,
Handle,
Text,
UnicodeException,
)
where
import Control.Monad ((>=>))
import Control.Monad.Catch (MonadThrow)
import Control.Monad.Trans.Class (MonadTrans (lift))
import Control.Monad.Trans.Reader (ReaderT)
import Data.ByteString (ByteString)
import Data.ByteString.Char8 qualified as C8
import Data.Text (Text)
import Data.Text.Encoding.Error (UnicodeException)
import FileSystem.UTF8 qualified as FS.UTF8
import GHC.Stack (HasCallStack)
import System.IO (BufferMode, Handle)
import System.IO qualified as IO
class (Monad m) => MonadHandleReader m where
hIsEOF :: (HasCallStack) => Handle -> m Bool
hGetBuffering :: (HasCallStack) => Handle -> m BufferMode
hIsOpen :: (HasCallStack) => Handle -> m Bool
hIsClosed :: (HasCallStack) => Handle -> m Bool
hIsReadable :: (HasCallStack) => Handle -> m Bool
hIsWritable :: (HasCallStack) => Handle -> m Bool
hIsSeekable :: (HasCallStack) => Handle -> m Bool
hIsTerminalDevice :: (HasCallStack) => Handle -> m Bool
hGetEcho :: (HasCallStack) => Handle -> m Bool
hWaitForInput :: (HasCallStack) => Handle -> Int -> m Bool
hReady :: (HasCallStack) => Handle -> m Bool
hGetChar :: (HasCallStack) => Handle -> m Char
hGetLine :: (HasCallStack) => Handle -> m ByteString
hGetContents :: (HasCallStack) => Handle -> m ByteString
hGet :: (HasCallStack) => Handle -> Int -> m ByteString
hGetSome :: (HasCallStack) => Handle -> Int -> m ByteString
hGetNonBlocking :: (HasCallStack) => Handle -> Int -> m ByteString
instance MonadHandleReader IO where
hIsEOF :: HasCallStack => Handle -> IO Bool
hIsEOF = Handle -> IO Bool
IO.hIsEOF
{-# INLINEABLE hIsEOF #-}
hGetBuffering :: HasCallStack => Handle -> IO BufferMode
hGetBuffering = Handle -> IO BufferMode
IO.hGetBuffering
{-# INLINEABLE hGetBuffering #-}
hIsOpen :: HasCallStack => Handle -> IO Bool
hIsOpen = Handle -> IO Bool
IO.hIsOpen
{-# INLINEABLE hIsOpen #-}
hIsClosed :: HasCallStack => Handle -> IO Bool
hIsClosed = Handle -> IO Bool
IO.hIsClosed
{-# INLINEABLE hIsClosed #-}
hIsReadable :: HasCallStack => Handle -> IO Bool
hIsReadable = Handle -> IO Bool
IO.hIsReadable
{-# INLINEABLE hIsReadable #-}
hIsWritable :: HasCallStack => Handle -> IO Bool
hIsWritable = Handle -> IO Bool
IO.hIsWritable
{-# INLINEABLE hIsWritable #-}
hIsSeekable :: HasCallStack => Handle -> IO Bool
hIsSeekable = Handle -> IO Bool
IO.hIsSeekable
{-# INLINEABLE hIsSeekable #-}
hIsTerminalDevice :: HasCallStack => Handle -> IO Bool
hIsTerminalDevice = Handle -> IO Bool
IO.hIsTerminalDevice
{-# INLINEABLE hIsTerminalDevice #-}
hGetEcho :: HasCallStack => Handle -> IO Bool
hGetEcho = Handle -> IO Bool
IO.hGetEcho
{-# INLINEABLE hGetEcho #-}
hWaitForInput :: HasCallStack => Handle -> Int -> IO Bool
hWaitForInput = Handle -> Int -> IO Bool
IO.hWaitForInput
{-# INLINEABLE hWaitForInput #-}
hReady :: HasCallStack => Handle -> IO Bool
hReady = Handle -> IO Bool
IO.hReady
{-# INLINEABLE hReady #-}
hGetChar :: HasCallStack => Handle -> IO Char
hGetChar = Handle -> IO Char
IO.hGetChar
{-# INLINEABLE hGetChar #-}
hGetLine :: HasCallStack => Handle -> IO ByteString
hGetLine = Handle -> IO ByteString
C8.hGetLine
{-# INLINEABLE hGetLine #-}
hGetContents :: HasCallStack => Handle -> IO ByteString
hGetContents = Handle -> IO ByteString
C8.hGetContents
{-# INLINEABLE hGetContents #-}
hGet :: HasCallStack => Handle -> Int -> IO ByteString
hGet = Handle -> Int -> IO ByteString
C8.hGet
{-# INLINEABLE hGet #-}
hGetSome :: HasCallStack => Handle -> Int -> IO ByteString
hGetSome = Handle -> Int -> IO ByteString
C8.hGetSome
{-# INLINEABLE hGetSome #-}
hGetNonBlocking :: HasCallStack => Handle -> Int -> IO ByteString
hGetNonBlocking = Handle -> Int -> IO ByteString
C8.hGetNonBlocking
{-# INLINEABLE hGetNonBlocking #-}
instance (MonadHandleReader m) => MonadHandleReader (ReaderT e m) where
hIsEOF :: HasCallStack => Handle -> ReaderT e m Bool
hIsEOF = m Bool -> ReaderT e m Bool
forall (m :: * -> *) a. Monad m => m a -> ReaderT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m Bool -> ReaderT e m Bool)
-> (Handle -> m Bool) -> Handle -> ReaderT e m Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle -> m Bool
forall (m :: * -> *).
(MonadHandleReader m, HasCallStack) =>
Handle -> m Bool
hIsEOF
{-# INLINEABLE hIsEOF #-}
hGetBuffering :: HasCallStack => Handle -> ReaderT e m BufferMode
hGetBuffering = m BufferMode -> ReaderT e m BufferMode
forall (m :: * -> *) a. Monad m => m a -> ReaderT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m BufferMode -> ReaderT e m BufferMode)
-> (Handle -> m BufferMode) -> Handle -> ReaderT e m BufferMode
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle -> m BufferMode
forall (m :: * -> *).
(MonadHandleReader m, HasCallStack) =>
Handle -> m BufferMode
hGetBuffering
{-# INLINEABLE hGetBuffering #-}
hIsOpen :: HasCallStack => Handle -> ReaderT e m Bool
hIsOpen = m Bool -> ReaderT e m Bool
forall (m :: * -> *) a. Monad m => m a -> ReaderT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m Bool -> ReaderT e m Bool)
-> (Handle -> m Bool) -> Handle -> ReaderT e m Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle -> m Bool
forall (m :: * -> *).
(MonadHandleReader m, HasCallStack) =>
Handle -> m Bool
hIsOpen
{-# INLINEABLE hIsOpen #-}
hIsClosed :: HasCallStack => Handle -> ReaderT e m Bool
hIsClosed = m Bool -> ReaderT e m Bool
forall (m :: * -> *) a. Monad m => m a -> ReaderT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m Bool -> ReaderT e m Bool)
-> (Handle -> m Bool) -> Handle -> ReaderT e m Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle -> m Bool
forall (m :: * -> *).
(MonadHandleReader m, HasCallStack) =>
Handle -> m Bool
hIsClosed
{-# INLINEABLE hIsClosed #-}
hIsReadable :: HasCallStack => Handle -> ReaderT e m Bool
hIsReadable = m Bool -> ReaderT e m Bool
forall (m :: * -> *) a. Monad m => m a -> ReaderT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m Bool -> ReaderT e m Bool)
-> (Handle -> m Bool) -> Handle -> ReaderT e m Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle -> m Bool
forall (m :: * -> *).
(MonadHandleReader m, HasCallStack) =>
Handle -> m Bool
hIsReadable
{-# INLINEABLE hIsReadable #-}
hIsWritable :: HasCallStack => Handle -> ReaderT e m Bool
hIsWritable = m Bool -> ReaderT e m Bool
forall (m :: * -> *) a. Monad m => m a -> ReaderT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m Bool -> ReaderT e m Bool)
-> (Handle -> m Bool) -> Handle -> ReaderT e m Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle -> m Bool
forall (m :: * -> *).
(MonadHandleReader m, HasCallStack) =>
Handle -> m Bool
hIsWritable
{-# INLINEABLE hIsWritable #-}
hIsSeekable :: HasCallStack => Handle -> ReaderT e m Bool
hIsSeekable = m Bool -> ReaderT e m Bool
forall (m :: * -> *) a. Monad m => m a -> ReaderT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m Bool -> ReaderT e m Bool)
-> (Handle -> m Bool) -> Handle -> ReaderT e m Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle -> m Bool
forall (m :: * -> *).
(MonadHandleReader m, HasCallStack) =>
Handle -> m Bool
hIsSeekable
{-# INLINEABLE hIsSeekable #-}
hIsTerminalDevice :: HasCallStack => Handle -> ReaderT e m Bool
hIsTerminalDevice = m Bool -> ReaderT e m Bool
forall (m :: * -> *) a. Monad m => m a -> ReaderT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m Bool -> ReaderT e m Bool)
-> (Handle -> m Bool) -> Handle -> ReaderT e m Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle -> m Bool
forall (m :: * -> *).
(MonadHandleReader m, HasCallStack) =>
Handle -> m Bool
hIsTerminalDevice
{-# INLINEABLE hIsTerminalDevice #-}
hGetEcho :: HasCallStack => Handle -> ReaderT e m Bool
hGetEcho = m Bool -> ReaderT e m Bool
forall (m :: * -> *) a. Monad m => m a -> ReaderT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m Bool -> ReaderT e m Bool)
-> (Handle -> m Bool) -> Handle -> ReaderT e m Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle -> m Bool
forall (m :: * -> *).
(MonadHandleReader m, HasCallStack) =>
Handle -> m Bool
hGetEcho
{-# INLINEABLE hGetEcho #-}
hWaitForInput :: HasCallStack => Handle -> Int -> ReaderT e m Bool
hWaitForInput Handle
h = m Bool -> ReaderT e m Bool
forall (m :: * -> *) a. Monad m => m a -> ReaderT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m Bool -> ReaderT e m Bool)
-> (Int -> m Bool) -> Int -> ReaderT e m Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle -> Int -> m Bool
forall (m :: * -> *).
(MonadHandleReader m, HasCallStack) =>
Handle -> Int -> m Bool
hWaitForInput Handle
h
{-# INLINEABLE hWaitForInput #-}
hReady :: HasCallStack => Handle -> ReaderT e m Bool
hReady = m Bool -> ReaderT e m Bool
forall (m :: * -> *) a. Monad m => m a -> ReaderT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m Bool -> ReaderT e m Bool)
-> (Handle -> m Bool) -> Handle -> ReaderT e m Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle -> m Bool
forall (m :: * -> *).
(MonadHandleReader m, HasCallStack) =>
Handle -> m Bool
hReady
{-# INLINEABLE hReady #-}
hGetChar :: HasCallStack => Handle -> ReaderT e m Char
hGetChar = m Char -> ReaderT e m Char
forall (m :: * -> *) a. Monad m => m a -> ReaderT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m Char -> ReaderT e m Char)
-> (Handle -> m Char) -> Handle -> ReaderT e m Char
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle -> m Char
forall (m :: * -> *).
(MonadHandleReader m, HasCallStack) =>
Handle -> m Char
hGetChar
{-# INLINEABLE hGetChar #-}
hGetLine :: HasCallStack => Handle -> ReaderT e m ByteString
hGetLine = m ByteString -> ReaderT e m ByteString
forall (m :: * -> *) a. Monad m => m a -> ReaderT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m ByteString -> ReaderT e m ByteString)
-> (Handle -> m ByteString) -> Handle -> ReaderT e m ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle -> m ByteString
forall (m :: * -> *).
(MonadHandleReader m, HasCallStack) =>
Handle -> m ByteString
hGetLine
{-# INLINEABLE hGetLine #-}
hGetContents :: HasCallStack => Handle -> ReaderT e m ByteString
hGetContents = m ByteString -> ReaderT e m ByteString
forall (m :: * -> *) a. Monad m => m a -> ReaderT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m ByteString -> ReaderT e m ByteString)
-> (Handle -> m ByteString) -> Handle -> ReaderT e m ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle -> m ByteString
forall (m :: * -> *).
(MonadHandleReader m, HasCallStack) =>
Handle -> m ByteString
hGetContents
{-# INLINEABLE hGetContents #-}
hGet :: HasCallStack => Handle -> Int -> ReaderT e m ByteString
hGet Handle
h = m ByteString -> ReaderT e m ByteString
forall (m :: * -> *) a. Monad m => m a -> ReaderT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m ByteString -> ReaderT e m ByteString)
-> (Int -> m ByteString) -> Int -> ReaderT e m ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle -> Int -> m ByteString
forall (m :: * -> *).
(MonadHandleReader m, HasCallStack) =>
Handle -> Int -> m ByteString
hGet Handle
h
{-# INLINEABLE hGet #-}
hGetSome :: HasCallStack => Handle -> Int -> ReaderT e m ByteString
hGetSome Handle
h = m ByteString -> ReaderT e m ByteString
forall (m :: * -> *) a. Monad m => m a -> ReaderT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m ByteString -> ReaderT e m ByteString)
-> (Int -> m ByteString) -> Int -> ReaderT e m ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle -> Int -> m ByteString
forall (m :: * -> *).
(MonadHandleReader m, HasCallStack) =>
Handle -> Int -> m ByteString
hGetSome Handle
h
{-# INLINEABLE hGetSome #-}
hGetNonBlocking :: HasCallStack => Handle -> Int -> ReaderT e m ByteString
hGetNonBlocking Handle
h = m ByteString -> ReaderT e m ByteString
forall (m :: * -> *) a. Monad m => m a -> ReaderT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m ByteString -> ReaderT e m ByteString)
-> (Int -> m ByteString) -> Int -> ReaderT e m ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle -> Int -> m ByteString
forall (m :: * -> *).
(MonadHandleReader m, HasCallStack) =>
Handle -> Int -> m ByteString
hGetNonBlocking Handle
h
{-# INLINEABLE hGetNonBlocking #-}
hGetLineUtf8 ::
( HasCallStack,
MonadHandleReader m
) =>
Handle ->
m (Either UnicodeException Text)
hGetLineUtf8 :: forall (m :: * -> *).
(HasCallStack, MonadHandleReader m) =>
Handle -> m (Either UnicodeException Text)
hGetLineUtf8 = (ByteString -> Either UnicodeException Text)
-> m ByteString -> m (Either UnicodeException Text)
forall a b. (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> Either UnicodeException Text
FS.UTF8.decodeUtf8 (m ByteString -> m (Either UnicodeException Text))
-> (Handle -> m ByteString)
-> Handle
-> m (Either UnicodeException Text)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle -> m ByteString
forall (m :: * -> *).
(MonadHandleReader m, HasCallStack) =>
Handle -> m ByteString
hGetLine
{-# INLINEABLE hGetLineUtf8 #-}
hGetLineUtf8Lenient :: (HasCallStack, MonadHandleReader m) => Handle -> m Text
hGetLineUtf8Lenient :: forall (m :: * -> *).
(HasCallStack, MonadHandleReader m) =>
Handle -> m Text
hGetLineUtf8Lenient = (ByteString -> Text) -> m ByteString -> m Text
forall a b. (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> Text
FS.UTF8.decodeUtf8Lenient (m ByteString -> m Text)
-> (Handle -> m ByteString) -> Handle -> m Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle -> m ByteString
forall (m :: * -> *).
(MonadHandleReader m, HasCallStack) =>
Handle -> m ByteString
hGetLine
{-# INLINEABLE hGetLineUtf8Lenient #-}
hGetLineUtf8ThrowM ::
( HasCallStack,
MonadHandleReader m,
MonadThrow m
) =>
Handle ->
m Text
hGetLineUtf8ThrowM :: forall (m :: * -> *).
(HasCallStack, MonadHandleReader m, MonadThrow m) =>
Handle -> m Text
hGetLineUtf8ThrowM = Handle -> m ByteString
forall (m :: * -> *).
(MonadHandleReader m, HasCallStack) =>
Handle -> m ByteString
hGetLine (Handle -> m ByteString)
-> (ByteString -> m Text) -> Handle -> m Text
forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=> ByteString -> m Text
forall (m :: * -> *).
(HasCallStack, MonadThrow m) =>
ByteString -> m Text
FS.UTF8.decodeUtf8ThrowM
{-# INLINEABLE hGetLineUtf8ThrowM #-}
hGetContentsUtf8 ::
( HasCallStack,
MonadHandleReader m
) =>
Handle ->
m (Either UnicodeException Text)
hGetContentsUtf8 :: forall (m :: * -> *).
(HasCallStack, MonadHandleReader m) =>
Handle -> m (Either UnicodeException Text)
hGetContentsUtf8 = (ByteString -> Either UnicodeException Text)
-> m ByteString -> m (Either UnicodeException Text)
forall a b. (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> Either UnicodeException Text
FS.UTF8.decodeUtf8 (m ByteString -> m (Either UnicodeException Text))
-> (Handle -> m ByteString)
-> Handle
-> m (Either UnicodeException Text)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle -> m ByteString
forall (m :: * -> *).
(MonadHandleReader m, HasCallStack) =>
Handle -> m ByteString
hGetContents
{-# INLINEABLE hGetContentsUtf8 #-}
hGetContentsUtf8Lenient ::
( HasCallStack,
MonadHandleReader m
) =>
Handle ->
m Text
hGetContentsUtf8Lenient :: forall (m :: * -> *).
(HasCallStack, MonadHandleReader m) =>
Handle -> m Text
hGetContentsUtf8Lenient = (ByteString -> Text) -> m ByteString -> m Text
forall a b. (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> Text
FS.UTF8.decodeUtf8Lenient (m ByteString -> m Text)
-> (Handle -> m ByteString) -> Handle -> m Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle -> m ByteString
forall (m :: * -> *).
(MonadHandleReader m, HasCallStack) =>
Handle -> m ByteString
hGetContents
{-# INLINEABLE hGetContentsUtf8Lenient #-}
hGetContentsUtf8ThrowM ::
( HasCallStack,
MonadHandleReader m,
MonadThrow m
) =>
Handle ->
m Text
hGetContentsUtf8ThrowM :: forall (m :: * -> *).
(HasCallStack, MonadHandleReader m, MonadThrow m) =>
Handle -> m Text
hGetContentsUtf8ThrowM = Handle -> m ByteString
forall (m :: * -> *).
(MonadHandleReader m, HasCallStack) =>
Handle -> m ByteString
hGetContents (Handle -> m ByteString)
-> (ByteString -> m Text) -> Handle -> m Text
forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=> ByteString -> m Text
forall (m :: * -> *).
(HasCallStack, MonadThrow m) =>
ByteString -> m Text
FS.UTF8.decodeUtf8ThrowM
{-# INLINEABLE hGetContentsUtf8ThrowM #-}
hGetUtf8 ::
( HasCallStack,
MonadHandleReader m
) =>
Handle ->
Int ->
m (Either UnicodeException Text)
hGetUtf8 :: forall (m :: * -> *).
(HasCallStack, MonadHandleReader m) =>
Handle -> Int -> m (Either UnicodeException Text)
hGetUtf8 Handle
h = (ByteString -> Either UnicodeException Text)
-> m ByteString -> m (Either UnicodeException Text)
forall a b. (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> Either UnicodeException Text
FS.UTF8.decodeUtf8 (m ByteString -> m (Either UnicodeException Text))
-> (Int -> m ByteString) -> Int -> m (Either UnicodeException Text)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle -> Int -> m ByteString
forall (m :: * -> *).
(MonadHandleReader m, HasCallStack) =>
Handle -> Int -> m ByteString
hGet Handle
h
{-# INLINEABLE hGetUtf8 #-}
hGetUtf8Lenient ::
( HasCallStack,
MonadHandleReader m
) =>
Handle ->
Int ->
m Text
hGetUtf8Lenient :: forall (m :: * -> *).
(HasCallStack, MonadHandleReader m) =>
Handle -> Int -> m Text
hGetUtf8Lenient Handle
h = (ByteString -> Text) -> m ByteString -> m Text
forall a b. (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> Text
FS.UTF8.decodeUtf8Lenient (m ByteString -> m Text) -> (Int -> m ByteString) -> Int -> m Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle -> Int -> m ByteString
forall (m :: * -> *).
(MonadHandleReader m, HasCallStack) =>
Handle -> Int -> m ByteString
hGet Handle
h
{-# INLINEABLE hGetUtf8Lenient #-}
hGetUtf8ThrowM ::
( HasCallStack,
MonadHandleReader m,
MonadThrow m
) =>
Handle ->
Int ->
m Text
hGetUtf8ThrowM :: forall (m :: * -> *).
(HasCallStack, MonadHandleReader m, MonadThrow m) =>
Handle -> Int -> m Text
hGetUtf8ThrowM Handle
h = Handle -> Int -> m ByteString
forall (m :: * -> *).
(MonadHandleReader m, HasCallStack) =>
Handle -> Int -> m ByteString
hGet Handle
h (Int -> m ByteString) -> (ByteString -> m Text) -> Int -> m Text
forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=> ByteString -> m Text
forall (m :: * -> *).
(HasCallStack, MonadThrow m) =>
ByteString -> m Text
FS.UTF8.decodeUtf8ThrowM
{-# INLINEABLE hGetUtf8ThrowM #-}
hGetSomeUtf8 ::
( HasCallStack,
MonadHandleReader m
) =>
Handle ->
Int ->
m (Either UnicodeException Text)
hGetSomeUtf8 :: forall (m :: * -> *).
(HasCallStack, MonadHandleReader m) =>
Handle -> Int -> m (Either UnicodeException Text)
hGetSomeUtf8 Handle
h = (ByteString -> Either UnicodeException Text)
-> m ByteString -> m (Either UnicodeException Text)
forall a b. (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> Either UnicodeException Text
FS.UTF8.decodeUtf8 (m ByteString -> m (Either UnicodeException Text))
-> (Int -> m ByteString) -> Int -> m (Either UnicodeException Text)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle -> Int -> m ByteString
forall (m :: * -> *).
(MonadHandleReader m, HasCallStack) =>
Handle -> Int -> m ByteString
hGetSome Handle
h
{-# INLINEABLE hGetSomeUtf8 #-}
hGetSomeUtf8Lenient ::
( HasCallStack,
MonadHandleReader m
) =>
Handle ->
Int ->
m Text
hGetSomeUtf8Lenient :: forall (m :: * -> *).
(HasCallStack, MonadHandleReader m) =>
Handle -> Int -> m Text
hGetSomeUtf8Lenient Handle
h = (ByteString -> Text) -> m ByteString -> m Text
forall a b. (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> Text
FS.UTF8.decodeUtf8Lenient (m ByteString -> m Text) -> (Int -> m ByteString) -> Int -> m Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle -> Int -> m ByteString
forall (m :: * -> *).
(MonadHandleReader m, HasCallStack) =>
Handle -> Int -> m ByteString
hGetSome Handle
h
{-# INLINEABLE hGetSomeUtf8Lenient #-}
hGetSomeUtf8ThrowM ::
( HasCallStack,
MonadHandleReader m,
MonadThrow m
) =>
Handle ->
Int ->
m Text
hGetSomeUtf8ThrowM :: forall (m :: * -> *).
(HasCallStack, MonadHandleReader m, MonadThrow m) =>
Handle -> Int -> m Text
hGetSomeUtf8ThrowM Handle
h = Handle -> Int -> m ByteString
forall (m :: * -> *).
(MonadHandleReader m, HasCallStack) =>
Handle -> Int -> m ByteString
hGetSome Handle
h (Int -> m ByteString) -> (ByteString -> m Text) -> Int -> m Text
forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=> ByteString -> m Text
forall (m :: * -> *).
(HasCallStack, MonadThrow m) =>
ByteString -> m Text
FS.UTF8.decodeUtf8ThrowM
{-# INLINEABLE hGetSomeUtf8ThrowM #-}
hGetNonBlockingUtf8 ::
( HasCallStack,
MonadHandleReader m
) =>
Handle ->
Int ->
m (Either UnicodeException Text)
hGetNonBlockingUtf8 :: forall (m :: * -> *).
(HasCallStack, MonadHandleReader m) =>
Handle -> Int -> m (Either UnicodeException Text)
hGetNonBlockingUtf8 Handle
h = (ByteString -> Either UnicodeException Text)
-> m ByteString -> m (Either UnicodeException Text)
forall a b. (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> Either UnicodeException Text
FS.UTF8.decodeUtf8 (m ByteString -> m (Either UnicodeException Text))
-> (Int -> m ByteString) -> Int -> m (Either UnicodeException Text)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle -> Int -> m ByteString
forall (m :: * -> *).
(MonadHandleReader m, HasCallStack) =>
Handle -> Int -> m ByteString
hGetNonBlocking Handle
h
{-# INLINEABLE hGetNonBlockingUtf8 #-}
hGetNonBlockingUtf8Lenient ::
( HasCallStack,
MonadHandleReader m
) =>
Handle ->
Int ->
m Text
hGetNonBlockingUtf8Lenient :: forall (m :: * -> *).
(HasCallStack, MonadHandleReader m) =>
Handle -> Int -> m Text
hGetNonBlockingUtf8Lenient Handle
h = (ByteString -> Text) -> m ByteString -> m Text
forall a b. (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> Text
FS.UTF8.decodeUtf8Lenient (m ByteString -> m Text) -> (Int -> m ByteString) -> Int -> m Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle -> Int -> m ByteString
forall (m :: * -> *).
(MonadHandleReader m, HasCallStack) =>
Handle -> Int -> m ByteString
hGetNonBlocking Handle
h
{-# INLINEABLE hGetNonBlockingUtf8Lenient #-}
hGetNonBlockingUtf8ThrowM ::
( HasCallStack,
MonadHandleReader m,
MonadThrow m
) =>
Handle ->
Int ->
m Text
hGetNonBlockingUtf8ThrowM :: forall (m :: * -> *).
(HasCallStack, MonadHandleReader m, MonadThrow m) =>
Handle -> Int -> m Text
hGetNonBlockingUtf8ThrowM Handle
h = Handle -> Int -> m ByteString
forall (m :: * -> *).
(MonadHandleReader m, HasCallStack) =>
Handle -> Int -> m ByteString
hGetNonBlocking Handle
h (Int -> m ByteString) -> (ByteString -> m Text) -> Int -> m Text
forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=> ByteString -> m Text
forall (m :: * -> *).
(HasCallStack, MonadThrow m) =>
ByteString -> m Text
FS.UTF8.decodeUtf8ThrowM
{-# INLINEABLE hGetNonBlockingUtf8ThrowM #-}