-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Polymorphic equality #1267
base: dev
Are you sure you want to change the base?
Polymorphic equality #1267
Conversation
This reverts commit e8a22ac. quit change DH.re
@GuoDCZ let's better handle functions:
|
@cyrus- just to make sure I got the idea. When we refer to static error, does it mean something like: |
Yes. I'm not sure you need a new synthesis mode, but a new error definitely makes sense. |
…into polymorphic-equal-test merge to push
I think equality with holes should probably not evaluate - e.g. |
We should statically prevent comparison at any sum type where any constructor has an argument that contains an arrow type (recursively including in components of sums and products). |
We will still need run-time checking as well I suppose, due to polymorphism (we may not know the type it is instantiated with statically), but let's give errors here as early as possible. |
Remaining type inconsistency checker issue. Can be solved by fixing #1370 |
#1252.
Enable polymorphic equal / not equal comparison for:
Int
,Bool
,Float
,String
: Compare valueTuple
&List
: Pairwise comparison. ForList
, also check internal type consistencySum
: Same as OcamlWe disallow comparison of inconsistent types and types contain arrow:
Inconsistent
when inconsistent types of both side is detected.CompareArrow
when either a primitive is an arrow or a compound type contains an arrowSum
type raiseCompareArrow
if any entry contains an arrow argument.Front-end tests: