1
1
mirror of https://github.com/github/semantic.git synced 2024-11-25 02:58:36 +03:00

adjoinRows takes an AlignFunction.

This commit is contained in:
Rob Rix 2016-03-11 14:27:56 -05:00
parent 842af743e7
commit 48af1161e7

View File

@ -114,7 +114,7 @@ type Row a = Both (Line a)
type AlignFunction f = forall b list. (Align list, Applicative list) => f (list (Line b)) -> list (f (Line b)) type AlignFunction f = forall b list. (Align list, Applicative list) => f (list (Line b)) -> list (f (Line b))
-- | Merge open lines and prepend closed lines (as determined by a pair of functions) onto a list of rows. -- | Merge open lines and prepend closed lines (as determined by a pair of functions) onto a list of rows.
adjoinRows :: Applicative f => (f [Line a] -> [f (Line a)]) -> f (Line a) -> [f (Line a)] -> [f (Line a)] adjoinRows :: Applicative f => AlignFunction f -> f (Line a) -> [f (Line a)] -> [f (Line a)]
adjoinRows _ row [] = [ row ] adjoinRows _ row [] = [ row ]
adjoinRows align row (nextRow : rows) = align (coalesceLines <$> row <*> nextRow) ++ rows adjoinRows align row (nextRow : rows) = align (coalesceLines <$> row <*> nextRow) ++ rows