safe-globals: Safe top-level mutable variables which scope like ordinary values
This library provides a way to declare
at the top level of a module.
Declarations are safe. User code does not invoke
unsafePerformIOor compiler pragmas.
Variables are ordinary module-level bindings. Their scope can be controlled through the usual module import/export mechanism. Unrelated code cannot interfere with private variables by guessing some global identifier.
References are statically typed, and polymorphic references are statically forbidden.
The implementation is simple, and closely follows existing common practice.
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
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]
|Dependencies||base (>=3 && <5), stm (>=2.1), template-haskell (>=2.4) [details]|
|Author||Keegan McAllister <firstname.lastname@example.org>|
|Maintainer||Keegan McAllister <email@example.com>|
|Source repo||head: git clone git://github.com/kmcallister/safe-globals|
|Uploaded||by KeeganMcAllister at Tue Oct 18 07:08:52 UTC 2011|
|Downloads||1327 total (6 in the last 30 days)|
|Rating||(no votes yet) [estimated by rule of succession]|
|Status||Docs uploaded by user
Build status unknown [no reports yet]
Hackage Matrix CI
For package maintainers and hackage trustees