diff --git a/src/Data/Range.hs b/src/Data/Range.hs index 607d5815a..e4f725b77 100644 --- a/src/Data/Range.hs +++ b/src/Data/Range.hs @@ -32,6 +32,13 @@ subtractRange range1 range2 = Range (start range1) (end range1 - rangeLength (Ra -- Instances +-- $setup +-- >>> import Test.QuickCheck +-- >>> instance Arbitrary Range where arbitrary = Range <$> arbitrary <*> arbitrary + +-- $ +-- Associativity: +-- prop> \ a b c -> a <> (b <> c) == (a <> b) <> (c :: Range) instance Semigroup Range where Range start1 end1 <> Range start2 end2 = Range (min start1 start2) (max end1 end2)