hindent 4.6.0 → 4.6.1
raw patch · 7 files changed
+24/−12 lines, 7 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- hindent.cabal +1/−1
- src/HIndent/Styles/Gibiansky.hs +11/−10
- test/Spec.hs +6/−1
- test/chris-done/expected/12.exp +2/−0
- test/chris-done/expected/20.exp +1/−0
- test/chris-done/tests/20.test +1/−0
- test/fundamental/expected/12.exp +2/−0
hindent.cabal view
@@ -1,5 +1,5 @@ name: hindent-version: 4.6.0+version: 4.6.1 synopsis: Extensible Haskell pretty printer description: Extensible Haskell pretty printer. Both a library and an executable. .
src/HIndent/Styles/Gibiansky.hs view
@@ -75,7 +75,7 @@ config <- gets psConfig col <- getColumn return $ go (fromIntegral col) config cs- + where go currentColumn config = concatMap mergeGroup . groupComments Nothing [] where@@ -101,7 +101,7 @@ nextCommentStartLine = srcSpanStartLine $ commentSrcSpan $ head comments currentGroupAsList | null accum = [] | otherwise = [reverse accum]- nextLine' = + nextLine' = case nextLine of Just x -> Just (x + 1) Nothing -> Just nextCommentStartLine@@ -125,8 +125,8 @@ mergeGroup :: [Comment] -> [Comment] mergeGroup [] = error "Empty comment group" mergeGroup comments@[Comment True _ _] = comments- mergeGroup comments = - let + mergeGroup comments =+ let firstSrcSpan = commentSrcSpan $ head comments firstLine = srcSpanStartLine firstSrcSpan firstCol = srcSpanStartColumn firstSrcSpan@@ -260,6 +260,7 @@ forM_ mtool $ \tool -> do write "_" string $ prettyPrint tool+ write " " string opt write "#-}" pragmas p = prettyNoExt p@@ -297,7 +298,7 @@ col <- getColumn len <- prettyColLength spec maxColumns <- configMaxColumns <$> gets psConfig- if col + len > maxColumns + if col + len > maxColumns then newline else space @@ -655,7 +656,7 @@ if any isBefore $ nodeInfoComments $ ann exp then multi else attemptSingleLine (space >> pretty exp) multi- + where multi = do newline indented indentSpaces $ pretty exp@@ -703,7 +704,7 @@ return $ prettyCase (Just maxPatLen) else return $ prettyCase Nothing - case alts of + case alts of [] -> return () first:rest -> do printComments Before first@@ -843,7 +844,7 @@ if not manyStmts && lineBreakAfterRhs rhsLoc exp then newline >> indented indentSpaces (pretty exp) else space >> pretty exp- writeStmts = + writeStmts = case stmts of x:xs -> do pretty x@@ -852,7 +853,7 @@ printComments Before a if manyStmts- then do + then do depend (write "| ") writeStmts remainder else@@ -998,7 +999,7 @@ let vals' = map (amap fixSpans) vals (first:rest) = vals' - + pretty' first forM_ (zip vals' rest) $ \(prev, cur) -> do replicateM_ (max 1 $ lineDelta cur prev) newline
test/Spec.hs view
@@ -10,6 +10,8 @@ import qualified Data.Text.Lazy as L import qualified Data.Text.Lazy.Builder as L +import Language.Haskell.Exts.Extension+ import qualified HIndent styles :: [FilePath]@@ -61,9 +63,12 @@ mkSpec :: HIndent.Style -> String -> String -> Spec mkSpec style input desired = it "works" $- case HIndent.reformat style Nothing (L.pack input) of+ case HIndent.reformat style (Just exts) (L.pack input) of Left err -> expectationFailure ("Error: " ++ err) Right builder -> L.unpack (L.toLazyText builder) `shouldBe` desired+ where exts =+ glasgowExts +++ map EnableExtension [TemplateHaskell,DataKinds, MultiWayIf] parsePieces :: String -> [String] parsePieces str = map (intercalate "\n" . map mkNewlines) pieces
test/chris-done/expected/12.exp view
@@ -31,7 +31,9 @@ module Main (main, main2, main3, main4, main5) where module Main (main) where+> import Text.Hello module Main (main, main2, main3, main4, main5) where+> import Text.Hello
test/chris-done/expected/20.exp view
@@ -1,2 +1,3 @@ f = \ ~a -> undefined+ f = \ !a -> undefined
test/chris-done/tests/20.test view
@@ -1,2 +1,3 @@ f = \ ~a -> undefined+ f = \ !a -> undefined
test/fundamental/expected/12.exp view
@@ -31,7 +31,9 @@ module Main (main, main2, main3, main4, main5) where module Main (main) where+> import Text.Hello module Main (main, main2, main3, main4, main5) where+> import Text.Hello