Skip to content

Conversation

@phadej
Copy link
Contributor

@phadej phadej commented Jan 19, 2017

With one file formatted as an example.

AFAICS, this is only configuration where indentation/alignment won't change globally if you add/remove long module name or qualified imports.

One option would be to have short lists right after the module name, but there isn't such configuration option in stylish-haskell atm.

@phadej phadej requested a review from jkarni January 19, 2017 17:25
@fizruk
Copy link
Member

fizruk commented Jan 19, 2017

I'm not a big fan of aligned imports anyway, but I'm all for simpler diffs. Looks good to me! 👍

@phadej
Copy link
Contributor Author

phadej commented Jan 21, 2017

I'd like others @haskell-servant/maintainers to comment, as I plan to reformat everything, and try to remember to do that regularly in the future

@alpmestan
Copy link
Contributor

Do we really want to stick so hard to stylish haskell? I won't fight it, but I'll never encourage it either =)

@phadej
Copy link
Contributor Author

phadej commented Jan 22, 2017

@alpmestan looking across servant codebase, the import styles vary a lot, what worse even inside single file. As a contributor I'm always confused "now I have to add new module import, where and how should I put it". From that POV uniform style will help.

I'm not the huge fan of the style proposed, but it's one of diff friendly ones.

Another variant is to separate explicit import lists and qualified imports into two groups:

import Data.Maybe
       (mapMaybe)
import Data.List
       (foldl')
import GHC.Generics
       (Generic)

-- not `as` isn’t indented
import qualified Data.ByteString as BS
import qualified Data.Text as T

or third:

import Data.Maybe
       (mapMaybe, fromJust, isNothing, catMaybe)
import Data.List (foldl')
import GHC.Generics (Generic)

import qualified Data.ByteString as BS
import qualified Data.Text as T

(third isn’t supported by stylish-haskell, but it’s an easy addition)

@jkarni
Copy link
Member

jkarni commented Jan 24, 2017

I'm in favor of a unified style, but don't much care for which, so I'm happy either way here.

@phadej
Copy link
Contributor Author

phadej commented Mar 11, 2018

I'm merging this. I'm so used to %!styli<tab> to reformat imports, and even this format is vertically verbose, it's somewhat diff-friendliest

@phadej phadej closed this Mar 11, 2018
@phadej phadej reopened this Mar 11, 2018
@phadej phadej merged commit 6d1ae0d into haskell-servant:master Mar 11, 2018
@phadej phadej deleted the stylish-haskell branch March 11, 2018 16:28
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.

4 participants