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

Safe Haskell | None
Language | Haskell2010

UnliftIO.IO

Description

Unlifted System.IO.

Since: 0.1.0.0

Synopsis

- data IOMode
  - = ReadMode
  - | WriteMode
  - | AppendMode
  - | ReadWriteMode
- data Handle
- stdin :: Handle
- stdout :: Handle
- stderr :: Handle
- withFile :: MonadUnliftIO m => FilePath -> IOMode -> (Handle -> m a) -> m a
- withBinaryFile :: MonadUnliftIO m => FilePath -> IOMode -> (Handle -> m a) -> m a
- hClose :: MonadIO m => Handle -> m ()
- hFlush :: MonadIO m => Handle -> m ()
- hFileSize :: MonadIO m => Handle -> m Integer
- hSetFileSize :: MonadIO m => Handle -> Integer -> m ()
- hIsEOF :: MonadIO m => Handle -> m Bool
- data BufferMode
  - = NoBuffering
  - | LineBuffering
  - | BlockBuffering (Maybe Int)
- hSetBuffering :: MonadIO m => Handle -> BufferMode -> m ()
- hGetBuffering :: MonadIO m => Handle -> m BufferMode
- hSeek :: MonadIO m => Handle -> SeekMode -> Integer -> m ()
- data SeekMode
  - = AbsoluteSeek
  - | RelativeSeek
  - | SeekFromEnd
- hTell :: MonadIO m => Handle -> m Integer
- hIsOpen :: MonadIO m => Handle -> m Bool
- hIsClosed :: MonadIO m => Handle -> m Bool
- hIsReadable :: MonadIO m => Handle -> m Bool
- hIsWritable :: MonadIO m => Handle -> m Bool
- hIsSeekable :: MonadIO m => Handle -> m Bool
- hIsTerminalDevice :: MonadIO m => Handle -> m Bool
- hSetEcho :: MonadIO m => Handle -> Bool -> m ()
- hGetEcho :: MonadIO m => Handle -> m Bool
- hWaitForInput :: MonadIO m => Handle -> Int -> m Bool
- hReady :: MonadIO m => Handle -> m Bool
- getMonotonicTime :: MonadIO m => m Double

# Documentation

data IOMode #

Constructors

ReadMode |
WriteMode |
AppendMode |
ReadWriteMode |

#### Instances

Instances details

Enum IOMode |
Instance details Defined in GHC.IO.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 |
Instance details Defined in GHC.IO.IOMode Methods (==) :: IOMode -> IOMode -> Bool (/=) :: IOMode -> IOMode -> Bool
Ord IOMode |
Instance details Defined in GHC.IO.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 |
Instance details Defined in GHC.IO.IOMode Methods readsPrec :: Int -> ReadS IOMode readList :: ReadS [IOMode] readPrec :: ReadPrec IOMode readListPrec :: ReadPrec [IOMode]
Show IOMode |
Instance details Defined in GHC.IO.IOMode Methods showsPrec :: Int -> IOMode -> ShowS show :: IOMode -> String showList :: [IOMode] -> ShowS
Ix IOMode |
Instance details Defined in GHC.IO.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 #

#### Instances

Instances details

Eq Handle |
Instance details Defined in GHC.IO.Handle.Types Methods (==) :: Handle -> Handle -> Bool (/=) :: Handle -> Handle -> Bool
Show Handle |
Instance details Defined in GHC.IO.Handle.Types Methods showsPrec :: Int -> Handle -> ShowS show :: Handle -> String showList :: [Handle] -> ShowS

stdin :: Handle #

stdout :: Handle #

stderr :: Handle #

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

hClose :: MonadIO m => Handle -> m () Source #

Lifted version of `hClose`

Since: 0.2.1.0

hFlush :: MonadIO m => Handle -> m () Source #

Lifted version of `hFlush`

Since: 0.2.1.0

hFileSize :: MonadIO m => Handle -> m Integer Source #

Lifted version of `hFileSize`

