Format let and in on a single line if they fit #97

Merged
eborden merged 3 commits from let-in-on-single-lines into dev 2018-01-13 21:39:12 +01:00
eborden commented 2017-12-31 06:08:34 +01:00 (Migrated from github.com)

This addresses #73

The following is wasteful of vertical space:

_ =
  let
    longIdentifierForShortValue = 1
  in
    longIdentifierForShortValue + longIdentifierForShortValue

We should format it on two lines if possible.

_ =
  let longIdentifierForShortValue = 1
  in longIdentifierForShortValue + longIdentifierForShortValue

This commit also allows for a mix of variations:

_ =
  let
    longIdentifierForShortValue = 1
  in longIdentifierForShortValue + longIdentifierForShortValue

_ =
  let longIdentifierForShortValue = 1
  in
    longIdentifierForShortValue + longIdentifierForShortValue
This addresses #73 The following is wasteful of vertical space: ``` _ = let longIdentifierForShortValue = 1 in longIdentifierForShortValue + longIdentifierForShortValue ``` We should format it on two lines if possible. ``` _ = let longIdentifierForShortValue = 1 in longIdentifierForShortValue + longIdentifierForShortValue ``` This commit also allows for a mix of variations: ``` _ = let longIdentifierForShortValue = 1 in longIdentifierForShortValue + longIdentifierForShortValue _ = let longIdentifierForShortValue = 1 in longIdentifierForShortValue + longIdentifierForShortValue ```
lspitzner (Migrated from github.com) reviewed 2017-12-31 11:01:36 +01:00
lspitzner (Migrated from github.com) commented 2017-12-31 11:01:36 +01:00

uhm, appSep should append a separator (space) if required. So appSep "in " is redundant, and also there should be no reason not to unconditionally use appSep here. (and i realize this was not introduced by this diff - the same redundancy was in the before-state.)

Or was there some issue around a comment following in?.. lets just test. could you try if replacing ifIndentLeftElse id appSep $ docLit $ Text.pack "in " with appSep $ docLit $ Text.pack "in" works?

uhm, `appSep` should append a separator (space) if required. So `appSep "in "` is redundant, and also there should be no reason not to unconditionally use `appSep` here. (and i realize this was not introduced by this diff - the same redundancy was in the before-state.) Or was there some issue around a comment following `in`?.. lets just test. could you try if replacing `ifIndentLeftElse id appSep $ docLit $ Text.pack "in "` with `appSep $ docLit $ Text.pack "in"` works?
lspitzner commented 2017-12-31 11:03:07 +01:00 (Migrated from github.com)

looks good (otherwise)!

looks good (otherwise)!
chreekat (Migrated from github.com) reviewed 2018-01-13 02:02:28 +01:00
chreekat (Migrated from github.com) commented 2018-01-13 02:02:28 +01:00

Shooting from the hip here, but maybe this makes xxx and yyy line up in

let xxx = ...
in  yyy ...

?

I'd check, but my network connection won't really let me at present.

Shooting from the hip here, but maybe this makes xxx and yyy line up in ```haskell let xxx = ... in yyy ... ``` ? I'd check, but my network connection won't really let me at present.
lspitzner (Migrated from github.com) reviewed 2018-01-13 18:45:39 +01:00
lspitzner (Migrated from github.com) commented 2018-01-13 18:45:39 +01:00

@chreekat oh, right. I missed that detail. I guess then this is fine.

@chreekat oh, right. I missed that detail. I guess then this is fine.
lspitzner commented 2018-01-13 21:39:20 +01:00 (Migrated from github.com)

thanks!

thanks!
eborden commented 2018-01-13 22:33:44 +01:00 (Migrated from github.com)

Thanks for finishing this one off @lspitzner

Thanks for finishing this one off @lspitzner
Sign in to join this conversation.
There is no content yet.