acme-realworld: Primitives for manipulating the state of the universe

[ acme, bsd3, library ] [ Propose Tags ]

GHC represents an IO action internally as a function from one state of the world to the next:

State# RealWorld -> (# State# RealWorld, a #)

This module provides a very useful capability stemming directly from this representation: the ability to save the current state of the universe and restore it later. This provides a way to "undo" certain types of side effects in the IO monad:

import Acme.Missiles
import Acme.RealWorld

main :: IO ()
main = do
    -- Save the current state of the universe
    world_as_we_know_it <- getWorld

    -- Cause serious international side effects

    -- After realizing that was a terrible, terrible mistake, restore the
    -- pre-war state of the universe.
    putWorld world_as_we_know_it




Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


  • No Candidates
Versions [RSS] 0.1, 0.1.1
Dependencies base (>=4 && <5) [details]
License BSD-3-Clause
Copyright Copyright (c) Joseph Adams 2011
Author Joey Adams
Category Acme
Uploaded by JoeyAdams at 2011-12-09T09:01:13Z
Distributions NixOS:0.1.1
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 2385 total (12 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]