Since: 0.2.1.0

hSetFileSize :: MonadIO m => Handle -> Integer -> m () Source #

Lifted version of `hSetFileSize`

Since: 0.2.1.0

hIsEOF :: MonadIO m => Handle -> m Bool Source #

Lifted version of `hIsEOF`

Since: 0.2.1.0

data BufferMode #

Constructors

NoBuffering |
LineBuffering |
BlockBuffering (Maybe Int) |

#### Instances

Instances details

Eq BufferMode |
Instance details Defined in GHC.IO.Handle.Types Methods (==) :: BufferMode -> BufferMode -> Bool (/=) :: BufferMode -> BufferMode -> Bool
Ord BufferMode |
Instance details Defined in GHC.IO.Handle.Types Methods compare :: BufferMode -> BufferMode -> Ordering (<) :: BufferMode -> BufferMode -> Bool (<=) :: BufferMode -> BufferMode -> Bool (>) :: BufferMode -> BufferMode -> Bool (>=) :: BufferMode -> BufferMode -> Bool max :: BufferMode -> BufferMode -> BufferMode min :: BufferMode -> BufferMode -> BufferMode
Read BufferMode |
Instance details Defined in GHC.IO.Handle.Types Methods readsPrec :: Int -> ReadS BufferMode readList :: ReadS [BufferMode] readPrec :: ReadPrec BufferMode readListPrec :: ReadPrec [BufferMode]
Show BufferMode |
Instance details Defined in GHC.IO.Handle.Types Methods showsPrec :: Int -> BufferMode -> ShowS show :: BufferMode -> String showList :: [BufferMode] -> ShowS

hSetBuffering :: MonadIO m => Handle -> BufferMode -> m () Source #

Lifted version of `hSetBuffering`

Since: 0.2.1.0

hGetBuffering :: MonadIO m => Handle -> m BufferMode Source #

Lifted version of `hGetBuffering`

Since: 0.2.1.0

hSeek :: MonadIO m => Handle -> SeekMode -> Integer -> m () Source #

Lifted version of `hSeek`

Since: 0.2.1.0

data SeekMode #

Constructors

AbsoluteSeek |
RelativeSeek |
SeekFromEnd |

#### Instances

Instances details

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

hTell :: MonadIO m => Handle -> m Integer Source #

Lifted version of `hTell`

Since: 0.2.1.0

hIsOpen :: MonadIO m => Handle -> m Bool Source #

Lifted version of `hIsOpen`

Since: 0.2.1.0

hIsClosed :: MonadIO m => Handle -> m Bool Source #

Lifted version of `hIsClosed`

Since: 0.2.1.0

hIsReadable :: MonadIO m => Handle -> m Bool Source #

Lifted version of `hIsReadable`

Since: 0.2.1.0

hIsWritable :: MonadIO m => Handle -> m Bool Source #

Lifted version of `hIsWritable`

Since: 0.2.1.0

hIsSeekable :: MonadIO m => Handle -> m Bool Source #

Lifted version of `hIsSeekable`

Since: 0.2.1.0

hIsTerminalDevice :: MonadIO m => Handle -> m Bool Source #

Lifted version of `hIsTerminalDevice`

Since: 0.2.1.0

hSetEcho :: MonadIO m => Handle -> Bool -> m () Source #

Lifted version of `hSetEcho`

Since: 0.2.1.0

hGetEcho :: MonadIO m => Handle -> m Bool Source #

Lifted version of `hGetEcho`

Since: 0.2.1.0

hWaitForInput :: MonadIO m => Handle -> Int -> m Bool Source #

Lifted version of `hWaitForInput`

Since: 0.2.1.0

hReady :: MonadIO m => Handle -> m Bool Source #

Lifted version of `hReady`

Since: 0.2.1.0

getMonotonicTime :: MonadIO m => m Double Source #

Get the number of seconds which have passed since an arbitrary starting time, useful for calculating runtime in a program.

Since: 0.2.3.0