Guest User

Untitled

a guest
Jul 11th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.56 KB | None | 0 0
  1. object MyHList {
  2.    
  3.     trait HL[A] {
  4.       type Head <: A
  5.       type Tail <: HL[_]
  6.     }
  7.     /*class HNil extends HL[Nothing] {
  8.       type Tail = Nothing
  9.     }*/
  10.     type HNil = HL[Nothing] { type Tail = Nothing }
  11.     type ::[A,B <: HL[_]] = HL[A] {
  12.       type Head=A
  13.       type Tail = B
  14.     }
  15.     //type hl2func[A <: HL[_],O] = hl2func[A#Tail,A#Head] => O
  16.  
  17.     trait HL2Func[HList <: HL[_], O] {
  18.       type hl2func = HL2Func[HList#Tail,HList#Head]#hl2func => O
  19.     }
  20.    
  21.     type x = Int :: String :: HNil
  22.     //type x = ::[Int, ::[String, HNil]]
  23.   }
Add Comment
Please, Sign In to add comment