Copyright | (c) 2010 Galois Inc. |
---|---|

License | BSD-style (see the file libraries/base/LICENSE) |

Maintainer | John Launchbury, john@galois.com |

Stability | experimental |

Portability | IO |

Safe Haskell | Safe |

Language | Haskell98 |

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

- class Monad m => MonadIO (m :: * -> *) where
- data IORef a
- newIORef :: MonadIO io => a -> io (IORef a)
- readIORef :: MonadIO io => IORef a -> io a
- writeIORef :: MonadIO io => IORef a -> a -> io ()
- modifyIORef :: MonadIO io => IORef a -> (a -> a) -> io ()
- atomicModifyIORef :: MonadIO io => IORef a -> (a -> (a, b)) -> io b

# Documentation

A mutable variable in the `IO`

monad

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 #