Skip to content

Instantly share code, notes, and snippets.

@betaboon
Created January 10, 2019 18:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save betaboon/a88a14621bda6955b28f44f9fc9cc75c to your computer and use it in GitHub Desktop.
Save betaboon/a88a14621bda6955b28f44f9fc9cc75c to your computer and use it in GitHub Desktop.
diff --git a/Data/Ranged/RangedSet.hs b/Data/Ranged/RangedSet.hs
index eca86ef..915db37 100644
--- a/Data/Ranged/RangedSet.hs
+++ b/Data/Ranged/RangedSet.hs
@@ -72,8 +72,10 @@ infixl 5 -<=-, -<-, -?-
newtype DiscreteOrdered v => RSet v = RSet {rSetRanges :: [Range v]}
deriving (Eq, Show)
+instance DiscreteOrdered a => Semigroup (RSet a) where
+ (<>) = rSetUnion
+
instance DiscreteOrdered a => Monoid (RSet a) where
- mappend = rSetUnion
mempty = rSetEmpty
-- | Determine if the ranges in the list are both in order and non-overlapping.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment