-
Notifications
You must be signed in to change notification settings - Fork 114
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
Correct location annotation for parenthesized expressions #739
Correct location annotation for parenthesized expressions #739
Conversation
I would crack more about the nature of the fixpoints in recursivity and so |
Oh, wait, |
Yeah, it feels a little weird to have to strip the annotation and add it again, but seemed like the least intrusive change available. Could perhaps make it a little neater with a |
Would it be possible to get this (and perhaps other recent PRs) merged if there are no problems? A release would be super too, I'd like to sort out the |
It is currenly very late night. I promise, would sort this out during tomorrow. Thanks for the notification of urgency. |
Thanks!
Urgent is a strong word! As long as it doesn't take months then I'm happy
:)
…On Wed, Oct 28, 2020, 9:02 AM Anton Latukha ***@***.***> wrote:
It is currenly very late night. I promise, would sort this out during
tomorrow.
Thanks for the notification of urgency.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#739 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAGRJXEGH7QW6T2RUHKFQATSM5USNANCNFSM4STGNI3A>
.
|
John probably allowed me to tackle this. Sorry, outside it looks very silly that I take so much time with this. I essentially needed to do a bunch of things to be a better HNix maintainer, so on first request, I started a lazy evaluation of them Since we do not understand completely the theory, and one needs to understand at least roughly why the cases with code Fix/unFix and procedures are such and what is happening in the algorythm structures - I went on looking some lectures on the recursion schemes. Started to understand the gist of it. So far I got a ground basic theoretical understanding. For ex. I know what those As I observed it is a pattern that recursion schemes question is a rock people stumble on maintenance/contribution to HNix, so it needs at least some basic quick walkthrough explanation for people and links for good materials on it. Since it is the case that Haskell development on NixOS, may I say, - is more a Nix development exercise case sphere. Haskell dev can not really live comfortably on NixOS at current state of affairs. I also once was one who wrote the first article on how to integrate Emacs/HIE/Nix for other people, but in the winter that was no more, and I got bothered that for everyone HLS easilly works already, and for me - all my tries got nope, nope nope. VSCode worked from the box and Emacs - nope. Fixed it yesterday - it was a mix of some upstream bugs, one obscure side-effect bug of a feature that I took as a whole Spacemacs state save feature 1.5 years ago. And as a proper Linux citizen I make daemons a systmed services, and so Emacs daemon did not imported the user env, since systemd services run in the clear env by default - Emacs had no ghcup path loaded, but message retunred by lsp-haskell is really obscure, so I probably should uspream a fix there. So that what I did in these 1.5 weeks. Sorry. Now I am more capable of doing support. |
tl;rd -> section "Most probably" Honestly, it is an end API function, which currently not documented itself and around it also not much docs. I indeed can not understand why code strips annotation and then put it back on - and that becomes a working implementation of it. As I understand - Since what is inside If Parser (NExprF NExprLoc) And what Fix NExprF And type NExpr = Fix NExprF So how we need For me, it seems we are close to finding the proper solution, somewhere indeed should be Fix, or the It is if Maybe it is a replacement of Most probably:What arrives is already annotated expression and annotateLocation1 = fmap annToAnnF . annotateLocation and that does what is needed. -- it is also logical to take that definition and do only the last part of it, And the annToAnnF :: Ann ann (f (Fix (AnnF ann f))) -> Fix (AnnF ann f)
annToAnnF (Ann ann a) = AnnE ann a
--- ... (where)
pattern AnnE ann a = Fix (Compose (Ann ann a)) -- it takes an annotated expression and composes new annotation onto it. Which seems what parens are semantically about (invisible abstraction around something). So: nixParens = fmap annToAnnF ... parens ... nixToplevelForm <?> "parens" -- ... profit! In play before this idea - had yielded something like (or literally) I think it is worth playing with this and figuring it out a little more, so one of us finds the idea. |
Not at all.
I think you might have confused
Just for some context, I wrote the original code adding location annotations:
Sorry, I should have been clearer in the commit message. At the moment parentheses are not included in the location annotation for nix
Because the top level annotation is incorrect, as it doesn't include the parentheses.
Correct, note that
This is not correct.
hence
Exactly, the
It doesn't add any new annotations (indeed there are no new annotations to add
That's pretty much what's going on in this change.
Thank you for making me think about this a bit more, upon reviewing the code This PR is an improvement on the status quo, but future work should make sure |
it is not generally appropriate to have higher-order parsers operate on annotated locations as they are liable to perform changes to the parser which are not captured in the annotation. See haskell-nix#739 and haskell-nix#744 for examples.
2846105
to
36c55d2
Compare
At the moment parentheses are not included in the location annotation for nix expressions. This changes the code to include any parentheses in the SrcSpan of the underlying expression. Information which is difficult to recover otherwise.
it is not generally appropriate to have higher-order parsers operate on annotated locations as they are liable to perform changes to the parser which are not captured in the annotation. See haskell-nix#739 and haskell-nix#744 for examples.
36c55d2
to
b00c6fa
Compare
I have improved the comment on |
Such in-depth response, very informative, thank you! Indeed, I thought that Since it is one level of annotation action, on the first read I see that the case is solved here. I would parse your respone a couple of times more further down the line. And I see that I going to go into a phase of making adjustments to the project code, mainly docs and renaming some functions where rename is appropriate to be descriptive of the action, or since John has a particular naming style - naming convention should be cleared-out, so the code would be more readable from the function names and so fewer docs/explanations would be needed for working with it. The main point I currently see for me, is to work on making the project more approachable for contributors, so additional thanks for adding some comments. I have great experience working with you, thank you. |
Thanks! |
This change is