Skip to content

Infix data constructors should be printed infix when case splitting #468

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

Closed
mpickering opened this issue Oct 5, 2020 · 0 comments · Fixed by #519
Closed

Infix data constructors should be printed infix when case splitting #468

mpickering opened this issue Oct 5, 2020 · 0 comments · Fixed by #519
Assignees
Labels

Comments

@mpickering
Copy link
Contributor

For example, here is the generated code for lists. Even if there is just a special case for lists it would be better I think.

Screen Shot 2020-10-05 at 15 38 51

@isovector isovector self-assigned this Oct 19, 2020
isovector added a commit to isovector/haskell-language-server that referenced this issue Oct 19, 2020
isovector added a commit that referenced this issue Oct 20, 2020
…actics (#519)

The tactics plugin is a bit stupid when working with infix-defined datacons, both in expressions and patterns. For example it will produce (,) a b and (:) a as rather than the more natural (a, b) and a : as. This PR makes it do the right thing.

The solution is to inspect the data con when building an expression or pattern. Unfortunately tuples are extra special in GHC, so this introduces a special case for tuples, and another for everyday infix things (like list).

There's a bit of annoying fiddling in order to build the infix pattern. The logic is in infixifyPatIfNecessary, which is the only thing I'm not super comfortable with in the diff.

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

Successfully merging a pull request may close this issue.

3 participants