Advertisement
Guest User

Untitled

a guest
Jan 16th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. // data Either a b = Left a | Right b
  2. abstract class Either<A, B> {
  3. constructor(public value: A | B) { }
  4. }
  5. // Inject Left
  6. // inl a
  7. class Left<A> extends Either<A, never>{
  8. constructor(value: A) { super(value) }
  9. }
  10. // Inject Right
  11. // inr a
  12. class Right<B> extends Either<never, B>{
  13. constructor(value: B){ super(value) }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement