unliftio-0.1.1.0: The MonadUnliftIO typeclass for unlifting monads to IO (batteries included)

Safe Haskell | Safe
Language | Haskell2010

UnliftIO.IO

Description

Unlifted System.IO.

Since: 0.1.0.0

Synopsis

- data IOMode :: *
  - = ReadMode
  - | WriteMode
  - | AppendMode
  - | ReadWriteMode
- data Handle :: *
- withFile :: MonadUnliftIO m => FilePath -> IOMode -> (Handle -> m a) -> m a
- withBinaryFile :: MonadUnliftIO m => FilePath -> IOMode -> (Handle -> m a) -> m a

# Documentation

data IOMode :: * #

See `openFile`

Constructors

ReadMode |
WriteMode |
AppendMode |
ReadWriteMode |

Instances

Enum IOMode |
Methods succ :: IOMode -> IOMode # pred :: IOMode -> IOMode # toEnum :: Int -> IOMode # fromEnum :: IOMode -> Int # enumFrom :: IOMode -> [IOMode] # enumFromThen :: IOMode -> IOMode -> [IOMode] # enumFromTo :: IOMode -> IOMode -> [IOMode] # enumFromThenTo :: IOMode -> IOMode -> IOMode -> [IOMode] #
Eq IOMode |
Methods (==) :: IOMode -> IOMode -> Bool # (/=) :: IOMode -> IOMode -> Bool #
Ord IOMode |
Methods compare :: IOMode -> IOMode -> Ordering # (<) :: IOMode -> IOMode -> Bool # (<=) :: IOMode -> IOMode -> Bool # (>) :: IOMode -> IOMode -> Bool # (>=) :: IOMode -> IOMode -> Bool # max :: IOMode -> IOMode -> IOMode # min :: IOMode -> IOMode -> IOMode #
Read IOMode |
Methods readsPrec :: Int -> ReadS IOMode # readList :: ReadS [IOMode] # readPrec :: ReadPrec IOMode # readListPrec :: ReadPrec [IOMode] #
Show IOMode |
Methods showsPrec :: Int -> IOMode -> ShowS # show :: IOMode -> String # showList :: [IOMode] -> ShowS #
Ix IOMode |
Methods range :: (IOMode, IOMode) -> [IOMode] # index :: (IOMode, IOMode) -> IOMode -> Int # unsafeIndex :: (IOMode, IOMode) -> IOMode -> Int inRange :: (IOMode, IOMode) -> IOMode -> Bool # rangeSize :: (IOMode, IOMode) -> Int # unsafeRangeSize :: (IOMode, IOMode) -> Int

data Handle :: * #

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.

Instances

Eq Handle |
Methods (==) :: Handle -> Handle -> Bool # (/=) :: Handle -> Handle -> Bool #
Show Handle |
Methods showsPrec :: Int -> Handle -> ShowS # show :: Handle -> String # showList :: [Handle] -> ShowS #

withFile :: MonadUnliftIO m => FilePath -> IOMode -> (Handle -> m a) -> m a Source #

Unlifted version of `withFile`.

Since: 0.1.0.0

withBinaryFile :: MonadUnliftIO m => FilePath -> IOMode -> (Handle -> m a) -> m a Source #

Unlifted version of `withBinaryFile`.

Since: 0.1.0.0