Guest User

Untitled

a guest
Oct 17th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. type | [+A, +B] = Union.Type[A, B]
  2. object Union {
  3. trait Tag extends Any
  4. type Base
  5. type Type[+A, +B] <: Base with Tag
  6.  
  7. implicit def first[A]: A <:< Type[A, Nothing] =
  8. implicitly[A <:< A].asInstanceOf[A <:< Type[A, Nothing]]
  9. implicit def second[B]: B <:< Type[Nothing, B] =
  10. implicitly[B <:< B].asInstanceOf[B <:< Type[Nothing, B]]
  11. }
  12.  
  13. object A
  14. object B
  15. object C
  16.  
  17. type X = A.type | B.type | C.type
  18. type Y = A.type with B.type with C.type
  19. implicitly[Y <:< X]
Add Comment
Please, Sign In to add comment