mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-25 05:48:07 -05:00
monad-repl: Close connection when leaving the monad REPL.
* guix/monad-repl.scm (store-monad-language): Add 'store' parameter and use it. Remove call to 'open-connection'. (enter-store-monad): Use 'with-store' and pass the store to 'store-monad-language.
This commit is contained in:
parent
e5a19fed19
commit
8c9ef2c3a2
1 changed files with 11 additions and 11 deletions
|
@ -1,5 +1,5 @@
|
||||||
;;; GNU Guix --- Functional package management for GNU
|
;;; GNU Guix --- Functional package management for GNU
|
||||||
;;; Copyright © 2014, 2015 Ludovic Courtès <ludo@gnu.org>
|
;;; Copyright © 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
;;;
|
;;;
|
||||||
|
@ -60,10 +60,9 @@ (define* (default-guile-derivation store #:optional (system (%current-system)))
|
||||||
"Return the derivation of the default "
|
"Return the derivation of the default "
|
||||||
(package-derivation store (default-guile) system))
|
(package-derivation store (default-guile) system))
|
||||||
|
|
||||||
(define (store-monad-language)
|
(define (store-monad-language store)
|
||||||
"Return a compiler language for the store monad."
|
"Return a compiler language for the store monad using STORE."
|
||||||
(let* ((store (open-connection))
|
(let ((guile (or (%guile-for-build)
|
||||||
(guile (or (%guile-for-build)
|
|
||||||
(default-guile-derivation store))))
|
(default-guile-derivation store))))
|
||||||
(monad-language %store-monad
|
(monad-language %store-monad
|
||||||
(cut run-with-store store <>
|
(cut run-with-store store <>
|
||||||
|
@ -84,10 +83,11 @@ (define-meta-command ((run-in-store guix) repl (form))
|
||||||
(define-meta-command ((enter-store-monad guix) repl)
|
(define-meta-command ((enter-store-monad guix) repl)
|
||||||
"enter-store-monad
|
"enter-store-monad
|
||||||
Enter a REPL for values in the store monad."
|
Enter a REPL for values in the store monad."
|
||||||
(let ((new (make-repl (store-monad-language))))
|
(with-store store
|
||||||
|
(let ((new (make-repl (store-monad-language store))))
|
||||||
;; Force interpretation so that our specially-crafted language evaluator
|
;; Force interpretation so that our specially-crafted language evaluator
|
||||||
;; is actually used.
|
;; is actually used.
|
||||||
(repl-option-set! new 'interp #t)
|
(repl-option-set! new 'interp #t)
|
||||||
(run-repl new)))
|
(run-repl new))))
|
||||||
|
|
||||||
;;; monad-repl.scm ends here
|
;;; monad-repl.scm ends here
|
||||||
|
|
Loading…
Reference in a new issue