Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // data Either a b = Left a | Right b
- abstract class Either<A, B> {
- constructor(public value: A | B) { }
- }
- // Inject Left
- // inl a
- class Left<A> extends Either<A, never>{
- constructor(value: A) { super(value) }
- }
- // Inject Right
- // inr a
- class Right<B> extends Either<never, B>{
- constructor(value: B){ super(value) }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement