Ludovic Courtès
81a97734e0
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.
2015-01-17 23:45:48 +01:00
Ludovic Courtès
e87f0591f3
monads: Move '%store-monad' and related procedures where they belong.
...
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.
2015-01-14 13:34:52 +01:00
Ludovic Courtès
abebac4601
monads: Remove 'derivation-expression'.
...
* guix/monads.scm (lower-inputs, derivation-expression): Remove.
* tests/monads.scm (derivation-expression, "mlet* +
derivation-expression"): Remove.
2015-01-12 23:33:08 +01:00
Ludovic Courtès
462a3fa36c
monads: Rewrite 'text-file*' using gexps.
...
* 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.
2015-01-12 23:33:08 +01:00
Ludovic Courtès
405a9d4ec9
monads: Add 'mbegin'.
...
* guix/monads.scm (mbegin): New macro.
* tests/monads.scm ("mbegin"): New test.
* doc/guix.texi (The Store Monad): Document it.
2014-10-08 23:35:20 +02:00
Ludovic Courtès
b4469d8c12
gnu: cross-base: Use the right dynamic linker name.
...
* gnu/packages/cross-base.scm (cross-gcc-arguments): Parametrize
%CURRENT-TARGET-SYSTEM.
* tests/monads.scm ("package-file + package->cross-derivation"): Replace
"foo64-gnu" with "mips64el-linux-gnu".
2014-10-05 21:58:42 +02:00
Ludovic Courtès
c1bc358f29
Factorize test suite support in (guix tests).
...
* guix/tests.scm: New file.
* Makefile.am (noinst_DATA): New variable.
(GOBJECTS): Add guix/tests.go.
* tests/builders.scm (%store): Use 'open-connection-for-tests'
from (guix tests).
* tests/derivations.scm: Likewise.
* tests/monads.scm: Likewise.
* tests/packages.scm: Likewise.
* tests/profiles.scm: Likewise.
* tests/union.scm: Likewise.
* tests/gexp.scm: Likewise.
(guile-for-build): Remove. Use (%guile-for-build) instead.
* tests/nar.scm (make-random-bytevector, %seed, random-text): Remove.
(populate-file): Change 'make-random-bytevector' to 'random-bytevector'.
Use (guix tests).
* tests/store.scm (%seed, random-text): Remove.
Use (guix tests).
2014-08-23 22:33:04 +02:00
Ludovic Courtès
c90ddc8f81
monads: 'package-file' uses '%current-system' at '>>=' time.
...
* guix/monads.scm (package-file): Leave #:system to #f by default.
* tests/monads.scm ("package-file, default system"): New test.
2014-08-17 21:08:06 +02:00
Ludovic Courtès
4231f05bbc
monads: Add 'package->cross-derivation' and #:target for 'package-file'.
...
* 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'.
2014-08-17 20:58:58 +02:00
Ludovic Courtès
0a90af1531
monads: Add 'interned-file'.
...
* guix/monads.scm (interned-file): New procedure.
* tests/monads.scm ("interned-file"): New test.
* doc/guix.texi (The Store Monad): Document it.
2014-07-24 23:02:26 +02:00
Ludovic Courtès
f62435e286
monads: Fix 'mapm' so that effects happen from left to right.
...
* 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.
2014-07-12 23:17:53 +02:00
Ludovic Courtès
ada3df03e3
monads: Hide 'derivation-expression' and 'lower-inputs'.
...
* 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'.
2014-04-28 23:41:12 +02:00
Ludovic Courtès
45adbd624f
monads: Add 'text-file*'.
...
* 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*'.
2014-02-03 23:20:49 +01:00
Ludovic Courtès
593c3fe600
monads: Fix 'anym'.
...
* guix/monads.scm (anym): Fix successful case.
* tests/monads.scm ("anym"): New test.
2013-12-10 00:24:01 +01:00
Ludovic Courtès
dd1a5a152c
derivations: Use more keyword parameters for 'build-expression->derivation'.
...
* guix/derivations.scm (build-expression->derivation): Turn 'system' and
'inputs' into keyword parameters.
Adjust callers accordingly.
* gnu/system/linux.scm, gnu/system/vm.scm, guix/build-system/cmake.scm,
guix/build-system/gnu.scm, guix/build-system/perl.scm,
guix/build-system/python.scm, guix/build-system/trivial.scm,
guix/download.scm, guix/packages.scm, guix/profiles.scm,
guix/scripts/pull.scm, tests/derivations.scm, tests/guix-build.sh,
tests/monads.scm, tests/store.scm, tests/union.scm: Adjust users of
'build-expression->derivation' and 'derivation-expression'
accordingly.
* doc/guix.texi (Derivations): Adjust 'build-expression->derivation'
documentation accordingly.
(The Store Monad): Likewise for 'derivation-expression'.
2013-12-04 16:07:53 +01:00
Ludovic Courtès
aeb7ec5c9a
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.
2013-10-03 23:12:20 +02:00
Ludovic Courtès
b860f38244
Add (guix monads).
...
* 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.
2013-10-03 23:12:20 +02:00