Copyright | Copyright (c) 2009-2014, David Sorokin <david.sorokin@gmail.com> |
---|---|

License | BSD3 |

Maintainer | David Sorokin <david.sorokin@gmail.com> |

Stability | experimental |

Safe Haskell | Safe-Inferred |

Language | Haskell2010 |

Tested with: GHC 7.8.3

It defines a prototype of mutable references.

- class (Functor m, Monad m) => ProtoRefMonad m where
- data ProtoRef m :: * -> *
- newProtoRef :: Session m -> a -> m (ProtoRef m a)
- readProtoRef :: ProtoRef m a -> m a
- writeProtoRef :: ProtoRef m a -> a -> m ()
- modifyProtoRef :: ProtoRef m a -> (a -> a) -> m ()
- modifyProtoRef' :: ProtoRef m a -> (a -> a) -> m ()

# Documentation

class (Functor m, Monad m) => ProtoRefMonad m where Source

A monad within which computation we can create and work with the prototype of mutable reference.

newProtoRef :: Session m -> a -> m (ProtoRef m a) Source

Create a new ptototype of mutable reference by the specified session and initial value.

readProtoRef :: ProtoRef m a -> m a Source

Read the contents of the prototype of mutable reference.

writeProtoRef :: ProtoRef m a -> a -> m () Source

Write a new value in the prototype of mutable reference.

modifyProtoRef :: ProtoRef m a -> (a -> a) -> m () Source

Modify a value stored in the prototype of mutable reference.

modifyProtoRef' :: ProtoRef m a -> (a -> a) -> m () Source

A strict version of `modifyProtoRef`

.