1
1
mirror of https://github.com/github/semantic.git synced 2025-01-06 23:46:21 +03:00

Add a Semigroup instance over Source.

This commit is contained in:
Rob Rix 2016-09-18 09:54:07 +09:00
parent 38d6bbe644
commit d260ea19c9

View File

@ -100,6 +100,9 @@ sourceSpanToRange source SourceSpan{..} = Range start end
sumLengths = sum . fmap (\ Range{..} -> end - start)
instance Semigroup (Source a) where
Source a <> Source b = Source (a Vector.++ b)
instance Monoid (Source a) where
mempty = fromList []
mappend = (Source .) . (Vector.++) `on` getVector
mappend = (<>)