mirror of
https://github.com/github/semantic.git
synced 2025-01-02 20:41:38 +03:00
Use Line, not makeLine.
This commit is contained in:
parent
4d25c23618
commit
d18e044d5c
@ -14,7 +14,7 @@ makeLine = Line
|
||||
-- | line.
|
||||
wrapLineContents :: ([a] -> b) -> Line a -> Line b
|
||||
wrapLineContents _ (Line []) = mempty
|
||||
wrapLineContents transform line = makeLine [ transform (unLine line) ]
|
||||
wrapLineContents transform line = Line [ transform (unLine line) ]
|
||||
|
||||
-- | Return the first item in the Foldable, or Nothing if it's empty.
|
||||
maybeFirst :: Foldable f => f a -> Maybe a
|
||||
@ -36,8 +36,8 @@ adjoinLinesBy f line (next:rest) = coalesceLinesBy f line next ++ rest
|
||||
adjoinLinesBy _ line [] = [ line ]
|
||||
|
||||
instance Applicative Line where
|
||||
pure = makeLine . pure
|
||||
a <*> b = makeLine $ unLine a <*> unLine b
|
||||
pure = Line . pure
|
||||
a <*> b = Line $ unLine a <*> unLine b
|
||||
|
||||
instance Monoid (Line a) where
|
||||
mempty = Line []
|
||||
|
@ -29,7 +29,7 @@ instance Arbitrary a => Arbitrary (Both a) where
|
||||
arbitrary = pure (curry Both) <*> arbitrary <*> arbitrary
|
||||
|
||||
instance Arbitrary a => Arbitrary (Line a) where
|
||||
arbitrary = makeLine <$> arbitrary
|
||||
arbitrary = Line <$> arbitrary
|
||||
|
||||
instance Arbitrary a => Arbitrary (Patch a) where
|
||||
arbitrary = oneof [
|
||||
@ -83,10 +83,10 @@ spec = parallel $ do
|
||||
|
||||
it "aligns closed lines" $
|
||||
foldr (adjoinRowsBy (pure (/= '\n'))) [] (Prelude.zipWith (both) (pure <$> "[ bar ]\nquux") (pure <$> "[\nbar\n]\nquux")) `shouldBe`
|
||||
[ both (makeLine "[ bar ]\n") (makeLine "[\n")
|
||||
, both mempty (makeLine "bar\n")
|
||||
, both mempty (makeLine "]\n")
|
||||
, both (makeLine "quux") (makeLine "quux")
|
||||
[ both (Line "[ bar ]\n") (Line "[\n")
|
||||
, both mempty (Line "bar\n")
|
||||
, both mempty (Line "]\n")
|
||||
, both (Line "quux") (Line "quux")
|
||||
]
|
||||
|
||||
describe "splitAbstractedTerm" $ do
|
||||
|
Loading…
Reference in New Issue
Block a user