IOSpec-0.3.1.2: A pure specification of the IO monad.
Safe HaskellSafe-Inferred
LanguageHaskell98

Test.IOSpec.IORef

Description

A pure specification of mutable variables.

Synopsis

The IORefS spec

data IORefS a Source #

An expression of type IOSpec IORefS a corresponds to an IO computation that uses mutable references and returns a value of type a.

Instances

Instances details
Executable IORefS Source #

The Executable instance for the IORefS monad.

Instance details

Defined in Test.IOSpec.IORef

Methods

step :: IORefS a -> VM (Step a) Source #

Functor IORefS Source # 
Instance details

Defined in Test.IOSpec.IORef

Methods

fmap :: (a -> b) -> IORefS a -> IORefS b #

(<$) :: a -> IORefS b -> IORefS a #

Manipulation and creation of IORefs

data IORef a Source #

A mutable variable storing a value of type a. Note that the types stored by an IORef are assumed to be Typeable.

newIORef :: (Typeable a, IORefS :<: f) => a -> IOSpec f (IORef a) Source #

The newIORef function creates a new mutable variable.

readIORef :: (Typeable a, IORefS :<: f) => IORef a -> IOSpec f a Source #

The readIORef function reads the value stored in a mutable variable.

writeIORef :: (Typeable a, IORefS :<: f) => IORef a -> a -> IOSpec f () Source #

The writeIORef function overwrites the value stored in a mutable variable.

modifyIORef :: (Typeable a, IORefS :<: f) => IORef a -> (a -> a) -> IOSpec f () Source #

The modifyIORef function applies a function to the value stored in and IORef.