Skip to content
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

Special-case lenses from makeLenses to link to field definition #134

Open
judah opened this issue Feb 18, 2020 · 1 comment
Open

Special-case lenses from makeLenses to link to field definition #134

judah opened this issue Feb 18, 2020 · 1 comment

Comments

@judah
Copy link

judah commented Feb 18, 2020

We had the following suggestion: currently, if you click on a lens generated by makeLenses, it goes to the original TemplateHaskell call $(makeLenses ...) (from Control.Lens.TH). That's technically correct, since that's where the lens is defined, but almost always what you really want is the original record field definition instead. For example, in

data Foo  = Foo { _bar :: Int }
$(makeLenses ''Foo)
...
... = ... bar ...

Clicking on bar in the last line should go to the original definition of _bar, rather than the call to makeLenses. The latter might not be close by the field, or it might be less convenient when there are many fields of a given record.

@robinp
Copy link
Collaborator

robinp commented Feb 19, 2020

Didn't check deeply, but maybe the generates edges are useful for this - see #15 and https://kythe.io/docs/schema/#generates.

If you emit the generates edge between the right entities, then the Kythe indexer will magically make the connection.. kythe/kythe@f7614b1 might be some inspiration, but this cleanly needs more clarification. I remember there was a good readme in the Kythe repo (maybe https://www.kythe.io/docs/schema/indexing-generated-code.html?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants