typeclass #Copy = & copy : #Copy -> #Copy typeclass (#Ord : #Eq) = & ( < ) : #Ord -> #Ord -> Bool & ( > ) : #Ord -> #Ord -> Bool & ( <= ) : #Ord -> #Ord -> Bool & ( >= ) : #Ord -> #Ord -> Bool typeclass (#D : #A #B #C) 'A 'B = & do_something : Unit -> (& 'A & 'B) typeclass #E 'A = & do_something : Unit -> 'A namespace const ord : #Ord { def ( <= ) : a b = (a < b) || (a == b) def ( > ) : a b = !(a <= b) def ( >= ) : a b = !(a < b) } // === ?? dependent types ?? === // // typeclass #F : (a : Int) (b : Int) = // & do_something Int -> Int // // namespace (f : #F a b c) { // require do_sometihng a = b // } // // === // ?? operators over functions (without arguments, like "def <= = < || ==;") ?? // ?? define operators like OCaml ?? // ?? denote moved type ?? // ?? "trait" VS "typeclass" ??