nix/map-right.rkt

13 lines
553 B
Racket
Raw Normal View History

2024-11-23 13:21:04 -05:00
#lang pie
(claim Either.mapRight
(Pi ([L U] [OldRightT U] [NewRightT U] )
(-> (-> OldRightT NewRightT) (Either L OldRightT)
(Either L NewRightT))))
(define Either.mapRight (lambda (L _b OldRightT) (lambda (f either)
(ind-Either
either
(lambda (oldEither) (Either L NewRightT))
(lambda (l) (left l))
(lambda (r) (right (f r)))))))