-
Notifications
You must be signed in to change notification settings - Fork 158
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
Add let generalization #532
Comments
Reading through the paper again, their main argument is related to problems with constraint based type systems. Let's take for example one of their examples of the issue: data S a where
MkS :: Show a => a -> S a
fs :: a -> S a -> Bool
fs x y = let h z = show x
in case y of
MkS v -> show v ++ h () This does not type check in Haskell, but with let generalization it would (since the function h would be generalized to include a Show constraint). Koka does not have the same problem, show instances do not get populated in datatypes and implicitly destructured, additionally generalizing lambdas does not add implicit arguments. |
Currently Koka instantiates at lets, this causes issues with using a function at multiple different effects.
Making that small change would solve the following issues.
#401
#402
Daan has been concerned whether this will cause other issues, due to some issues mentioned in this paper:
Let should not be generalized
We should investigate whether Koka has the problems listed in the paper, and if not, let generalize, which would make the effect system a lot nicer.
The text was updated successfully, but these errors were encountered: