mirror of
https://github.com/github/semantic.git
synced 2024-12-11 08:45:48 +03:00
Test that Range <> is associative.
This commit is contained in:
parent
5cb387836d
commit
1968d3bc16
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user