packages feed

stylish-haskell 0.5.3.0 → 0.5.4.0

raw patch · 5 files changed

+45/−4 lines, 5 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Language.Haskell.Stylish: File :: Align

Files

data/stylish-haskell.yaml view
@@ -22,6 +22,9 @@       # - global: Align the import names and import list throughout the entire       #   file.       #+      # - file: Like global, but don't add padding when there are no qualified+      #   imports in the file.+      #       # - group: Only align the imports per group (a group is formed by adjacent       #   import lines).       #
src/Language/Haskell/Stylish/Config.hs view
@@ -159,6 +159,7 @@   where     aligns =         [ ("global", Imports.Global)+        , ("file",   Imports.File)         , ("group",  Imports.Group)         , ("none",   Imports.None)         ]
src/Language/Haskell/Stylish/Step/Imports.hs view
@@ -24,6 +24,7 @@ -------------------------------------------------------------------------------- data Align     = Global+    | File     | Group     | None     deriving (Eq, Show)@@ -144,8 +145,9 @@   ---------------------------------------------------------------------------------prettyImportGroup :: Int -> Align -> Int -> [H.ImportDecl LineBlock] -> Lines-prettyImportGroup columns align longest imps =+prettyImportGroup :: Int -> Align -> Bool -> Int -> [H.ImportDecl LineBlock]+                  -> Lines+prettyImportGroup columns align fileAlign longest imps =     concatMap (prettyImport columns padQual padName longest') $     sortBy compareImports imps   where@@ -157,6 +159,7 @@      padQual = case align of         Global -> True+        File   -> fileAlign         Group  -> any H.importQualified imps         None   -> False @@ -169,10 +172,15 @@ -------------------------------------------------------------------------------- step' :: Int -> Align -> Lines -> Module -> Lines step' columns align ls (module', _) = flip applyChanges ls-    [ change block (const $ prettyImportGroup columns align longest importGroup)+    [ change block $ const $+        prettyImportGroup columns align fileAlign longest importGroup     | (block, importGroup) <- groups     ]   where     imps    = map sortImportSpecs $ imports $ fmap linesFromSrcSpan module'     longest = longestImport imps     groups  = groupAdjacent imps++    fileAlign = case align of+        File -> any H.importQualified imps+        _    -> False
stylish-haskell.cabal view
@@ -1,5 +1,5 @@ Name:          stylish-haskell-Version:       0.5.3.0+Version:       0.5.4.0 Synopsis:      Haskell code prettifier Homepage:      https://github.com/jaspervdj/stylish-haskell License:       BSD3
tests/Language/Haskell/Stylish/Step/Imports/Tests.hs view
@@ -23,6 +23,8 @@     , testCase "case 03" case03     , testCase "case 04" case04     , testCase "case 05" case05+    , testCase "case 06" case06+    , testCase "case 07" case07     ]  @@ -121,3 +123,30 @@   where     input' = "import Distribution.PackageDescription.Configuration " ++         "(finalizePackageDescription)\n"+++--------------------------------------------------------------------------------+case06 :: Assertion+case06 = input' @=? testStep (step 80 File) input'+  where+    input' = unlines+        [ "import Bar.Qux"+        , "import Foo.Bar"+        ]+++--------------------------------------------------------------------------------+case07 :: Assertion+case07 = expected @=? testStep (step 80 File) input'+  where+    input' = unlines+        [ "import Bar.Qux"+        , ""+        , "import qualified Foo.Bar"+        ]++    expected = unlines+        [ "import           Bar.Qux"+        , ""+        , "import qualified Foo.Bar"+        ]