From 1c4f51d85e470cec31f12e4173c9985de3c554e3 Mon Sep 17 00:00:00 2001 From: Jaro Date: Fri, 7 Apr 2023 07:32:19 +0200 Subject: [PATCH] Fix style: white space in lambdas. --- .../ParagraphLayout/Internal/ParagraphLine.hs | 2 +- .../Text/ParagraphLayout/Internal/Plain.hs | 4 +-- .../ParagraphLayout/Internal/TextContainer.hs | 2 +- .../ParagraphLayout/Internal/BreakSpec.hs | 4 +-- .../Internal/LinePaginationSpec.hs | 28 +++++++++---------- .../ParagraphLayout/Internal/ZipperSpec.hs | 4 +-- test/Data/Text/ParagraphLayoutSpec.hs | 12 ++++---- 7 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/Data/Text/ParagraphLayout/Internal/ParagraphLine.hs b/src/Data/Text/ParagraphLayout/Internal/ParagraphLine.hs index 69806cf..0238a0a 100644 --- a/src/Data/Text/ParagraphLayout/Internal/ParagraphLine.hs +++ b/src/Data/Text/ParagraphLayout/Internal/ParagraphLine.hs @@ -17,7 +17,7 @@ instance Line ParagraphLine where -- | Split the given `ParagraphLayout` into individual lines. cutLines :: ParagraphLayout -> [ParagraphLine] -cutLines pl = map (\y -> cutLine y pl) (lineOrigins pl) +cutLines pl = map (\ y -> cutLine y pl) (lineOrigins pl) -- | Reduce the given `ParagraphLayout` to fragments with the given `y_origin`. -- diff --git a/src/Data/Text/ParagraphLayout/Internal/Plain.hs b/src/Data/Text/ParagraphLayout/Internal/Plain.hs index 9b4a3e9..0921141 100644 --- a/src/Data/Text/ParagraphLayout/Internal/Plain.hs +++ b/src/Data/Text/ParagraphLayout/Internal/Plain.hs @@ -125,7 +125,7 @@ positionLineH originY pfs = (nextY, frags) -- This can happen when line breaking produces a line that contains -- only spaces. nextY = if null rects then originY else maximum $ map y_min rects - rects = map (\(WithSpan _ r) -> fragmentRect r) frags + rects = map (\ (WithSpan _ r) -> fragmentRect r) frags frags = snd $ mapAccumL (positionFragmentH originY) originX pfs originX = paragraphOriginX @@ -242,7 +242,7 @@ layoutRunsH runs = map layoutRunH runs -- | Sum of all advances within the given fragments. totalAdvances :: [WithSpan PF.ProtoFragment] -> Int32 -totalAdvances pfs = sum $ map (\(WithSpan _ pf) -> PF.advance pf) pfs +totalAdvances pfs = sum $ map (\ (WithSpan _ pf) -> PF.advance pf) pfs -- | Calculate layout for the given horizontal run and attach extra information. layoutRunH :: WithSpan Run -> WithSpan PF.ProtoFragment diff --git a/src/Data/Text/ParagraphLayout/Internal/TextContainer.hs b/src/Data/Text/ParagraphLayout/Internal/TextContainer.hs index 8cbb813..99b7f9d 100644 --- a/src/Data/Text/ParagraphLayout/Internal/TextContainer.hs +++ b/src/Data/Text/ParagraphLayout/Internal/TextContainer.hs @@ -77,7 +77,7 @@ splitTextsBy' breakFunc closed (tc : tcs) = fullSplits = map mergeWithRest tcSplits mergeWithRest (x1, x2) = (reverse $ collapse $ x1 :| tcs, collapse $ x2 :| closed) - tcSplits = map (\i -> splitTextAt8 i tc) tcBreakOffsets + tcSplits = map (\ i -> splitTextAt8 i tc) tcBreakOffsets tcBreakOffsets = breakFunc tc -- | Turn pairs of normal lists into pairs of `NonEmpty` lists, diff --git a/test/Data/Text/ParagraphLayout/Internal/BreakSpec.hs b/test/Data/Text/ParagraphLayout/Internal/BreakSpec.hs index f8e9395..49fe79a 100644 --- a/test/Data/Text/ParagraphLayout/Internal/BreakSpec.hs +++ b/test/Data/Text/ParagraphLayout/Internal/BreakSpec.hs @@ -124,11 +124,11 @@ spec = do , "zxx-any-invalid-suffix@lb=loose" ] - expectedStrictLocales `forM_` \l -> + expectedStrictLocales `forM_` \ l -> it ("uses strict line breaks for " ++ l ++ " locale") $ b l jaText `shouldBe` jaBreaksStrict - expectedLooseLocales `forM_` \l -> + expectedLooseLocales `forM_` \ l -> it ("uses loose line breaks for " ++ l ++ " locale") $ b l jaText `shouldBe` jaBreaksLoose diff --git a/test/Data/Text/ParagraphLayout/Internal/LinePaginationSpec.hs b/test/Data/Text/ParagraphLayout/Internal/LinePaginationSpec.hs index a07a209..fc4ae26 100644 --- a/test/Data/Text/ParagraphLayout/Internal/LinePaginationSpec.hs +++ b/test/Data/Text/ParagraphLayout/Internal/LinePaginationSpec.hs @@ -24,7 +24,7 @@ spec = do let ls = emptyLines let page = bestSplit 1 1 - ([-30, -5, 0, 5, 30, 90, 100, 110] :: [Int32]) `forM_` \h -> + ([-30, -5, 0, 5, 30, 90, 100, 110] :: [Int32]) `forM_` \ h -> it ("maxHeight = " ++ show h ++ " returns empty lists") $ page h ls `shouldBe` ([], []) @@ -33,17 +33,17 @@ spec = do let ls = tenLines let page = bestSplit 1 1 - ([-30, -5, 0, 5] :: [Int32]) `forM_` \h -> + ([-30, -5, 0, 5] :: [Int32]) `forM_` \ h -> it ("maxHeight = " ++ show h ++ " puts all in second list") $ page h ls `shouldBe` ([], [10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) - ([30, 35] :: [Int32]) `forM_` \h -> + ([30, 35] :: [Int32]) `forM_` \ h -> it ("maxHeight = " ++ show h ++ " puts 3 in first list") $ page h ls `shouldBe` ([10, 10, 10], [10, 10, 10, 10, 10, 10, 10]) - ([100, 110] :: [Int32]) `forM_` \h -> + ([100, 110] :: [Int32]) `forM_` \ h -> it ("maxHeight = " ++ show h ++ " puts all in first list") $ page h ls `shouldBe` ([10, 10, 10, 10, 10, 10, 10, 10, 10, 10], []) @@ -59,27 +59,27 @@ spec = do -- - 6 + 4 -- - 10 + 0 - ([0, 10, 15, 25] :: [Int32]) `forM_` \h -> + ([0, 10, 15, 25] :: [Int32]) `forM_` \ h -> it ("maxHeight = " ++ show h ++ " ensures 3 orphans") $ page h ls `shouldBe` ([], [10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) - ([30, 35] :: [Int32]) `forM_` \h -> + ([30, 35] :: [Int32]) `forM_` \ h -> it ("maxHeight = " ++ show h ++ " puts 3 in first list") $ page h ls `shouldBe` ([10, 10, 10], [10, 10, 10, 10, 10, 10, 10]) - ([40, 45] :: [Int32]) `forM_` \h -> + ([40, 45] :: [Int32]) `forM_` \ h -> it ("maxHeight = " ++ show h ++ " puts 4 in first list") $ page h ls `shouldBe` ([10, 10, 10, 10], [10, 10, 10, 10, 10, 10]) - ([60, 75, 90] :: [Int32]) `forM_` \h -> + ([60, 75, 90] :: [Int32]) `forM_` \ h -> it ("maxHeight = " ++ show h ++ " ensures 4 widows") $ page h ls `shouldBe` ([10, 10, 10, 10, 10, 10], [10, 10, 10, 10]) - ([100, 110] :: [Int32]) `forM_` \h -> + ([100, 110] :: [Int32]) `forM_` \ h -> it ("maxHeight = " ++ show h ++ " puts all in first list") $ page h ls `shouldBe` ([10, 10, 10, 10, 10, 10, 10, 10, 10, 10], []) @@ -92,17 +92,17 @@ spec = do -- - 6 + 4 -- - 10 + 0 - ([0, 10, 15, 35, 50, 55] :: [Int32]) `forM_` \h -> + ([0, 10, 15, 35, 50, 55] :: [Int32]) `forM_` \ h -> it ("maxHeight = " ++ show h ++ " ensures 6 orphans") $ page h ls `shouldBe` ([], [10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) - ([60, 65, 85, 95] :: [Int32]) `forM_` \h -> + ([60, 65, 85, 95] :: [Int32]) `forM_` \ h -> it ("maxHeight = " ++ show h ++ " puts 6 in first list") $ page h ls `shouldBe` ([10, 10, 10, 10, 10, 10], [10, 10, 10, 10]) - ([100, 110] :: [Int32]) `forM_` \h -> + ([100, 110] :: [Int32]) `forM_` \ h -> it ("maxHeight = " ++ show h ++ " puts all in first list") $ page h ls `shouldBe` ([10, 10, 10, 10, 10, 10, 10, 10, 10, 10], []) @@ -114,12 +114,12 @@ spec = do -- - 0 + 10 -- - 10 + 0 - ([0, 10, 60, 65, 85, 95] :: [Int32]) `forM_` \h -> + ([0, 10, 60, 65, 85, 95] :: [Int32]) `forM_` \ h -> it ("maxHeight = " ++ show h ++ " puts all in second list") $ page h ls `shouldBe` ([], [10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) - ([100, 110] :: [Int32]) `forM_` \h -> + ([100, 110] :: [Int32]) `forM_` \ h -> it ("maxHeight = " ++ show h ++ " puts all in first list") $ page h ls `shouldBe` ([10, 10, 10, 10, 10, 10, 10, 10, 10, 10], []) diff --git a/test/Data/Text/ParagraphLayout/Internal/ZipperSpec.hs b/test/Data/Text/ParagraphLayout/Internal/ZipperSpec.hs index 692e0e6..ec22c39 100644 --- a/test/Data/Text/ParagraphLayout/Internal/ZipperSpec.hs +++ b/test/Data/Text/ParagraphLayout/Internal/ZipperSpec.hs @@ -89,7 +89,7 @@ spec = do it "recombines into original text" $ do Zipper.recombine z `shouldBe` sampleText - midPositions `forM_` \n -> + midPositions `forM_` \ n -> describe ("split at " ++ (show n)) $ do let z = Zipper.splitAt n sampleText it "is not at start" $ do @@ -103,7 +103,7 @@ spec = do it "recombines into original text" $ do Zipper.recombine z `shouldBe` sampleText - preMidPositions `forM_` \n -> + preMidPositions `forM_` \ n -> describe ("split at " ++ (show n) ++ " and step") $ do let z = Zipper.step $ Zipper.splitAt n sampleText it "is not at start" $ do diff --git a/test/Data/Text/ParagraphLayoutSpec.hs b/test/Data/Text/ParagraphLayoutSpec.hs index 7d723df..1a5bfc2 100644 --- a/test/Data/Text/ParagraphLayoutSpec.hs +++ b/test/Data/Text/ParagraphLayoutSpec.hs @@ -156,8 +156,8 @@ instance ShouldBeGolden ParagraphLayout where shouldBeGolden output_ name = Golden { output = output_ , encodePretty = show - , writeToFile = \path -> writeFile path . prettyShow - , readFromFile = \path -> readFile path >>= return . read + , writeToFile = \ path -> writeFile path . prettyShow + , readFromFile = \ path -> readFile path >>= return . read , goldenFile = ".golden" name "golden" , actualFile = Just (".golden" name "actual") , failFirstTime = True @@ -167,8 +167,8 @@ instance ShouldBeGolden Pages where shouldBeGolden output_ name = Golden { output = output_ , encodePretty = show . getPages - , writeToFile = \path -> writeFile path . prettyShow - , readFromFile = \path -> readFile path >>= return . Pages . read + , writeToFile = \ path -> writeFile path . prettyShow + , readFromFile = \ path -> readFile path >>= return . Pages . read , goldenFile = ".golden" name "golden" , actualFile = Just (".golden" name "actual") , failFirstTime = True @@ -178,8 +178,8 @@ instance ShouldBeGolden ShapedRuns where shouldBeGolden output_ name = Golden { output = output_ , encodePretty = show . getShapedRuns - , writeToFile = \path -> writeFile path . prettyShow - , readFromFile = \path -> readFile path >>= return . ShapedRuns . read + , writeToFile = \ path -> writeFile path . prettyShow + , readFromFile = \ path -> readFile path >>= return . ShapedRuns . read , goldenFile = ".golden" "shapedRuns" name "golden" , actualFile = Just (".golden" "shapedRuns" name "actual") , failFirstTime = True -- 2.30.2