1
1
mirror of https://github.com/github/semantic.git synced 2024-12-01 09:15:01 +03:00

Promote through empty columns

This commit is contained in:
joshvera 2015-12-04 14:18:26 -05:00
parent c0c94a3be9
commit 438cb5f04c

View File

@ -74,7 +74,16 @@ rowFromMaybeRows a b = Row (Maybe.maybeToList a) (Maybe.maybeToList b)
adjoinRows :: [Row] -> [Row] -> [Row] adjoinRows :: [Row] -> [Row] -> [Row]
adjoinRows [] rows = rows adjoinRows [] rows = rows
adjoinRows rows [] = rows adjoinRows rows [] = rows
adjoinRows accum (row : rows) = init accum ++ [ last accum <> row ] ++ rows adjoinRows accum (row : rows) = reverse (adjoin2 (reverse accum) row) ++ rows
adjoin2 :: [Row] -> Row -> [Row]
adjoin2 [] row = [row]
adjoin2 (Row [] [] : init) row = adjoin2 init row
adjoin2 (Row [] rights : Row lefts rights' : init) (Row xs ys) =
Row [] (rights <> ys) : Row (lefts <> xs) rights' : init
adjoin2 (Row lefts [] : Row lefts' rights : init) (Row xs ys) =
Row (lefts <> xs) [] : Row lefts' (rights <> ys) : init
adjoin2 (last:init) row = (last <> row) : init
zipWithMaybe :: (Maybe a -> Maybe b -> c) -> [a] -> [b] -> [c] zipWithMaybe :: (Maybe a -> Maybe b -> c) -> [a] -> [b] -> [c]
zipWithMaybe f la lb = take len $ zipWith f la' lb' zipWithMaybe f la lb = take len $ zipWith f la' lb'