The safe-globals package

[Tags:bsd3, library]

This library provides a way to declare IORefs, TVars, Chans, etc. at the top level of a module.

This library does not prevent the software design problems caused by global state. Rather, it provides some implementation safety for those circumstances where global state really is necessary.

Fundamentally this library just provides Template Haskell macros for the usual unsafePerformIO trick, so it is subject to the same caveats. In particular, linking a module and then loading the same module dynamically through the GHC API may produce two copies of the same top-level variable.

[Skip to Readme]


Versions 0.1, 0.1.1
Dependencies base (>=3 && <5), stm (>=2.1), template-haskell (>=2.4) [details]
License BSD3
Author Keegan McAllister <>
Maintainer Keegan McAllister <>
Category Data
Source repository head: git clone git://
Uploaded Tue Oct 18 07:08:52 UTC 2011 by KeeganMcAllister
Distributions NixOS:0.1.1
Downloads 1055 total (19 in the last 30 days)
0 []
Status Docs uploaded by user
Build status unknown [no reports yet]
Hackage Matrix CI




Maintainer's Corner

For package maintainers and hackage trustees

Readme for safe-globals

Readme for safe-globals-0.1

safe-globals provides safe top-level mutable variables for Haskell,
which scope like ordinary values.

Documentation is hosted at

To build the documentation yourself, run

  $ cabal configure && cabal haddock --hyperlink-source

This will produce HTML documentation under dist/doc/html/safe-globals