Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions lib/Language/Haskell/Stylish/Step/Imports.hs
Original file line number Diff line number Diff line change
Expand Up @@ -323,11 +323,14 @@ printImport _ (IEModuleContents _ (L _ m)) = do
putText "module"
space
putText (moduleNameString m)
printImport separateLists (IEThingWith _ name _wildcard imps _) = do
printImport separateLists (IEThingWith _ name wildcard imps _) = do
printIeWrappedName name
when separateLists space
let ellipsis = case wildcard of
IEWildcard _position -> [putText ".."]
NoIEWildcard -> []
parenthesize $
sep (comma >> space) (printIeWrappedName <$> imps)
sep (comma >> space) (ellipsis <> fmap printIeWrappedName imps)
printImport _ (IEGroup _ _ _ ) =
error "Language.Haskell.Stylish.Printer.Imports.printImportExport: unhandled case 'IEGroup'"
printImport _ (IEDoc _ _) =
Expand Down
12 changes: 12 additions & 0 deletions tests/Language/Haskell/Stylish/Step/ModuleHeader/Tests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ tests = testGroup "Language.Haskell.Stylish.Printer.ModuleHeader"
, testCase "Does not sort" ex16
, testCase "Repects separate_lists" ex17
, testCase "Indents absent export list with break_only_where" ex18
, testCase "Respects bundled patterns" ex19
]

--------------------------------------------------------------------------------
Expand Down Expand Up @@ -319,3 +320,14 @@ ex18 = assertSnippet (step defaultConfig {breakOnlyWhere = True})
[ "module Foo"
, " where"
]

ex19 :: Assertion
ex19 = assertSnippet (step defaultConfig)
[ "{-# LANGUAGE PatternSynonyms #-}"
, "module Foo (Bar (.., Baz)) where"
]
[ "{-# LANGUAGE PatternSynonyms #-}"
, "module Foo"
, " ( Bar (.., Baz)"
, " ) where"
]