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

Extra indentation for hanging \case statements with (&) #1107

Open
ocharles opened this issue Apr 17, 2024 · 1 comment
Open

Extra indentation for hanging \case statements with (&) #1107

ocharles opened this issue Apr 17, 2024 · 1 comment
Labels
style Nitpicking and things related to purely visual aspect for formatting.

Comments

@ocharles
Copy link

Is your feature request related to a problem? Please describe.

I have the following code:

{-# language TemplateHaskell #-}

foo = 
  runBlah
    & handeError @Foo \case
        X -> Y
        A -> B
    & handeError @Bar \case
        U -> V

Currently Ormolu formats this as:

{-# LANGUAGE TemplateHaskell #-}

foo =
  runBlah
    & handeError @Foo \case
      X -> Y
      A -> B
    & handeError @Bar \case
      U -> V

I consider this suboptimal, and the lost indentation makes this hard to read.

Describe the solution you'd like

Ormolu indents each case:

{-# LANGUAGE TemplateHaskell #-}

foo =
  runBlah
    & handeError @Foo \case
        X -> Y
        A -> B
    & handeError @Bar \case
        U -> V
@ocharles
Copy link
Author

I've also noticed

{-# language TemplateHaskell #-}

foo = 
  runBlah
    & fmap \foo ->
        bar

becomes

{-# LANGUAGE TemplateHaskell #-}

foo =
  runBlah
    & fmap \foo ->
      bar

which is a similar problem, so maybe this is more about (&) in general

@amesgen amesgen added the style Nitpicking and things related to purely visual aspect for formatting. label Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
style Nitpicking and things related to purely visual aspect for formatting.
Projects
None yet
Development

No branches or pull requests

2 participants