2023-04-11 13:49:22 +03:00
|
|
|
typeclass Copy =
|
|
|
|
|
& copy : Copy -> Copy
|
2023-03-31 12:10:12 +03:00
|
|
|
|
2023-04-11 13:49:22 +03:00
|
|
|
typeclass (Ord : #Eq) =
|
|
|
|
|
& ( < ) : Ord -> Ord -> Bool
|
|
|
|
|
& ( > ) : Ord -> Ord -> Bool
|
|
|
|
|
& ( <= ) : Ord -> Ord -> Bool
|
|
|
|
|
& ( >= ) : Ord -> Ord -> Bool
|
2023-03-31 12:10:12 +03:00
|
|
|
|
2023-04-11 13:49:22 +03:00
|
|
|
typeclass (D : #A #B #C) 'A 'B =
|
2023-03-31 12:10:12 +03:00
|
|
|
& do_something : Unit -> (& 'A & 'B)
|
|
|
|
|
|
2023-04-11 13:49:22 +03:00
|
|
|
typeclass E 'A =
|
2023-03-31 12:10:12 +03:00
|
|
|
& do_something : Unit -> 'A
|
|
|
|
|
|
2023-04-11 13:49:22 +03:00
|
|
|
namespace const ord : Ord {
|
2023-03-31 12:10:12 +03:00
|
|
|
def ( <= ) : a b = (a < b) || (a == b)
|
|
|
|
|
def ( > ) : a b = !(a <= b)
|
|
|
|
|
def ( >= ) : a b = !(a < b)
|
|
|
|
|
}
|