Proposal: Add the missing instances for Traversable (Either b) and Traversable ((,) b)
Edward Kmett
ekmett at gmail.com
Sat Jul 28 03:58:18 CEST 2012
Fair enough. I'll try to switch my development environment around to
something new enough that I can assemble a patch.
-Edward
On Fri, Jul 27, 2012 at 9:06 PM, Ross Paterson <ross at soi.city.ac.uk> wrote:
> On Sat, Jul 28, 2012 at 01:27:47AM +0100, Edward Kmett wrote:
> > The following instances are missing and have only one sensible
> > definition. I've been bitten by their lack repeatedly and there is
> > no place outside of base that they can live without needlessly being
> > orphaned.
> >
> > I would like to propose adding the following instances to Data.Foldable
> > and Data.Traversable.
> >
> > instance Foldable (Either e) where
> > foldMap f (Right m) = f m
> > foldMap _ (Left _) = mempty
> > instance Traversable (Either e) where
> > traverse _ (Left e) = pure (Left e)
> > traverse f (Right x) = Right <$> f x
> > instance Foldable ((,) e) where
> > foldMap f (_,x) = f x
> > instance Traversable ((,) e) where
> > traverse f (e,x) = (,) e <$> f x
> >
> > I had thought honestly thought we'd already added them long ago.
>
> You proposed them in January 2011 and everyone agreed (after changing the
> pair instance to the strict versions given here) but I don't think you
> sent a patch to Ian.
>
> http://thread.gmane.org/gmane.comp.lang.haskell.libraries/15196
>
> It's certainly overdue.
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20120727/5349fc38/attachment.htm>
More information about the Libraries
mailing list