-
Notifications
You must be signed in to change notification settings - Fork 64
Open
Description
It should be possible to provide default record field definitions in record type declarations. It should be possible to define default functions using the ordinary function definition syntax. This is especially useful when defining traits. For example, in the Ord trait we would really like to have separate fields for <, <= and == with default definitions, because e.g. for numbers they have more efficient implementations than matching on the result of Ord.cmp.
trait
type Ord A := mkOrd {
cmp : A -> A -> Ordering
(<) (x y : A) : Bool := case cmp x y of {
| LT := true
| _ := false
};
..
};
Reactions are currently unavailable