monads: Allow resolution of a monad's bind/return at expansion time.
authorLudovic Courtès <ludo@gnu.org>
Wed, 2 Oct 2013 19:58:19 +0000 (21:58 +0200)
committerLudovic Courtès <ludo@gnu.org>
Thu, 3 Oct 2013 21:12:20 +0000 (23:12 +0200)
commitaeb7ec5c9a67c9936b5d01d6e933cf4c282058d2
tree6fc9c9260879b5a359ff5f63668ff3db204c89fb
parentd9f0a23704a038640329fae6e2273e5813cdb8ab
monads: Allow resolution of a monad's bind/return at expansion time.

* guix/monads.scm (<monad>): Turn in a raw SRFI-9 record type.
  (define-monad): New macro.
  (with-monad): Add a case for when MONAD is a macro.
  (identity-return, identity-bind, store-return, store-bind): Inline.
  (%identity-monad, %store-monad): Use 'define-monad'.
* tests/monads.scm ("monad?"): New test.
guix/monads.scm
tests/monads.scm