Excessive newlining #278

Open
opened 2020-01-31 20:00:37 +01:00 by hasufell · 1 comment
hasufell commented 2020-01-31 20:00:37 +01:00 (Migrated from github.com)

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 (\_ ->

I don't remember whether this was discussed a few years ago, but: ```hs 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 ```hs 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 2020-07-21 14:42:22 +02:00 (Migrated from github.com)

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 ()
I agree, those newlines seem unnecessary to me. Is this what you'd like to see instead? ``` hs 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 () ```
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: hexagoxel/brittany#278
There is no content yet.