-
-
Notifications
You must be signed in to change notification settings - Fork 310
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
Specialize types pass #7149
base: main
Are you sure you want to change the base?
Specialize types pass #7149
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good generally. Is the purpose of monomorphize
that you will eventually do all the cloning of expressions/specialization to exact types there?
In monomorphize_type
, I would be sure to clone the type variable. You don't want to reuse the same one, especially if the variable is generic.
I would consider removing most of the tests for now, or using the uitest
framework instead. I'm not sure specializing \x, y -> x y
to ([] -> []), [] -> []
says very much. really, you'll want to see that the specialization produces specific instantiations.
Yeah I plan to add Great point about cloning the variable! I think the way we want to do that is to make a new var here: https://github.com/roc-lang/roc/pull/7149/files#diff-17f90baf2650b85b580fc6e1b09ed4277812b36c92697d17f2473dba5a5c615cR77 ...and then change the next line to |
This isn't trying to do anything with expressions yet; all it does is that you give it a
Variable
andSubs
and it monomorphizes that variable.This is based on the
cor
implementation at https://github.com/ayazhafiz/cor/blob/b67174d98b6dde16809b3606f9f88d4863d8743f/experiments/lss/monotype/lower_type.ml#L62-L63