-
Notifications
You must be signed in to change notification settings - Fork 13
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
Parse where clause into the corresponding let (fix #209) #251
Conversation
4e75f87
to
1a688e3
Compare
I could also look into implementing it in L0 if this is what people prefer. |
I think doing this transformation in the Haskell frontend, though an easier task, is not the best idea. |
Cool, thank you @vidsinghal! I can look into that and estimate if I have the resource to pull it out. |
I think, optionally, if you don't have enough time. Hiring undergraduate students is an option. This could be a part time micro-project. |
Indeed, this sounds like a good idea, but the issue is: I personally don't have any connection to undergrads! No idea how to poll them… |
I think Ryan or some other Prof. in the group can recruit on your behalf. |
I actually support desugaring
Here's my counterargument. If |
Chai's argument sounds convincing to me. I can play the advocate of the devil and say that the analogy between L0-4 and the GHC Core is good but has a notable exception: GHC does most (all?) error-reporting at the source syntax level, while in Gibbon it's done in L0-4 mostly (except for outright parse errors). So, there's a higher chance the desugaring will leak into error messages. But it's not too much of a big deal for a research language, I feel. And the rest of the argument holds perfectly, I think: L0-4 feels like it should be kept as a pretty succinct IR like the GHC Core. |
Maybe would be great to have @rrnewton to chime in! |
Oh I did not know that GHC core parses |
It's not exactly that it "parses" where's to let's. It desugars where's to lest's. But before desugaring, it does a lot of work, unlike Gibbon. E.g. typechekcing in GHC works over the source syntax with where's, so that if there's a type error, the error message will preserve the where's... |
Ryan's comment on today's meeting:
I understand the concern that the parser becomes more complicated. But I don't see how to avoid it. Introducing a full another AST before we get to L0 (as seems to be implied) just to desugar Not sure how to proceed. If someone feels strong enough that this patch is Good Enough™, they need to formally approve it. Otherwise, we can just leave it be here, and wait for another time... |
@vollmerm it occurred to me you didn't express your opinion on the matter (or I missed it). tldr; of the above: how do you feel about desugaring Just a reminder, this PR needs one formal approval to get merged. |
All right, not much support here, so closing for now. |
I transform
where
inlet
in theHaskellFrontend.hs
. This is cheap but can lead to confusion in error messages. Not too bad, perhaps, because the bindings are still the same as in the source. The expensive way would be to extend L0 withwhere
, which doesn't sound fun. So, do we want to pay for extending the source language with possible confusion in error messages about this extension? I think it's a fair deal. It also leaves the door open for future re-implementation in the proper way via extending L0...fix #209