Add patch->pretty-string

This commit is contained in:
Tony Garnock-Jones 2015-03-05 16:40:25 +00:00
parent fb5a39d3af
commit 97016c5696
1 changed files with 8 additions and 6 deletions

View File

@ -25,7 +25,8 @@
biased-intersection
view-patch
pretty-print-patch)
pretty-print-patch
patch->pretty-string)
(require racket/set)
(require racket/match)
@ -141,12 +142,13 @@
(biased-intersection (patch-removed p) interests)))
(define (pretty-print-patch p [port (current-output-port)])
(display (patch->pretty-string p) port))
(define (patch->pretty-string p)
(match-define (patch in out) p)
(fprintf port "<<<<<<<< Removed:\n")
(pretty-print-matcher out port)
(fprintf port "======== Added:\n")
(pretty-print-matcher in port)
(fprintf port ">>>>>>>>\n"))
(format "<<<<<<<< Removed:\n~a======== Added:\n~a>>>>>>>>\n"
(matcher->pretty-string out)
(matcher->pretty-string in)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;