1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 14:21:31 +03:00

🔥 the Coalescent instance over Both (Line a).

This commit is contained in:
Rob Rix 2016-04-14 21:23:21 -04:00
parent a93a99caa2
commit ee91e6daef

View File

@ -2,9 +2,7 @@
module Line where
import Control.Applicative
import Data.Align
import Data.Coalescent
import Data.Functor.Both
-- | A line of items or an empty line.
data Line a = Line [a] | Closed [a]
@ -55,6 +53,3 @@ instance Monoid (Line a) where
instance Coalescent (Line a) where
coalesce a b | isOpen a = pure (a `mappend` b)
| otherwise = pure a <|> pure b
instance Coalescent (Both (Line a)) where
coalesce as bs = tsequenceL (pure (Line [])) (coalesce <$> as <*> bs)