monads: Add a template and specialization mechanism for monadic procedures.
authorLudovic Courtès <ludo@gnu.org>
Tue, 2 May 2017 20:47:36 +0000 (22:47 +0200)
committerLudovic Courtès <ludo@gnu.org>
Tue, 2 May 2017 21:41:13 +0000 (23:41 +0200)
commitdcb95c1fc936d74dfdf84b7e59eff66cb99c5a63
tree51c30f9ab714c6fbd300e1a3c4dac25902b94af8
parent7b9ac883ea62a816afbfa747c1377dc273c15c20
monads: Add a template and specialization mechanism for monadic procedures.

* guix/monads.scm (%templates, %template-instances): New variables.
(register-template!, register-template-instance!): New procedures.
(template-directory, define-template): New macro.
(foldm, sequence, anym): Define using 'define-template'.  Avoid replace
ellipses with dots.
(mapm): Likewise, but do not use 'foldm'.
* guix/store.scm: Add 'template-directory' invocation.
guix/monads.scm
guix/store.scm