You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@cyrus- are you still okay making the equality operator polymorphic? I've done this on the LLM branch for convenience, so I'll copy-paste some code here to accelerate someone doing it for real.
Add case to statics.re:
| BinOp(Int(Equals | NotEquals), e1, e2) =>
let (e1, m) = go(~mode=Syn, e1, m);
let (e2, m) = go(~mode=Ana(e1.ty), e2, m);
add(~self=Just(Bool), ~co_ctx=CoCtx.union([e1.co_ctx, e2.co_ctx]), m);
The above is sufficient to get it basically working. Remaining issues:
Decide on behavior on edge cases, in particular function values. We could prohibit comparisons of types (which contain) arrow types at the static level, or just always return false at the dynamic level. The latter is simpler, but can be confusing, especially if you have a large type that you've forgotten has an arrow somewhere in it (this happens in the Hazel model type not infrequently...). The above code currently just compares for structural equality of function implementations, including closed over values
Data structures cleanup and backcompat: Remove operators from Int BinOp subtype, remove float and string specific operators (maybe? backwards compatibility is starting to become a concern)
Update langdocs
The text was updated successfully, but these errors were encountered:
cyrus-
changed the title
polymorphic equality and inequality (starter project?)
polymorphic equality and inequality
Mar 20, 2024
neither. it's in llama-lsp-lookahead (something something hardest problem in computer science). note that literally all the relevant code written so far is reproduced above though
@cyrus- are you still okay making the equality operator polymorphic? I've done this on the LLM branch for convenience, so I'll copy-paste some code here to accelerate someone doing it for real.
The above is sufficient to get it basically working. Remaining issues:
The text was updated successfully, but these errors were encountered: