From 3aa6dd1576a45085d39646148b5f4621e87af101 Mon Sep 17 00:00:00 2001 From: Orion Kindel Date: Wed, 20 Dec 2023 20:17:26 -0600 Subject: [PATCH] fix: functor --- src/Data.Range.purs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Data.Range.purs b/src/Data.Range.purs index a726f3c..3c02f65 100644 --- a/src/Data.Range.purs +++ b/src/Data.Range.purs @@ -15,6 +15,10 @@ data Bound a = BoundIncluding a | BoundExcluding a +instance Functor Bound where + map f (BoundIncluding a) = BoundIncluding $ f a + map f (BoundExcluding a) = BoundExcluding $ f a + derive instance Generic (Bound a) _ derive instance Ord a => Ord (Bound a) derive instance Eq a => Eq (Bound a) @@ -44,6 +48,11 @@ derive instance Eq a => Eq (Range a) instance Show a => Show (Range a) where show = genericShow +instance Functor Range where + map f (RangeAbove b) = RangeAbove $ map f b + map f (RangeBelow b) = RangeBelow $ map f b + map f (RangeBetween a b) = RangeBetween (map f a) (map f b) + instance Semigroup (Range a) where append (RangeAbove a) (RangeBelow b) = RangeBetween a b append (RangeBelow a) (RangeAbove b) = RangeBetween a b