fix: functor

This commit is contained in:
orion 2023-12-20 20:17:26 -06:00
parent 2d4613590f
commit 3aa6dd1576
Signed by: orion
GPG Key ID: 6D4165AE4C928719

View File

@ -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