guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/01: gexp: Add printers for <gexp-input> and <gexp-output>.


From: Ludovic Courtès
Subject: 01/01: gexp: Add printers for <gexp-input> and <gexp-output>.
Date: Mon, 30 Mar 2015 21:23:11 +0000

civodul pushed a commit to branch wip-build-systems-gexp
in repository guix.

commit d9ed9215f808d6b14c4821b8bea5290ac8982ac1
Author: Ludovic Courtès <address@hidden>
Date:   Mon Mar 30 22:59:24 2015 +0200

    gexp: Add printers for <gexp-input> and <gexp-output>.
    
    * guix/gexp.scm (write-gexp-input, write-gexp-output): New procedures.
      (<gexp-input>, <gexp-output>): Use them as printers.
---
 guix/gexp.scm |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/guix/gexp.scm b/guix/gexp.scm
index 172769a..18ecfea 100644
--- a/guix/gexp.scm
+++ b/guix/gexp.scm
@@ -181,6 +181,15 @@ This is the declarative counterpart of the 'interned-file' 
monadic procedure."
   (output    gexp-input-output)      ;string
   (native?   gexp-input-native?))    ;Boolean
 
+(define (write-gexp-input input port)
+  (match input
+    (($ <gexp-input> thing output #f)
+     (format port "#<gexp-input ~s:~a>" thing output))
+    (($ <gexp-input> thing output #t)
+     (format port "#<gexp-input native ~s:~a>" thing output))))
+
+(set-record-type-printer! <gexp-input> write-gexp-input)
+
 (define* (gexp-input thing                        ;convenience procedure
                      #:optional (output "out")
                      #:key native?)
@@ -195,6 +204,13 @@ whether this should be considered a \"native\" input or 
not."
   gexp-output?
   (name gexp-output-name))
 
+(define (write-gexp-output output port)
+  (match output
+    (($ <gexp-output> name)
+     (format port "#<gexp-output ~a>" name))))
+
+(set-record-type-printer! <gexp-output> write-gexp-output)
+
 (define raw-derivation
   (store-lift derivation))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]