aboutsummaryrefslogtreecommitdiff
path: root/guix/monads.scm
Commit message (Collapse)AuthorAge
* monads: Add a template and specialization mechanism for monadic procedures.Ludovic Courtès2017-05-02
| | | | | | | | | | * 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.
* monads: Improve mlet, mlet*, and mbegin documentation.Chris Marusich2017-04-08
| | | | | | | | * doc/guix.texi (The Store Monad) <mlet, mlet*, mbegin>: Clarify their intended usage. * guix/monads.scm (mbegin): Update docstring accordingly. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* monads, doc: Improve mwhen and munless documentation.Chris Marusich2017-04-08
| | | | | | | * doc/guix.texi (The Store Monad) <mwhen, munless>: Document them. * guix/monads.scm (mwhen, munless): Clarify their intended use. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* monads: Use intent-revealing parameter names.Chris Marusich2017-04-08
| | | | | | | | * 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>
* monads: Fix 'liftN' fallback case.Ludovic Courtès2015-09-04
| | | | | | | | 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.
* monads: Inline the procedure returned by liftN.Ludovic Courtès2015-08-29
| | | | | * guix/monads.scm (define-lift): Turn into a macro that open-codes the result of its lift.
* monads: Allow n-ary '>>=' expressions.Ludovic Courtès2015-06-08
| | | | | | | | | | 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.
* monads: 'foldm', 'mapm', and 'anym' now take a list of regular values.Ludovic Courtès2015-05-27
| | | | | | * guix/monads.scm (foldm, mapm, anym): Change to take a list of regular values as is customary. * tests/monads.scm ("mapm", "anym"): Adjust accordingly.
* monads: Optimize 'sequence'.Ludovic Courtès2015-04-17
| | | | | * guix/monads.scm (sequence): Rewrite as a macro. This yields a 10% improvement in wall-clock time for 'guix system build'.
* doc: Document '%state-monad' and update '%store-monad' description.Ludovic Courtès2015-01-17
| | | | | | * 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.
* store: Make '%store-monad' an alias for '%state-monad'.Ludovic Courtès2015-01-17
| | | | | | | | | | | | * 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.
* monads: Add the state monad.Ludovic Courtès2015-01-17
| | | | | | | | | | | * 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.
* monads: Move '%store-monad' and related procedures where they belong.Ludovic Courtès2015-01-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This turns (guix monads) into a generic module for monads, and moves the store monad and related monadic procedures in their corresponding module. * guix/monads.scm (store-return, store-bind, %store-monad, store-lift, text-file, interned-file, package-file, package->derivation, package->cross-derivation, origin->derivation, imported-modules, compiled, modules, built-derivations, run-with-store): Move to... * guix/store.scm (store-return, store-bind, %store-monad, store-lift, text-file, interned-file): ... here. (%guile-for-build): New variable. (run-with-store): Moved from monads.scm. Remove default value for #:guile-for-build. * guix/packages.scm (default-guile): Export. (set-guile-for-build): New procedure. (package-file, package->derivation, package->cross-derivation, origin->derivation): Moved from monads.scm. * guix/derivations.scm (%guile-for-build): Remove. (imported-modules): Rename to... (%imported-modules): ... this. (compiled-modules): Rename to... (%compiled-modules): ... this. (built-derivations, imported-modules, compiled-modules): New procedures. * gnu/services/avahi.scm, gnu/services/base.scm, gnu/services/dbus.scm, gnu/services/dmd.scm, gnu/services/networking.scm, gnu/services/ssh.scm, gnu/services/xorg.scm, gnu/system/install.scm, gnu/system/linux-initrd.scm, gnu/system/shadow.scm, guix/download.scm, guix/gexp.scm, guix/git-download.scm, guix/profiles.scm, guix/svn-download.scm, tests/monads.scm: Adjust imports accordingly. * guix/monad-repl.scm (default-guile-derivation): New procedure. (store-monad-language, run-in-store): Use it. * build-aux/hydra/gnu-system.scm (qemu-jobs): Add explicit 'set-guile-for-build' call. * guix/scripts/archive.scm (derivation-from-expression): Likewise. * guix/scripts/build.scm (options/resolve-packages): Likewise. * guix/scripts/environment.scm (guix-environment): Likewise. * guix/scripts/system.scm (guix-system): Likewise. * doc/guix.texi (The Store Monad): Adjust module names accordingly.
* monads: Remove 'derivation-expression'.Ludovic Courtès2015-01-12
| | | | | | * guix/monads.scm (lower-inputs, derivation-expression): Remove. * tests/monads.scm (derivation-expression, "mlet* + derivation-expression"): Remove.
* monads: Rewrite 'text-file*' using gexps.Ludovic Courtès2015-01-12
| | | | | | | * guix/monads.scm (text-file*): Move to... * guix/gexp.scm (text-file*): ... here. Rewrite using gexps. * tests/monads.scm ("text-file*"): Move to... * tests/gexp.scm ("text-file*"): ... here.
* monads: Add 'lift0'.Ludovic Courtès2014-12-02
| | | | * guix/monads.scm (lift0): New variable.
* monads: Add 'mwhen' and 'munless'.Ludovic Courtès2014-12-02
| | | | | | * guix/monads.scm (mbegin): Add special '%current-monad' syntactic keyword. (mwhen, munless): New macros.
* monads: Remove unused 'nargs' parameter from 'lift'.Ludovic Courtès2014-11-05
| | | | * guix/monads.scm (lift): Remove 'nargs' parameter.
* monads: Add 'mbegin'.Ludovic Courtès2014-10-08
| | | | | | * guix/monads.scm (mbegin): New macro. * tests/monads.scm ("mbegin"): New test. * doc/guix.texi (The Store Monad): Document it.
* gnu: Split (gnu packages base), adding (gnu packages commencement).Ludovic Courtès2014-08-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * gnu/packages/base.scm (gnu-make-boot0, diffutils-boot0, findutils-boot0, %boot0-inputs, nix-system->gnu-triplet, boot-triplet, binutils-boot0, gcc-boot0, perl-boot0, linux-libre-headers-boot0, texinfo-boot0, %boot1-inputs, glibc-final-with-bootstrap-bash, cross-gcc-wrapper, static-bash-for-glibc, glibc-final, gcc-boot0-wrapped, %boot2-inputs, binutils-final, libstdc++, gcc-final, ld-wrapper-boot3, %boot3-inputs, bash-final, %boot4-inputs, guile-final, gnu-make-final, ld-wrapper, coreutils-final, grep-final, %boot5-inputs, %final-inputs, canonical-package, gcc-toolchain, gcc-toolchain-4.8, gcc-toolchain-4.9): Move to... * gnu/packages/commencement.scm: ... here. New file. * gnu-system.am (GNU_SYSTEM_MODULES): Add it. * build-aux/check-final-inputs-self-contained.scm: Adjust accordingly. * gnu/packages/cross-base.scm: Likewise. * gnu/packages/make-bootstrap.scm: Likewise. * guix/build-system/cmake.scm (cmake-build): Likewise. * guix/build-system/gnu.scm (standard-packages, gnu-build, gnu-cross-build): Likewise. * guix/build-system/perl.scm (perl-build): Likewise. * guix/build-system/python.scm (python-build): Likewise. * guix/build-system/trivial.scm (guile-for-build): Likewise. * guix/download.scm (url-fetch): Likewise. * guix/gexp.scm (default-guile): Likewise. * guix/git-download.scm (git-fetch): Likewise. * guix/monads.scm (run-with-store): Likewise. * guix/packages.scm (default-guile): Likewise. * guix/scripts/package.scm (guix-package): Likewise. * guix/scripts/refresh.scm: Likewise. * guix/svn-download.scm (svn-fetch): Likewise. * tests/builders.scm (%bootstrap-inputs, %bootstrap-search-paths): Likewise. * tests/packages.scm ("GNU Make, bootstrap"): Likewise. * tests/guix-package.sh: Likewise. * gnu/services/base.scm: Use 'canonical-package' instead of xxx-final. * gnu/services/xorg.scm: Likewise. * gnu/system/vm.scm: Likewise. * guix/scripts/pull.scm (guix-pull): Likewise.
* monads: 'package-file' uses '%current-system' at '>>=' time.Ludovic Courtès2014-08-17
| | | | | * guix/monads.scm (package-file): Leave #:system to #f by default. * tests/monads.scm ("package-file, default system"): New test.
* monads: Add 'package->cross-derivation' and #:target for 'package-file'.Ludovic Courtès2014-08-17
| | | | | | | | | * 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'.
* monads: Add 'interned-file'.Ludovic Courtès2014-07-24
| | | | | | * guix/monads.scm (interned-file): New procedure. * tests/monads.scm ("interned-file"): New test. * doc/guix.texi (The Store Monad): Document it.
* monads: Fix 'mapm' so that effects happen from left to right.Ludovic Courtès2014-07-12
| | | | | | | * 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.
* monads, gexp: Remove unintended dependency on (gnu packages …).Ludovic Courtès2014-05-01
| | | | | | | | * 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.
* gexp: Add support for 'origin?' objects in 'ungexp' forms.Ludovic Courtès2014-05-01
| | | | | | | * guix/gexp.scm (lower-inputs, gexp-inputs, gexp->sexp, canonicalize-reference): Add 'origin?' case. * guix/monads.scm (origin->derivation): New procedure. * tests/gexp.scm ("one input origin"): New test.
* monads: Hide 'derivation-expression' and 'lower-inputs'.Ludovic Courtès2014-04-28
| | | | | | | | | | | | | | | | | * 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'.
* monads: Add 'text-file*'.Ludovic Courtès2014-02-03
| | | | | | | | * 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*'.
* monads: Add 'imported-modules' and 'compiled-modules'.Ludovic Courtès2014-01-29
| | | | | * guix/monads.scm (package-file): Fix typo. (imported-modules, compiled-modules): New procedures.
* gnu: Add (gnu system).Ludovic Courtès2013-12-10
| | | | | | | | | | | | | | * 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.
* monads: Fix 'anym'.Ludovic Courtès2013-12-10
| | | | | * guix/monads.scm (anym): Fix successful case. * tests/monads.scm ("anym"): New test.
* monads: Remove erroneous comment.Ludovic Courtès2013-12-05
| | | | * guix/monads.scm (sequence): Remove erroneous comment.
* monads: Allow resolution of a monad's bind/return at expansion time.Ludovic Courtès2013-10-03
| | | | | | | | | * 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.
* Add (guix monads).Ludovic Courtès2013-10-03
* 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.