add contracts and tests for isomorphism-compose and -thrush
This commit is contained in:
parent
ec08ef67dd
commit
7e512ada88
|
@ -1,10 +1,21 @@
|
|||
#lang sweet-exp racket/base
|
||||
|
||||
provide isomorphism-compose
|
||||
isomorphism-thrush
|
||||
require racket/contract/base
|
||||
provide
|
||||
contract-out
|
||||
isomorphism-compose
|
||||
(rest-> isomorphism-lens? isomorphism-lens?)
|
||||
isomorphism-thrush
|
||||
(rest-> isomorphism-lens? isomorphism-lens?)
|
||||
|
||||
require racket/match
|
||||
lens/private/util/rest-contract
|
||||
"base.rkt"
|
||||
module+ test
|
||||
require lens/private/base/main
|
||||
lens/private/compound/identity
|
||||
rackunit
|
||||
"data.rkt"
|
||||
|
||||
(define (isomorphism-compose . args)
|
||||
(match args
|
||||
|
@ -16,3 +27,7 @@ require racket/match
|
|||
(define (isomorphism-thrush . args)
|
||||
(apply isomorphism-compose (reverse args)))
|
||||
|
||||
module+ test
|
||||
(define string->vector-lens (isomorphism-thrush string->list-lens list->vector-lens))
|
||||
(check-equal? (lens-view string->vector-lens "abc") #(#\a #\b #\c))
|
||||
(check-equal? (lens-set string->vector-lens "abc" #(#\1 #\2 #\3)) "123")
|
||||
|
|
Loading…
Reference in New Issue
Block a user