From f73286345e8e9cb059f54a9d68fe19e57de75cdc Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 30 Mar 2015 22:59:24 +0200 Subject: gexp: Add printers for and . * guix/gexp.scm (write-gexp-input, write-gexp-output): New procedures. (, ): Use them as printers. --- guix/gexp.scm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'guix/gexp.scm') diff --git a/guix/gexp.scm b/guix/gexp.scm index de8b7bbb46..a2da72e76c 100644 --- a/guix/gexp.scm +++ b/guix/gexp.scm @@ -179,6 +179,15 @@ (define-record-type (output gexp-input-output) ;string (native? gexp-input-native?)) ;Boolean +(define (write-gexp-input input port) + (match input + (($ thing output #f) + (format port "#" thing output)) + (($ thing output #t) + (format port "#" thing output)))) + +(set-record-type-printer! write-gexp-input) + (define* (gexp-input thing ;convenience procedure #:optional (output "out") #:key native?) @@ -193,6 +202,13 @@ (define-record-type gexp-output? (name gexp-output-name)) +(define (write-gexp-output output port) + (match output + (($ name) + (format port "#" name)))) + +(set-record-type-printer! write-gexp-output) + (define raw-derivation (store-lift derivation)) -- cgit v1.2.3