Skip to content

Commit b54e375

Browse files
Complete PR adding Generic instance for Either (#61)
* Derive Generic instance for Either * Remove dependency on generics-rep Co-authored-by: Paul Young <[email protected]>
1 parent 9f6d491 commit b54e375

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/Data/Either.purs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import Data.Foldable (class Foldable)
1212
import Data.FoldableWithIndex (class FoldableWithIndex)
1313
import Data.Functor.Invariant (class Invariant, imapF)
1414
import Data.FunctorWithIndex (class FunctorWithIndex)
15+
import Data.Generic.Rep (class Generic)
1516
import Data.Maybe (Maybe(..), maybe, maybe')
1617
import Data.Ord (class Ord1)
1718
import Data.Traversable (class Traversable)
@@ -40,6 +41,8 @@ derive instance functorEither :: Functor (Either a)
4041
instance functorWithIndexEither :: FunctorWithIndex Unit (Either a) where
4142
mapWithIndex f = map $ f unit
4243

44+
derive instance genericEither :: Generic (Either a b) _
45+
4346
instance invariantEither :: Invariant (Either a) where
4447
imap = imapF
4548

0 commit comments

Comments
 (0)