print as #<lens> instead of #<procedure:lens-struct>

This commit is contained in:
AlexKnauth 2015-09-08 00:16:09 -04:00
parent fe21a59ad2
commit f8d7976129

View File

@ -15,7 +15,10 @@
[(define (lens-view this target)
((lens-struct-get this) target))
(define (lens-set this target x)
((lens-struct-set this) target x))])
((lens-struct-set this) target x))]
#:methods gen:custom-write
[(define (write-proc this out mode)
(write-string "#<lens>" out))])
(define (make-lens getter setter)
(lens-struct getter setter))
@ -27,4 +30,5 @@
(check-exn exn:fail? (thunk (first-lens '(a b c))))
(let-lens (view-first setter-first) first-lens '(1 2 3 4 5)
(check-eqv? view-first 1)
(check-equal? (setter-first 'a) '(a 2 3 4 5))))
(check-equal? (setter-first 'a) '(a 2 3 4 5)))
(check-equal? (format "~v" first-lens) "#<lens>"))