Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data BufferMode
- type FilePath = String
- data Handle
- data HandlePosn
- data IO a
- data IOMode
- data NewlineMode = NewlineMode {}
- data SeekMode
- data TextEncoding
- type String = [Char]
- stdin :: Handle
- stdout :: Handle
- stderr :: Handle
- withFile :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Resource r => Member Log r => FilePath -> IOMode -> (Handle -> Sem r a) -> Sem r a
- hClose :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Sem r ()
- openFile :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => FilePath -> IOMode -> Sem r Handle
- readFile :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => FilePath -> Sem r String
- appendFile :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => FilePath -> String -> Sem r ()
- writeFile :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => FilePath -> String -> Sem r ()
- hFileSize :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Sem r Integer
- hSetFileSize :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Integer -> Sem r ()
- hIsEOF :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Sem r Bool
- isEOF :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Sem r Bool
- hSetBuffering :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> BufferMode -> Sem r ()
- hGetBuffering :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Sem r BufferMode
- hFlush :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Sem r ()
- hGetPosn :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Sem r HandlePosn
- hSetPosn :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => HandlePosn -> Sem r ()
- hSeek :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> SeekMode -> Integer -> Sem r ()
- hTell :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Sem r Integer
- hIsOpen :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Sem r Bool
- hIsClosed :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Sem r Bool
- hIsReadable :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Sem r Bool
- hIsWritable :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Sem r Bool
- hIsSeekable :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Sem r Bool
- hIsTerminalDevice :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Sem r Bool
- hSetEcho :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Bool -> Sem r ()
- hGetEcho :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Sem r Bool
- hShow :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Sem r String
- hWaitForInput :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Int -> Sem r Bool
- hReady :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Sem r Bool
- hGetChar :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Sem r Char
- hGetLine :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Sem r String
- hLookAhead :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Sem r Char
- hGetContents :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Sem r String
- hGetContents' :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Sem r String
- hPutChar :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Char -> Sem r ()
- hPutStr :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> String -> Sem r ()
- hPutStrLn :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> String -> Sem r ()
- hPrint :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> String -> Sem r ()
- interact :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => (String -> String) -> Sem r ()
- putChar :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Char -> Sem r ()
- putStr :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => String -> Sem r ()
- putStrLn :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => String -> Sem r ()
- print :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => String -> Sem r ()
- getChar :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Sem r Char
- getLine :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Sem r String
- getContents :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Sem r String
- getContents' :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Sem r String
- readIO :: HasCallStack => Read a => Member (Error IOException) r => Member (Embed IO) r => Member Log r => String -> Sem r a
- readLn :: HasCallStack => Read a => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Sem r a
- withBinaryFile :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Resource r => Member Log r => FilePath -> IOMode -> (Handle -> Sem r a) -> Sem r a
- openBinaryFile :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => FilePath -> IOMode -> Sem r Handle
- hPutBuf :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Ptr a -> Int -> Sem r ()
- hGetBuf :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Ptr a -> Int -> Sem r Int
- hGetBufSome :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Ptr a -> Int -> Sem r Int
- hPutBufNonBlocking :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Ptr a -> Int -> Sem r Int
- hGetBufNonBlocking :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Ptr a -> Int -> Sem r Int
- openTempFile :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => FilePath -> String -> Sem r (FilePath, Handle)
- openBinaryTempFile :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => FilePath -> String -> Sem r (FilePath, Handle)
- openTempFileWithDefaultPermissions :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => FilePath -> String -> Sem r (FilePath, Handle)
- openBinaryTempFileWithDefaultPermissions :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => FilePath -> String -> Sem r (FilePath, Handle)
- hSetEncoding :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> TextEncoding -> Sem r ()
- hGetEncoding :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Sem r (Maybe TextEncoding)
- latin1 :: TextEncoding
- utf8 :: TextEncoding
- utf8_bom :: TextEncoding
- utf16 :: TextEncoding
- utf16le :: TextEncoding
- utf16be :: TextEncoding
- utf32 :: TextEncoding
- utf32le :: TextEncoding
- utf32be :: TextEncoding
- localeEncoding :: TextEncoding
- char8 :: TextEncoding
- mkTextEncoding :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => String -> Sem r TextEncoding
- hSetNewlineMode :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> NewlineMode -> Sem r ()
- nativeNewline :: Newline
- noNewlineTranslation :: NewlineMode
- universalNewlineMode :: NewlineMode
- nativeNewlineMode :: NewlineMode
Documentation
data BufferMode #
Three kinds of buffering are supported: line-buffering, block-buffering or no-buffering. These modes have the following effects. For output, items are written out, or flushed, from the internal buffer according to the buffer mode:
- line-buffering: the entire output buffer is flushed
whenever a newline is output, the buffer overflows,
a
hFlush
is issued, or the handle is closed. - block-buffering: the entire buffer is written out whenever it
overflows, a
hFlush
is issued, or the handle is closed. - no-buffering: output is written immediately, and never stored in the buffer.
An implementation is free to flush the buffer more frequently, but not less frequently, than specified above. The output buffer is emptied as soon as it has been written out.
Similarly, input occurs according to the buffer mode for the handle:
- line-buffering: when the buffer for the handle is not empty, the next item is obtained from the buffer; otherwise, when the buffer is empty, characters up to and including the next newline character are read into the buffer. No characters are available until the newline character is available or the buffer is full.
- block-buffering: when the buffer for the handle becomes empty, the next block of data is read into the buffer.
- no-buffering: the next input item is read and returned.
The
hLookAhead
operation implies that even a no-buffered handle may require a one-character buffer.
The default buffering mode when a handle is opened is implementation-dependent and may depend on the file system object which is attached to that handle. For most implementations, physical files will normally be block-buffered and terminals will normally be line-buffered.
NoBuffering | buffering is disabled if possible. |
LineBuffering | line-buffering should be enabled if possible. |
BlockBuffering (Maybe Int) | block-buffering should be enabled if possible.
The size of the buffer is |
Instances
Read BufferMode | Since: base-4.2.0.0 |
Defined in GHC.IO.Handle.Types readsPrec :: Int -> ReadS BufferMode # readList :: ReadS [BufferMode] # readPrec :: ReadPrec BufferMode # readListPrec :: ReadPrec [BufferMode] # | |
Show BufferMode | Since: base-4.2.0.0 |
Defined in GHC.IO.Handle.Types showsPrec :: Int -> BufferMode -> ShowS # show :: BufferMode -> String # showList :: [BufferMode] -> ShowS # | |
Eq BufferMode | Since: base-4.2.0.0 |
Defined in GHC.IO.Handle.Types (==) :: BufferMode -> BufferMode -> Bool # (/=) :: BufferMode -> BufferMode -> Bool # | |
Ord BufferMode | Since: base-4.2.0.0 |
Defined in GHC.IO.Handle.Types compare :: BufferMode -> BufferMode -> Ordering # (<) :: BufferMode -> BufferMode -> Bool # (<=) :: BufferMode -> BufferMode -> Bool # (>) :: BufferMode -> BufferMode -> Bool # (>=) :: BufferMode -> BufferMode -> Bool # max :: BufferMode -> BufferMode -> BufferMode # min :: BufferMode -> BufferMode -> BufferMode # |
File and directory names are values of type String
, whose precise
meaning is operating system dependent. Files can be opened, yielding a
handle which can then be used to operate on the contents of that file.
Haskell defines operations to read and write characters from and to files,
represented by values of type Handle
. Each value of this type is a
handle: a record used by the Haskell run-time system to manage I/O
with file system objects. A handle has at least the following properties:
- whether it manages input or output or both;
- whether it is open, closed or semi-closed;
- whether the object is seekable;
- whether buffering is disabled, or enabled on a line or block basis;
- a buffer (whose length may be zero).
Most handles will also have a current I/O position indicating where the next
input or output operation will occur. A handle is readable if it
manages only input or both input and output; likewise, it is writable if
it manages only output or both input and output. A handle is open when
first allocated.
Once it is closed it can no longer be used for either input or output,
though an implementation cannot re-use its storage while references
remain to it. Handles are in the Show
and Eq
classes. The string
produced by showing a handle is system dependent; it should include
enough information to identify the handle for debugging. A handle is
equal according to ==
only to itself; no attempt
is made to compare the internal state of different handles for equality.
data HandlePosn #
Instances
Show HandlePosn | Since: base-4.1.0.0 |
Defined in GHC.IO.Handle showsPrec :: Int -> HandlePosn -> ShowS # show :: HandlePosn -> String # showList :: [HandlePosn] -> ShowS # | |
Eq HandlePosn | Since: base-4.1.0.0 |
Defined in GHC.IO.Handle (==) :: HandlePosn -> HandlePosn -> Bool # (/=) :: HandlePosn -> HandlePosn -> Bool # |
A value of type
is a computation which, when performed,
does some I/O before returning a value of type IO
aa
.
There is really only one way to "perform" an I/O action: bind it to
Main.main
in your program. When your program is run, the I/O will
be performed. It isn't possible to perform I/O from an arbitrary
function, unless that function is itself in the IO
monad and called
at some point, directly or indirectly, from Main.main
.
IO
is a monad, so IO
actions can be combined using either the do-notation
or the >>
and >>=
operations from the Monad
class.
Instances
See openFile
data NewlineMode #
Specifies the translation, if any, of newline characters between
internal Strings and the external file or stream. Haskell Strings
are assumed to represent newlines with the '\n'
character; the
newline mode specifies how to translate '\n'
on output, and what to
translate into '\n'
on input.
Instances
Read NewlineMode | Since: base-4.3.0.0 |
Defined in GHC.IO.Handle.Types readsPrec :: Int -> ReadS NewlineMode # readList :: ReadS [NewlineMode] # readPrec :: ReadPrec NewlineMode # readListPrec :: ReadPrec [NewlineMode] # | |
Show NewlineMode | Since: base-4.3.0.0 |
Defined in GHC.IO.Handle.Types showsPrec :: Int -> NewlineMode -> ShowS # show :: NewlineMode -> String # showList :: [NewlineMode] -> ShowS # | |
Eq NewlineMode | Since: base-4.2.0.0 |
Defined in GHC.IO.Handle.Types (==) :: NewlineMode -> NewlineMode -> Bool # (/=) :: NewlineMode -> NewlineMode -> Bool # | |
Ord NewlineMode | Since: base-4.3.0.0 |
Defined in GHC.IO.Handle.Types compare :: NewlineMode -> NewlineMode -> Ordering # (<) :: NewlineMode -> NewlineMode -> Bool # (<=) :: NewlineMode -> NewlineMode -> Bool # (>) :: NewlineMode -> NewlineMode -> Bool # (>=) :: NewlineMode -> NewlineMode -> Bool # max :: NewlineMode -> NewlineMode -> NewlineMode # min :: NewlineMode -> NewlineMode -> NewlineMode # |
A mode that determines the effect of hSeek
hdl mode i
.
AbsoluteSeek | the position of |
RelativeSeek | the position of |
SeekFromEnd | the position of |
Instances
Enum SeekMode | Since: base-4.2.0.0 |
Ix SeekMode | Since: base-4.2.0.0 |
Defined in GHC.IO.Device | |
Read SeekMode | Since: base-4.2.0.0 |
Show SeekMode | Since: base-4.2.0.0 |
Eq SeekMode | Since: base-4.2.0.0 |
Ord SeekMode | Since: base-4.2.0.0 |
Defined in GHC.IO.Device |
data TextEncoding #
A TextEncoding
is a specification of a conversion scheme
between sequences of bytes and sequences of Unicode characters.
For example, UTF-8 is an encoding of Unicode characters into a sequence
of bytes. The TextEncoding
for UTF-8 is utf8
.
Instances
Show TextEncoding | Since: base-4.3.0.0 |
Defined in GHC.IO.Encoding.Types showsPrec :: Int -> TextEncoding -> ShowS # show :: TextEncoding -> String # showList :: [TextEncoding] -> ShowS # |
withFile :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Resource r => Member Log r => FilePath -> IOMode -> (Handle -> Sem r a) -> Sem r a Source #
Open a file handle and run an action, closing the handle when done.
hClose :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Sem r () Source #
Close the file handle.
openFile :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => FilePath -> IOMode -> Sem r Handle Source #
Open a file handle.
readFile :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => FilePath -> Sem r String Source #
Read a file as a string.
appendFile :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => FilePath -> String -> Sem r () Source #
writeFile :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => FilePath -> String -> Sem r () Source #
hFileSize :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Sem r Integer Source #
hSetFileSize :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Integer -> Sem r () Source #
hIsEOF :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Sem r Bool Source #
isEOF :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Sem r Bool Source #
hSetBuffering :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> BufferMode -> Sem r () Source #
hGetBuffering :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Sem r BufferMode Source #
hFlush :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Sem r () Source #
hGetPosn :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Sem r HandlePosn Source #
hSetPosn :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => HandlePosn -> Sem r () Source #
hSeek :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> SeekMode -> Integer -> Sem r () Source #
hTell :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Sem r Integer Source #
hIsOpen :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Sem r Bool Source #
hIsClosed :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Sem r Bool Source #
hIsReadable :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Sem r Bool Source #
hIsWritable :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Sem r Bool Source #
hIsSeekable :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Sem r Bool Source #
hIsTerminalDevice :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Sem r Bool Source #
hSetEcho :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Bool -> Sem r () Source #
hGetEcho :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Sem r Bool Source #
hShow :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Sem r String Source #
hWaitForInput :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Int -> Sem r Bool Source #
hReady :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Sem r Bool Source #
hGetChar :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Sem r Char Source #
hGetLine :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Sem r String Source #
hLookAhead :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Sem r Char Source #
hGetContents :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Sem r String Source #
hGetContents' :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Sem r String Source #
hPutChar :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Char -> Sem r () Source #
hPutStr :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> String -> Sem r () Source #
hPutStrLn :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> String -> Sem r () Source #
hPrint :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> String -> Sem r () Source #
interact :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => (String -> String) -> Sem r () Source #
putChar :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Char -> Sem r () Source #
putStr :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => String -> Sem r () Source #
putStrLn :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => String -> Sem r () Source #
print :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => String -> Sem r () Source #
getChar :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Sem r Char Source #
getLine :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Sem r String Source #
getContents :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Sem r String Source #
getContents' :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Sem r String Source #
readIO :: HasCallStack => Read a => Member (Error IOException) r => Member (Embed IO) r => Member Log r => String -> Sem r a Source #
readLn :: HasCallStack => Read a => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Sem r a Source #
withBinaryFile :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Resource r => Member Log r => FilePath -> IOMode -> (Handle -> Sem r a) -> Sem r a Source #
Open a file handle and run an action, closing the handle when done.
openBinaryFile :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => FilePath -> IOMode -> Sem r Handle Source #
Open a file handle.
hPutBuf :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Ptr a -> Int -> Sem r () Source #
hGetBuf :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Ptr a -> Int -> Sem r Int Source #
hGetBufSome :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Ptr a -> Int -> Sem r Int Source #
hPutBufNonBlocking :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Ptr a -> Int -> Sem r Int Source #
hGetBufNonBlocking :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Ptr a -> Int -> Sem r Int Source #
openTempFile :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => FilePath -> String -> Sem r (FilePath, Handle) Source #
openBinaryTempFile :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => FilePath -> String -> Sem r (FilePath, Handle) Source #
openTempFileWithDefaultPermissions :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => FilePath -> String -> Sem r (FilePath, Handle) Source #
openBinaryTempFileWithDefaultPermissions :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => FilePath -> String -> Sem r (FilePath, Handle) Source #
hSetEncoding :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> TextEncoding -> Sem r () Source #
hGetEncoding :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> Sem r (Maybe TextEncoding) Source #
latin1 :: TextEncoding #
utf8 :: TextEncoding #
The UTF-8 Unicode encoding
The UTF-8 Unicode encoding, with a byte-order-mark (BOM; the byte
sequence 0xEF 0xBB 0xBF). This encoding behaves like utf8
,
except that on input, the BOM sequence is ignored at the beginning
of the stream, and on output, the BOM sequence is prepended.
The byte-order-mark is strictly unnecessary in UTF-8, but is sometimes used to identify the encoding of a file.
utf16 :: TextEncoding #
The UTF-16 Unicode encoding (a byte-order-mark should be used to indicate endianness).
utf16le :: TextEncoding #
The UTF-16 Unicode encoding (little-endian)
utf16be :: TextEncoding #
The UTF-16 Unicode encoding (big-endian)
utf32 :: TextEncoding #
The UTF-32 Unicode encoding (a byte-order-mark should be used to indicate endianness).
utf32le :: TextEncoding #
The UTF-32 Unicode encoding (little-endian)
utf32be :: TextEncoding #
The UTF-32 Unicode encoding (big-endian)
localeEncoding :: TextEncoding #
The Unicode encoding of the current locale
This is the initial locale encoding: if it has been subsequently changed by
setLocaleEncoding
this value will not reflect that change.
char8 :: TextEncoding #
An encoding in which Unicode code points are translated to bytes by taking the code point modulo 256. When decoding, bytes are translated directly into the equivalent code point.
This encoding never fails in either direction. However, encoding discards information, so encode followed by decode is not the identity.
Since: base-4.4.0.0
mkTextEncoding :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => String -> Sem r TextEncoding Source #
hSetNewlineMode :: HasCallStack => Member (Error IOException) r => Member (Embed IO) r => Member Log r => Handle -> NewlineMode -> Sem r () Source #
noNewlineTranslation :: NewlineMode #
Do no newline translation at all.
noNewlineTranslation = NewlineMode { inputNL = LF, outputNL = LF }
universalNewlineMode :: NewlineMode #
Map '\r\n'
into '\n'
on input, and '\n'
to the native newline
representation on output. This mode can be used on any platform, and
works with text files using any newline convention. The downside is
that readFile >>= writeFile
might yield a different file.
universalNewlineMode = NewlineMode { inputNL = CRLF, outputNL = nativeNewline }
nativeNewlineMode :: NewlineMode #
Use the native newline representation on both input and output
nativeNewlineMode = NewlineMode { inputNL = nativeNewline outputNL = nativeNewline }