lspitzner / brittany

haskell source code formatter
GNU Affero General Public License v3.0
690 stars 72 forks source link

Excessive newlining #278

Open hasufell opened 4 years ago

hasufell commented 4 years ago

I don't remember whether this was discussed a few years ago, but:

main :: IO ()
main = do
  let run e = do
      settings <- exceptT (\_ -> die . color Red $ "Could not get settings, make sure to run 'ghup config' first") pure $ getSettings (flip runReaderT) settings . runExceptT . withExceptT show $ e
      pure settings
  pure ()

Becomes

module Main where

main :: IO ()
main = do
  let
    run e = do
      settings <-
        exceptT
          (\_ ->
            die
              . color Red
              $ "Could not get settings, make sure to run 'ghup config' first"
          )
          pure
        $ getSettings (flip runReaderT) settings
        . runExceptT
        . withExceptT show
        $ e
      pure settings
  pure ()

I think what makes it look bad is the newlines after let, settings <- and (\_ ->

tfausak commented 4 years ago

I agree, those newlines seem unnecessary to me. Is this what you'd like to see instead?

main = do
  let run e = do
      settings <- exceptT
          (\_ -> die
              . color Red
              $ "Could not get settings, make sure to run 'ghup config' first"
          )
          pure
        $ getSettings (flip runReaderT) settings
        . runExceptT
        . withExceptT show
        $ e
      pure settings
  pure ()