mirror of
https://github.com/github/semantic.git
synced 2024-12-23 23:11:50 +03:00
Define adjoinLinesBy in terms of coalesceLinesBy.
This commit is contained in:
parent
3296d4ada1
commit
dfedd845b3
@ -40,8 +40,8 @@ coalesceLinesBy _ line nextLine = [line, nextLine]
|
||||
|
||||
-- | Merge open lines and prepend closed lines, pushing empty lines through open ones.
|
||||
adjoinLinesBy :: (a -> Bool) -> Line a -> [Line a] -> [Line a]
|
||||
adjoinLinesBy f line (next:rest) | isOpenLineBy f line = line <> next : rest
|
||||
adjoinLinesBy _ line lines = line : lines
|
||||
adjoinLinesBy f line (next:rest) = coalesceLinesBy f line next ++ rest
|
||||
adjoinLinesBy _ line [] = [ line ]
|
||||
|
||||
instance Applicative Line where
|
||||
pure = makeLine . (:[])
|
||||
|
Loading…
Reference in New Issue
Block a user