monads: Add the state monad.
authorLudovic Courtès <ludo@gnu.org>
Sat, 17 Jan 2015 17:46:41 +0000 (18:46 +0100)
committerLudovic Courtès <ludo@gnu.org>
Sat, 17 Jan 2015 22:45:48 +0000 (23:45 +0100)
commit81a97734e04fa40412b2d44ccfae1b4796257648
treedbb6513d891d778c41abe564891466c564721339
parent5db3719153ccabd192eadaf99b14ad1149172c5b
monads: Add the state monad.

* guix/monads.scm (state-return, state-bind, run-with-state,
  current-state, set-current-state, state-push, state-pop): New
  procedures.
  (%state-monad): New variable.
* tests/monads.scm (%monads): Add %STATE-MONAD.
  (%monad-run): Add 'run-with-state'.
  (values->list): New macro.
  ("set-current-state", "state-push etc."): New tests.
.dir-locals.el
guix/monads.scm
tests/monads.scm