tree-sitter / tree-sitter-haskell

Haskell grammar for tree-sitter.
MIT License
157 stars 37 forks source link

Support `OverloadedRecordDot` #97

Closed ocharles closed 1 year ago

ocharles commented 1 year ago

Right now tree-sitter-haskell parses foo.bar as if it's foo . bar - that is, the composition of foo and bar functions with the infix . operator. If -XOverloadedRecordDot is on, this should parse as accessing the field bar of the expression foo.

tek commented 1 year ago

We can't parse conditioned on extensions, but since the dot is already whitespace sensitive, I think it makes sense to default to parsing a projection for the no-whitespace case when the preceding expression is not a conid. A cursory glance at the grammar suggests that this requires quite a bit of rearrangement of rules, so this is an opportunity to clean up a bit 🙂

ocharles commented 1 year ago

Fair enough! Note that you probably also want to parse (.foo) specially, too.

tek commented 1 year ago

noted!

tek commented 1 year ago

please take a look, @ocharles : https://github.com/tree-sitter/tree-sitter-haskell/pull/98

ocharles commented 1 year ago

Thanks, I'm just rebuild Helix with this now - I'll report back!

ocharles commented 1 year ago

image

Neato!

tek commented 1 year ago

cool 🙂 let's merge it then

ocharles commented 1 year ago

Yep, I think everything is good here