diff options
author | Ondřej Janošík <j.ondra14@gmail.com> | 2015-09-10 19:23:25 +0200 |
---|---|---|
committer | Ondřej Janošík <j.ondra14@gmail.com> | 2015-09-10 19:48:09 +0200 |
commit | 9bface0dfe50822eca317fd0d7cb89f5f3360279 (patch) | |
tree | 80b8288838115b2aa3d2db10f629317777be356b /src | |
parent | d19a98e05858fbca2562564ce604a1af08cc334f (diff) | |
download | stylish-haskell-9bface0dfe50822eca317fd0d7cb89f5f3360279.tar.gz |
Separate lists option for imports
Diffstat (limited to 'src')
-rw-r--r-- | src/Language/Haskell/Stylish/Config.hs | 3 | ||||
-rw-r--r-- | src/Language/Haskell/Stylish/Step/Imports.hs | 7 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/Language/Haskell/Stylish/Config.hs b/src/Language/Haskell/Stylish/Config.hs index c176eb6..b8ae588 100644 --- a/src/Language/Haskell/Stylish/Config.hs +++ b/src/Language/Haskell/Stylish/Config.hs @@ -169,8 +169,9 @@ parseImports config o = Imports.step <*> (o A..:? "list_align" >>= parseEnum listAligns Imports.AfterAlias) <*> (o A..:? "long_list_align" >>= parseEnum longListAligns Imports.Inline) - <*> (maybe 4 (max 1) <$> o A..:? "list_padding")) + <*> (maybe 4 (max 1) <$> o A..:? "list_padding") -- ^ Padding have to be at least 1. Default is 4. + <*> o A..:? "separate_lists" A..!= True) where aligns = [ ("global", Imports.Global) diff --git a/src/Language/Haskell/Stylish/Step/Imports.hs b/src/Language/Haskell/Stylish/Step/Imports.hs index f47d594..2dd6a2a 100644 --- a/src/Language/Haskell/Stylish/Step/Imports.hs +++ b/src/Language/Haskell/Stylish/Step/Imports.hs @@ -31,6 +31,7 @@ data Align = Align , listAlign :: ListAlign , longListAlign :: LongListAlign , listPadding :: Int + , separateLists :: Bool } deriving (Eq, Show) @@ -203,7 +204,11 @@ prettyImport columns Align{..} padQualified padName longest imp = mapSpecs f = case importSpecs of Nothing -> [] -- Import everything Just [] -> ["()"] -- Instance only imports - Just is -> f $ map prettyImportSpec is + Just is -> f $ map format is + where + format + | separateLists = prettyImportSpec + | otherwise = H.prettyPrint -------------------------------------------------------------------------------- |