diff options
author | Ludovic Courtès <ludo@gnu.org> | 2015-03-30 22:59:24 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2015-04-20 15:41:41 +0200 |
commit | f73286345e8e9cb059f54a9d68fe19e57de75cdc (patch) | |
tree | e5562955d2870d0a7cce20fd9b2660c84c653513 | |
parent | c568191a9306cb58a718860ca5b8768e91627ab0 (diff) | |
download | guix-f73286345e8e9cb059f54a9d68fe19e57de75cdc.tar guix-f73286345e8e9cb059f54a9d68fe19e57de75cdc.tar.gz |
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.
-rw-r--r-- | guix/gexp.scm | 16 |
1 files changed, 16 insertions, 0 deletions
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 @@ 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?) @@ -193,6 +202,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)) |