[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
01/03: monad-repl: Close connection when leaving the monad REPL.
From: |
Ludovic Courtès |
Subject: |
01/03: monad-repl: Close connection when leaving the monad REPL. |
Date: |
Wed, 13 Jan 2016 16:43:28 +0000 |
civodul pushed a commit to branch master
in repository guix.
commit 8c9ef2c3a220c856ef7ec10cdb970988c96f2713
Author: Ludovic Courtès <address@hidden>
Date: Wed Jan 13 15:42:13 2016 +0100
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.
---
guix/monad-repl.scm | 22 +++++++++++-----------
1 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/guix/monad-repl.scm b/guix/monad-repl.scm
index ebd9151..aefabde 100644
--- a/guix/monad-repl.scm
+++ b/guix/monad-repl.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2014, 2015 Ludovic Courtès <address@hidden>
+;;; Copyright © 2014, 2015, 2016 Ludovic Courtès <address@hidden>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -60,11 +60,10 @@
"Return the derivation of the default "
(package-derivation store (default-guile) system))
-(define (store-monad-language)
- "Return a compiler language for the store monad."
- (let* ((store (open-connection))
- (guile (or (%guile-for-build)
- (default-guile-derivation store))))
+(define (store-monad-language store)
+ "Return a compiler language for the store monad using STORE."
+ (let ((guile (or (%guile-for-build)
+ (default-guile-derivation store))))
(monad-language %store-monad
(cut run-with-store store <>
#:guile-for-build guile)
@@ -84,10 +83,11 @@ Run EXP through the store monad."
(define-meta-command ((enter-store-monad guix) repl)
"enter-store-monad
Enter a REPL for values in the store monad."
- (let ((new (make-repl (store-monad-language))))
- ;; Force interpretation so that our specially-crafted language evaluator
- ;; is actually used.
- (repl-option-set! new 'interp #t)
- (run-repl new)))
+ (with-store store
+ (let ((new (make-repl (store-monad-language store))))
+ ;; Force interpretation so that our specially-crafted language evaluator
+ ;; is actually used.
+ (repl-option-set! new 'interp #t)
+ (run-repl new))))
;;; monad-repl.scm ends here