summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--guix/gexp.scm10
1 files changed, 10 insertions, 0 deletions
diff --git a/guix/gexp.scm b/guix/gexp.scm
index a52360cd11..79b6ec7085 100644
--- a/guix/gexp.scm
+++ b/guix/gexp.scm
@@ -26,6 +26,7 @@
   #:use-module (guix packages)
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-9)
+  #:use-module (srfi srfi-9 gnu)
   #:use-module (srfi srfi-26)
   #:use-module (ice-9 match)
   #:export (gexp
@@ -56,6 +57,15 @@
   (references gexp-references)                    ; ((DRV-OR-PKG OUTPUT) ...)
   (proc       gexp-proc))                         ; procedure
 
+(define (write-gexp gexp port)
+  "Write GEXP on PORT."
+  (display "#<gexp " port)
+  (write (apply (gexp-proc gexp) (gexp-references gexp)) port)
+  (format port " ~a>"
+          (number->string (object-address gexp) 16)))
+
+(set-record-type-printer! <gexp> write-gexp)
+
 ;; Reference to one of the derivation's outputs, for gexps used in
 ;; derivations.
 (define-record-type <output-ref>