Bind types passed to isNotEq to Eq

This commit is contained in:
Ayaz Hafiz 2022-10-10 15:54:28 -05:00
parent 0f96a1231e
commit b04d7a9471
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
3 changed files with 9 additions and 8 deletions

View file

@ -99,13 +99,13 @@ not : Bool -> Bool
##
## Note that `isNotEq` takes `'val` instead of `val`, which means `isNotEq` does not
## accept arguments whose types contain functions.
isNotEq : a, a -> Bool
isNotEq : a, a -> Bool | a has Eq
isNotEq = \a, b -> structuralNotEq a b
# ## Calls [isEq] on the given values, then calls [not] on the result.
# ##
# ## `a != b` is shorthand for `Eq.isNotEq a b`.
# isNotEq : a, a -> Bool | a has Eq
# isNotEq = \a, b -> Bool.not (isEq a b)
# INTERNAL COMPILER USE ONLY: used to lower calls to `isEq` to structural
# equality via the `Eq` low-level for derived types.
structuralEq : a, a -> Bool
# INTERNAL COMPILER USE ONLY: used to lower calls to `isNotEq` to structural
# inequality via the `NotEq` low-level for derived types.
structuralNotEq : a, a -> Bool

View file

@ -193,7 +193,7 @@ map_symbol_to_lowlevel_and_arity! {
NumToStr; NUM_TO_STR; 1,
Eq; EQ_STRUCTURAL_EQ; 2,
NotEq; BOOL_NEQ; 2,
NotEq; EQ_STRUCTURAL_NOT_EQ; 2,
And; BOOL_AND; 2,
Or; BOOL_OR; 2,
Not; BOOL_NOT; 1,

View file

@ -1255,7 +1255,8 @@ define_builtins! {
8 EQ_EQ: "Eq" exposed_type=true
9 EQ_IS_EQ: "isEq"
10 EQ_STRUCTURAL_EQ: "structuralEq"
11 BOOL_IS_EQ_IMPL: "boolIsEq"
11 EQ_STRUCTURAL_NOT_EQ: "structuralNotEq"
12 BOOL_IS_EQ_IMPL: "boolIsEq"
}
5 STR: "Str" => {
0 STR_STR: "Str" exposed_apply_type=true // the Str.Str type alias