* guix/monads.scm (mwhen, munless): Rename parameters from 'exp0' and 'exp' to
'mexp0' and 'mexp', respectively. This makes it more obvious that these
expressions must be monadic expressions.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Reported by Andy Wingo <wingo@igalia.com>.
* guix/monads.scm (define-lift) <fallback case>: Add missing #'. Remove
extra formal parameter.
* tests/monads.scm ("lift"): Add test with 'lift1' as a procedure.
Suggested by Federico Beffa <beffa@fbengineering.ch>.
* guix/monads.scm (bind-syntax): New macro.
(with-monad): Use it instead of 'identifier-syntax'.
* tests/monads.scm (">>= with more than two arguments"): New test.
* doc/guix.texi (The Store Monad): Explain that there can be several MPROC.
Add an example.
* guix/monads.scm (foldm, mapm, anym): Change to take a list of regular
values as is customary.
* tests/monads.scm ("mapm", "anym"): Adjust accordingly.
* doc/guix.texi (The Store Monad): Document '%state-monad' and related
procedures. Describe '%store-monad' as an alias for '%state-monad'.
* guix/monads.scm: Update commentary.
* guix/store.scm (define-alias): New macro.
(%store-monad, store-return, store-bind): Define as aliases of the
corresponding %STATE-MONAD part.
(store-lift, text-file, interned-file): Return STORE as a second
value.
(run-with-store): Use 'run-with-state'.
* guix/packages.scm (set-guile-for-build, package-file): Return STORE as
a second value.
* guix/monads.scm: Remove part of the module commentary.
* guix/monads.scm (package-file): Add #:target keyword parameter and
honor it.
(package->cross-derivation): New procedure.
* tests/monads.scm ("package-file + package->cross-derivation"): New test.
* doc/guix.texi (The Store Monad): Update 'package-file' documentation.
Add 'package->cross-derivation'.
* guix/monads.scm (mapm): Don't reverse LST, so that items are processed
from left to right. Bind the result of 'foldm' and reverse it.
* tests/monads.scm ("sequence"): Change 'frob' so it performs its side
effect within an 'mlet' body. Adjust call accordingly.
* guix/gexp.scm (gexp->derivation, gexp->script): Use 'default-guile'
instead of an explicit reference to 'guile-final'.
(default-guile): New procedure.
* guix/monads.scm (run-with-store)[default-guile]: New procedure.
Use it.
* guix/monads.scm: Unexport 'lower-inputs' and 'derivation-expression'.
(text-file*): Add comment about the switch to 'gexp->derivation'.
(lower-inputs): Add comment about its doom.
(derivation-expression): Likewise.
* guix/gexp.scm (lower-inputs*): Rename to...
(lower-inputs): ... this. Update callers.
* tests/monads.scm (derivation-expression): New procedure.
* doc/guix.texi (The Store Monad): Use 'gexp->derivation' instead of
'derivation-expression'. Remove documentation of
'derivation-expression'.
* guix/ui.scm (read/eval): Use THE-ROOT-MODULE so that macros are
properly expanded.
* tests/guix-build.sh: Use 'gexp->derivation' instead of
'derivation-expression'.monads: Hide 'derivation-expression' and 'lower-inputs'.
* guix/monads.scm (text-file*): New procedure.
* tests/monads.scm ("text-file*"): New test.
* doc/guix.texi (The Store Monad): Change example since the previous one
would erroneously fail to retain a reference to Coreutils. Document
'text-file*'.
* gnu/system/vm.scm (lower-inputs): Move to monads.scm.
(qemu-image): Don't add GRUB-CONFIGURATION to the INPUTS-TO-COPY.
(union, file-union, etc-directory): Move to gnu/system.scm.
(%demo-operating-system): New variable.
(system-qemu-image): Add 'os' parameter. Rewrite in terms of
'operating-system-derivation'.
* guix/monads.scm (lower-inputs): New procedure.
* gnu/system/grub.scm (grub-configuration-file): Change 'entries' to be
a plain list instead of a list of monadic values.
* gnu/system.scm: New file.
* gnu-system.am (GNU_SYSTEM_MODULES): Add it.
* 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: New file.
* tests/monads.scm: New file.
* Makefile.am (MODULES): Add guix/monads.scm.
(SCM_TESTS): Add tests/monads.scm.
* doc/guix.texi (The Store Monad): New node.
(The Store): Reference it.