monadIO-0.11.1.0: Overloading of concurrency variables

Copyright(c) 2010 Galois Inc.
LicenseBSD-style (see the file libraries/base/LICENSE)
MaintainerJohn Launchbury, john@galois.com
Stabilityexperimental
PortabilityIO
Safe HaskellSafe
LanguageHaskell98

Data.IORef.MonadIO

Description

Overloads the standard operations on IORefs, as defined in Data.IORef. This module is name-for-name swappable with Data.IORef unless ghc-specific operations like weak pointers are used.

The standard operations on IORef (such as newIORef, or modifyIORef) are overloaded over the MonadIO class. A monad m is declared an instance of MonadIO by defining a function

liftIO :: IO a -> m a
Synopsis

Documentation

class Monad m => MonadIO (m :: * -> *) where #

Monads in which IO computations may be embedded. Any monad built by applying a sequence of monad transformers to the IO monad will be an instance of this class.

Instances should satisfy the following laws, which state that liftIO is a transformer of monads:

Minimal complete definition

liftIO

Methods

liftIO :: IO a -> m a #

Lift a computation from the IO monad.

Instances
MonadIO IO

Since: base-4.9.0.0

Instance details

Defined in Control.Monad.IO.Class

Methods

liftIO :: IO a -> IO a #

data IORef a #

A mutable variable in the IO monad

Instances
Eq (IORef a)

Pointer equality.

Since: base-4.1.0.0

Instance details

Defined in GHC.IORef

Methods

(==) :: IORef a -> IORef a -> Bool #

(/=) :: IORef a -> IORef a -> Bool #

newIORef :: MonadIO io => a -> io (IORef a) Source #

readIORef :: MonadIO io => IORef a -> io a Source #

writeIORef :: MonadIO io => IORef a -> a -> io () Source #

modifyIORef :: MonadIO io => IORef a -> (a -> a) -> io () Source #

atomicModifyIORef :: MonadIO io => IORef a -> (a -> (a, b)) -> io b Source #