Skip to content

Conversation

Futarimiti
Copy link
Contributor

Correctly indent further cases for a lambda case expression where the first pattern is on the same line as \case.

Examples:

lambda_case :: Maybe Int -> Int
lambda_case = \case Nothing -> 0
>>>>>>>>>>>>>>>>>>>>Just n -> n

lambda_case2 :: (Bool, Bool) -> Int
lambda_case2 = \case(True,True)->1
>>>>>>>>>>>>>>>>>>>>(_, False) -> 3

correctly indent further cases for a lambda case expression where the first pattern is on the same line as `\case`
@Futarimiti
Copy link
Contributor Author

Futarimiti commented Aug 3, 2024

Let me know if you want me to add tests as well, or make use of g:haskell_indent_disable_case

@itchyny
Copy link
Owner

itchyny commented Aug 4, 2024

Yes, please add tests.

@Futarimiti Futarimiti marked this pull request as ready for review August 4, 2024 02:20
`\ case`, `\    case`, etc. are allowed in LambdaCase syntax.
Also update test to reflect this.
@Futarimiti Futarimiti marked this pull request as draft August 4, 2024 07:53
@Futarimiti
Copy link
Contributor Author

Just found out \ case would be valid lambda case as well, which is not covered here

@Futarimiti
Copy link
Contributor Author

Good enough I believe. Take a look! @itchyny

@Futarimiti Futarimiti marked this pull request as ready for review August 4, 2024 08:33
Copy link
Owner

@itchyny itchyny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@itchyny itchyny merged commit dc8b3af into itchyny:master Aug 9, 2024
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

Successfully merging this pull request may close these issues.

2 participants