mirror of
https://github.com/github/semantic.git
synced 2024-12-23 14:54:16 +03:00
Line’s Applicative instance preserves closedness.
This commit is contained in:
parent
186337fd4d
commit
572819b683
@ -50,7 +50,8 @@ coalesceLines line nextLine | isOpen line = [line `mappend` nextLine]
|
||||
|
||||
instance Applicative Line where
|
||||
pure = Line . pure
|
||||
a <*> b = Line (unLine a <*> unLine b)
|
||||
as <*> bs | isOpen as && isOpen bs = Line (unLine as <*> unLine bs)
|
||||
| otherwise = Closed (unLine as <*> unLine bs)
|
||||
|
||||
instance Monoid (Line a) where
|
||||
mempty = Line []
|
||||
|
Loading…
Reference in New Issue
Block a user