mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 21:38:07 -05:00
store: Add 'store-lower'.
* guix/store.scm (store-lower): New procedure. * tests/store.scm ("store-lower"): New test.
This commit is contained in:
parent
e87f0591f3
commit
023d9892c0
2 changed files with 14 additions and 1 deletions
|
@ -99,6 +99,7 @@ (define-module (guix store)
|
|||
store-bind
|
||||
store-return
|
||||
store-lift
|
||||
store-lower
|
||||
run-with-store
|
||||
%guile-for-build
|
||||
text-file
|
||||
|
@ -881,6 +882,12 @@ (define result
|
|||
(procedure-property proc 'documentation))
|
||||
result)
|
||||
|
||||
(define (store-lower proc)
|
||||
"Lower PROC, a monadic procedure in %STORE-MONAD, to a \"normal\" procedure
|
||||
taking the store as its first argument."
|
||||
(lambda (store . args)
|
||||
(run-with-store store (apply proc args))))
|
||||
|
||||
;;
|
||||
;; Store monad operators.
|
||||
;;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
;;; GNU Guix --- Functional package management for GNU
|
||||
;;; Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org>
|
||||
;;; Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
|
||||
;;;
|
||||
;;; This file is part of GNU Guix.
|
||||
;;;
|
||||
|
@ -595,6 +595,12 @@ (define (same? x y)
|
|||
(null? (valid-derivers %store file))
|
||||
(null? (referrers %store file))))))
|
||||
|
||||
(test-equal "store-lower"
|
||||
"Lowered."
|
||||
(let* ((add (store-lower text-file))
|
||||
(file (add %store "foo" "Lowered.")))
|
||||
(call-with-input-file file get-string-all)))
|
||||
|
||||
(test-end "store")
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue