1
1
mirror of https://github.com/github/semantic.git synced 2024-12-30 10:27:45 +03:00

🔥 bimap.

This commit is contained in:
Rob Rix 2015-12-10 10:10:06 -05:00 committed by joshvera
parent 84a817b6bf
commit 641ba9b7b7

View File

@ -83,12 +83,6 @@ instance Monoid Line where
mappend (Line xs) EmptyLine = Line xs mappend (Line xs) EmptyLine = Line xs
mappend (Line xs) (Line ys) = Line (xs <> ys) mappend (Line xs) (Line ys) = Line (xs <> ys)
bimap :: ([HTML] -> [HTML]) -> ([HTML] -> [HTML]) -> Row -> Row
bimap _ _ (Row EmptyLine EmptyLine) = mempty
bimap f g (Row (Line a) (Line b)) = Row (Line $ f a) (Line $ g b)
bimap _ g (Row EmptyLine (Line b)) = Row EmptyLine (Line $ g b)
bimap f _ (Row (Line a) EmptyLine) = Row (Line $ f a) EmptyLine
instance Monoid Row where instance Monoid Row where
mempty = Row EmptyLine EmptyLine mempty = Row EmptyLine EmptyLine
mappend (Row x1 y1) (Row x2 y2) = Row (x1 <> x2) (y1 <> y2) mappend (Row x1 y1) (Row x2 y2) = Row (x1 <> x2) (y1 <> y2)