1
1
mirror of https://github.com/github/semantic.git synced 2024-12-19 21:01:35 +03:00

simplify appending a row with two newlines

This commit is contained in:
joshvera 2015-12-09 17:40:41 -05:00
parent eecfd4ff6d
commit 40cc463a90

View File

@ -183,10 +183,7 @@ rowFromMaybeRows a b = Row (maybe EmptyLine (Line . (:[])) a) (maybe EmptyLine
adjoin2 :: [Row] -> Row -> [Row]
adjoin2 [] row = [row]
-- handle the case where we append a newline on both sides
adjoin2 rows (Row left@(Line (Text "" : _)) right@(Line (Text "" : _))) = Row left right : zipWith Row lefts rights
where
lefts = leftLines rows
rights = rightLines rows
adjoin2 rows (Row left@(Line (Text "" : _)) right@(Line (Text "" : _))) = Row left right : rows
adjoin2 rows (Row left@(Line (Text "" : _)) right) = Row left EmptyLine : zipWith Row lefts rights
where
lefts = leftLines rows