Merged
Conversation
When we parsed where clauses, we desugared directly to a let binding. When we did that desugaring, we lost the information about whether a let binding was ever a where clause. We add a bit of metadata to the let bindings we generate so we can track whether it began its life as a where clause or not. This is already showing to be directly useful, as we can pretty print where clauses! Should allow external tools to also benefit from the metadata.
Although not explicitly required for tracking where clauses, this seems beneficial to have in the CoreFn. It should help external tools track where clauses. Also, we already had the metadata. Why not pass it along?
garyb
reviewed
Apr 23, 2018
Member
garyb
left a comment
There was a problem hiding this comment.
This approach seems reasonable to me, it's pretty conservative but gets the information you need - we can make a more drastic change at a later date if we decide to change the where semantics to be more like Haskell.
Tests, I think what we have will probably cover this already - I haven't checked, but I would have thought there's at least one passing test that uses a let and one that uses a where 😉
| -- | | ||
| -- The let binding was always a let binding | ||
| -- | ||
| | NotFromWhere |
| exprToCoreFn ss com ty (A.Let A.FromWhere ds v) = | ||
| Let (ss, com, ty, Just IsWhere) (concatMap declToCoreFn ds) (exprToCoreFn ss [] Nothing v) | ||
| exprToCoreFn ss com ty (A.Let A.NotFromWhere ds v) = | ||
| Let (ss, com, ty, Nothing) (concatMap declToCoreFn ds) (exprToCoreFn ss [] Nothing v) |
Member
There was a problem hiding this comment.
Since these cases match apart from the metadata part, maybe could just move the conditional in there?
Member
|
And yep, tests are known to fail right now, it's being worked on! |
Member
Member
|
Any further comments anyone, or should I merge this? |
Member
|
Thanks @joneshf 😄 |
Member
Author
|
Thank you all! |
This was referenced Apr 25, 2018
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Re: #3297
Opening this PR to get some feedback on this approach.
CoreFnstuff. I think I got all the places, but might have missed something. Is this the right idea? Is that the right way to do it if so?purescript-foldable-traversable. Since the changes in this branch are unrelated, I'm assuming it's known and can merge in a fix to this branch once it's onmaster.