| Safe Haskell | None |
|---|
Test.IOSpec.IORef
Description
A pure specification of mutable variables.
- data IORefS a
- data IORef a
- newIORef :: (Typeable a, IORefS :<: f) => a -> IOSpec f (IORef a)
- readIORef :: (Typeable a, IORefS :<: f) => IORef a -> IOSpec f a
- writeIORef :: (Typeable a, IORefS :<: f) => IORef a -> a -> IOSpec f ()
- modifyIORef :: (Typeable a, IORefS :<: f) => IORef a -> (a -> a) -> IOSpec f ()
The IORefS spec
An expression of type IOSpec IORefS a corresponds to an IO
computation that uses mutable references and returns a value of
type a.
Instances
| Functor IORefS | |
| Executable IORefS | The |
Manipulation and creation of IORefs
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 aSource
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.