1
1
mirror of https://github.com/github/semantic.git synced 2024-12-23 23:11:50 +03:00

Compute openLineBy across Both sides.

This commit is contained in:
Rob Rix 2016-02-29 01:25:50 -05:00
parent 6170622468
commit 7f73085dd5

View File

@ -21,7 +21,7 @@ wrapRowContents transformLeft transformRight (Row left right) = Row (wrapLineCon
adjoinRowsBy :: MaybeOpen a -> MaybeOpen a -> [Row a] -> Row a -> [Row a] adjoinRowsBy :: MaybeOpen a -> MaybeOpen a -> [Row a] -> Row a -> [Row a]
adjoinRowsBy _ _ [] row = [row] adjoinRowsBy _ _ [] row = [row]
adjoinRowsBy f g rows (Row left' right') | Just _ <- openLineBy f $ unLeft <$> rows, Just _ <- openLineBy g $ unRight <$> rows = uncurry (zipWith Row) . runBoth $ both <*> Both (left', right') adjoinRowsBy f g rows (Row left' right') | Both (Just _, Just _) <- openLineBy <$> Both (f, g) <*> Both (unzip $ runBoth . unRow <$> rows) = uncurry (zipWith Row) . runBoth $ both <*> Both (left', right')
where both = adjoinLinesBy <$> Both (f, g) <*> Both (unzip $ runBoth . unRow <$> rows) where both = adjoinLinesBy <$> Both (f, g) <*> Both (unzip $ runBoth . unRow <$> rows)
adjoinRowsBy f _ rows (Row left' right') | Just _ <- openLineBy f $ unLeft <$> rows = case right' of adjoinRowsBy f _ rows (Row left' right') | Just _ <- openLineBy f $ unLeft <$> rows = case right' of