diff --git a/unstable/lens/isomorphism/compound.rkt b/unstable/lens/isomorphism/compound.rkt index 26b7d4f..c14bd1b 100644 --- a/unstable/lens/isomorphism/compound.rkt +++ b/unstable/lens/isomorphism/compound.rkt @@ -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")