@@ -8,9 +8,11 @@ import Control.Extend (class Extend)
8
8
import Data.Bifoldable (class Bifoldable )
9
9
import Data.Bifunctor (class Bifunctor )
10
10
import Data.Bitraversable (class Bitraversable )
11
+ import Data.Eq (class Eq1 )
11
12
import Data.Foldable (class Foldable )
12
13
import Data.Functor.Invariant (class Invariant , imapF )
13
14
import Data.Monoid (mempty )
15
+ import Data.Ord (class Ord1 )
14
16
import Data.Traversable (class Traversable )
15
17
16
18
-- | The `Either` type is used to represent a choice between two types of value.
@@ -164,13 +166,17 @@ instance showEither :: (Show a, Show b) => Show (Either a b) where
164
166
-- | types the `Either` can contain.
165
167
derive instance eqEither :: (Eq a , Eq b ) => Eq (Either a b )
166
168
169
+ instance eq1Either :: Eq a => Eq1 (Either a ) where eq1 = eq
170
+
167
171
-- | The `Ord` instance allows `Either` values to be compared with
168
172
-- | `compare`, `>`, `>=`, `<` and `<=` whenever there is an `Ord` instance for
169
173
-- | both types the `Either` can contain.
170
174
-- |
171
175
-- | Any `Left` value is considered to be less than a `Right` value.
172
176
derive instance ordEither :: (Ord a , Ord b ) => Ord (Either a b )
173
177
178
+ instance ord1Either :: Ord a => Ord1 (Either a ) where compare1 = compare
179
+
174
180
instance boundedEither :: (Bounded a , Bounded b ) => Bounded (Either a b ) where
175
181
top = Right top
176
182
bottom = Left bottom
0 commit comments