mirror of
https://codeberg.org/ProgramSnail/lang_2023.git
synced 2025-12-06 06:58:45 +00:00
20 lines
445 B
Text
20 lines
445 B
Text
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)
|
|
}
|