Guest User

Untitled

a guest
Jun 24th, 2018
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. object Fix2 {
  2. type Fix2_1[F1[_, _], F2[_, _]]
  3. type Fix2_2[F1[_, _], F2[_, _]]
  4.  
  5. final class Subst[F1[_, _], F2[_, _]] {
  6. type Apply[H[_, _]] = H[F1, F2]
  7. type ApplyF[H[_, _]] = H[Apply[Fix2_1], Apply[Fix2_2]]
  8.  
  9. def _1[H[_]](f: H[Apply[Fix2_1]]): H[ApplyF[F1]] = f.asInstanceOf[H[ApplyF[F1]]]
  10. def _2[H[_]](f: H[Apply[Fix2_2]]): H[ApplyF[F2]] = f.asInstanceOf[H[ApplyF[F2]]]
  11. }
  12.  
  13. private[this] val _subst = new Subst[Any, Any]
  14. def subst[F1[_, _], F2[_, _]]: Subst[F1, F2] = _subst.asInstanceOf[Subst[F1, F2]]
  15. }
  16.  
  17. object Fix3 {
  18. type Fix3_1[F1[_, _, _], F2[_, _, _], F3[_, _, _]]
  19. type Fix3_2[F1[_, _, _], F2[_, _, _], F3[_, _, _]]
  20. type Fix3_3[F1[_, _, _], F2[_, _, _], F3[_, _, _]]
  21.  
  22. final class Subst[F1[_, _, _], F2[_, _, _], F3[_, _, _]] {
  23. type Apply[H[_, _, _]] = H[F1, F2, F3]
  24. type ApplyF[H[_, _, _]] = H[Apply[Fix3_1], Apply[Fix3_2], Apply[Fix3_3]]
  25.  
  26. def _1[H[_]](f: H[Apply[Fix3_1]]): H[ApplyF[F1]] = f.asInstanceOf[H[ApplyF[F1]]]
  27. def _2[H[_]](f: H[Apply[Fix3_2]]): H[ApplyF[F2]] = f.asInstanceOf[H[ApplyF[F2]]]
  28. def _3[H[_]](f: H[Apply[Fix3_3]]): H[ApplyF[F3]] = f.asInstanceOf[H[ApplyF[F3]]]
  29. }
  30.  
  31. private[this] val _subst = new Subst[Any, Any, Any]
  32. def subst[F1[_, _, _], F2[_, _, _], F3[_, _, _]]: Subst[F1, F2, F3]
  33. = _subst.asInstanceOf[Subst[F1, F2, F3]]
  34. }
Add Comment
Please, Sign In to add comment