;;; TODO UNFINISHED (define-module (data either) #:use-module (oop goops) #:use-module (ice-9 match)) (define-class () (slot #:init-keyword #:slot) (dir #:init-keyword #:dir #:init-value 'left)) (define (left val) "Error values" (make #:slot val #:dir 'left)) (define (right val) "Good values" (make #:slot val #:dir 'right)) (define-method (write (this ) port) (format port "[~a ~s]" (slot-ref this 'dir) (slot-ref this 'slot))) (define-method (>>= (this ) (proc )) (case (slot-ref this 'dir) ((left) this) ((right) (match this (($ slot) (proc slot)))))) (define return-either right)