ghc-8.0.2: The GHC API

Safe Haskell | None
Language | Haskell2010

IOEnv

Synopsis

- data IOEnv env a
- module MonadUtils
- failM :: IOEnv env a
- failWithM :: String -> IOEnv env a
- data IOEnvFailure = IOEnvFailure
- getEnv :: IOEnv env env
- setEnv :: env' -> IOEnv env' a -> IOEnv env a
- updEnv :: (env -> env') -> IOEnv env' a -> IOEnv env a
- runIOEnv :: env -> IOEnv env a -> IO a
- unsafeInterleaveM :: IOEnv env a -> IOEnv env a
- uninterruptibleMaskM_ :: IOEnv env a -> IOEnv env a
- tryM :: IOEnv env r -> IOEnv env (Either IOEnvFailure r)
- tryAllM :: IOEnv env r -> IOEnv env (Either SomeException r)
- tryMostM :: IOEnv env r -> IOEnv env (Either SomeException r)
- fixM :: (a -> IOEnv env a) -> IOEnv env a
- data IORef a :: * -> *
- newMutVar :: a -> IOEnv env (IORef a)
- readMutVar :: IORef a -> IOEnv env a
- writeMutVar :: IORef a -> a -> IOEnv env ()
- updMutVar :: IORef a -> (a -> a) -> IOEnv env ()
- atomicUpdMutVar :: IORef a -> (a -> (a, b)) -> IOEnv env b
- atomicUpdMutVar' :: IORef a -> (a -> (a, b)) -> IOEnv env b

# Documentation

data IOEnv env a Source #

Instances

Monad (IOEnv m) # |
Methods (>>=) :: IOEnv m a -> (a -> IOEnv m b) -> IOEnv m b Source # (>>) :: IOEnv m a -> IOEnv m b -> IOEnv m b Source # return :: a -> IOEnv m a Source # fail :: String -> IOEnv m a Source #
Functor (IOEnv m) # |
Methods fmap :: (a -> b) -> IOEnv m a -> IOEnv m b Source # (<$) :: a -> IOEnv m b -> IOEnv m a Source #
MonadFail (IOEnv m) # |
Methods fail :: String -> IOEnv m a Source #
Applicative (IOEnv m) # |
Methods pure :: a -> IOEnv m a Source # (<*>) :: IOEnv m (a -> b) -> IOEnv m a -> IOEnv m b Source # (*>) :: IOEnv m a -> IOEnv m b -> IOEnv m b Source # (<*) :: IOEnv m a -> IOEnv m b -> IOEnv m a Source #
MonadIO (IOEnv env) # |
Methods liftIO :: IO a -> IOEnv env a Source #
MonadPlus IO => Alternative (IOEnv env) # |
Methods empty :: IOEnv env a Source # (<|>) :: IOEnv env a -> IOEnv env a -> IOEnv env a Source # some :: IOEnv env a -> IOEnv env [a] Source # many :: IOEnv env a -> IOEnv env [a] Source #
MonadPlus IO => MonadPlus (IOEnv env) # |
Methods mzero :: IOEnv env a Source # mplus :: IOEnv env a -> IOEnv env a -> IOEnv env a Source #
ExceptionMonad (IOEnv a) # |
Methods gcatch :: Exception e => IOEnv a a -> (e -> IOEnv a a) -> IOEnv a a Source # gmask :: ((IOEnv a a -> IOEnv a a) -> IOEnv a b) -> IOEnv a b Source # gbracket :: IOEnv a a -> (a -> IOEnv a b) -> (a -> IOEnv a c) -> IOEnv a c Source # gfinally :: IOEnv a a -> IOEnv a b -> IOEnv a a Source #
ContainsModule env => HasModule (IOEnv env) # |
Methods getModule :: IOEnv env Module Source #
ContainsDynFlags env => HasDynFlags (IOEnv env) # |
Methods getDynFlags :: IOEnv env DynFlags Source #

module MonadUtils

failM :: IOEnv env a Source #

failWithM :: String -> IOEnv env a Source #

data IOEnvFailure Source #

Constructors

IOEnvFailure |

Instances

Show IOEnvFailure # |
Methods showsPrec :: Int -> IOEnvFailure -> ShowS Source # show :: IOEnvFailure -> String Source # showList :: [IOEnvFailure] -> ShowS Source #
Exception IOEnvFailure # |
Methods toException :: IOEnvFailure -> SomeException Source # fromException :: SomeException -> Maybe IOEnvFailure Source # displayException :: IOEnvFailure -> String Source #

getEnv :: IOEnv env env Source #

setEnv :: env' -> IOEnv env' a -> IOEnv env a Source #

Perform a computation with a different environment

updEnv :: (env -> env') -> IOEnv env' a -> IOEnv env a Source #

Perform a computation with an altered environment

runIOEnv :: env -> IOEnv env a -> IO a Source #

unsafeInterleaveM :: IOEnv env a -> IOEnv env a Source #

uninterruptibleMaskM_ :: IOEnv env a -> IOEnv env a Source #

tryM :: IOEnv env r -> IOEnv env (Either IOEnvFailure r) Source #

tryAllM :: IOEnv env r -> IOEnv env (Either SomeException r) Source #

tryMostM :: IOEnv env r -> IOEnv env (Either SomeException r) Source #

fixM :: (a -> IOEnv env a) -> IOEnv env a Source #

data IORef a :: * -> * Source #

A mutable variable in the `IO` monad

Instances

Eq (IORef a) |
Methods (==) :: IORef a -> IORef a -> Bool # (/=) :: IORef a -> IORef a -> Bool #
NFData (IORef a) | NOTE: Only strict in the reference and not the referenced value. Since: 1.4.2.0
Methods rnf :: IORef a -> () Source #

newMutVar :: a -> IOEnv env (IORef a) Source #

readMutVar :: IORef a -> IOEnv env a Source #

writeMutVar :: IORef a -> a -> IOEnv env () Source #

updMutVar :: IORef a -> (a -> a) -> IOEnv env () Source #

atomicUpdMutVar :: IORef a -> (a -> (a, b)) -> IOEnv env b Source #

Atomically update the reference. Does not force the evaluation of the new variable contents. For strict update, use `atomicUpdMutVar'`.

atomicUpdMutVar' :: IORef a -> (a -> (a, b)) -> IOEnv env b Source #

Strict variant of `atomicUpdMutVar`.