summaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorMoritz Drexl <mdrexl@fastmail.fm>2016-12-13 22:48:20 +0100
committerMoritz Drexl <mdrexl@fastmail.fm>2016-12-13 22:48:20 +0100
commit3d3865a4e605ca9a1ceacdcdab6c19df17de0079 (patch)
treedb4f32982fa559de0fd4aaadf0f5fe96b8e21e0b /lib
parent7d29962850f66ec62945a5fe784e73194a942526 (diff)
downloadstylish-haskell-3d3865a4e605ca9a1ceacdcdab6c19df17de0079.tar.gz
keep `safe` and `{-# SOURCE #-}` import annotations
Diffstat (limited to 'lib')
-rw-r--r--lib/Language/Haskell/Stylish/Step/Imports.hs10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Language/Haskell/Stylish/Step/Imports.hs b/lib/Language/Haskell/Stylish/Step/Imports.hs
index 334fa15..08918ae 100644
--- a/lib/Language/Haskell/Stylish/Step/Imports.hs
+++ b/lib/Language/Haskell/Stylish/Step/Imports.hs
@@ -235,6 +235,8 @@ prettyImport columns Options{..} padQualified padName longest imp
base' baseName importAs hasHiding' = unwords $ concat $ filter (not . null)
[ ["import"]
+ , source
+ , safe
, qualified
, show <$> maybeToList (H.importPkg imp)
, [baseName]
@@ -262,6 +264,14 @@ prettyImport columns Options{..} padQualified padName longest imp
| padQualified = [" "]
| otherwise = []
+ safe
+ | H.importSafe imp = ["safe"]
+ | otherwise = []
+
+ source
+ | H.importSrc imp = ["{-# SOURCE #-}"]
+ | otherwise = []
+
mapSpecs f = case importSpecs of
Nothing -> [] -- Import everything
Just [] -> ["()"] -- Instance only imports