Proposal: Add conspicuously missing Functor instances for tuples

Edward Kmett ekmett at gmail.com
Thu Feb 18 15:35:12 UTC 2016


I very much feel differently.

The Functor instance has been around for a decade and is actually fairly
heavily used.

It is necessary to support the Applicative for (,) e, which is the
anonymous writer monad, like (->) e is the anonymous reader monad, which
has also been around for over a decade.

Traversable's sequence gives you canonical distributive law for this
functor.

sequence :: (e, f a) -> f (e, a)

The (,) e functor is by far the most common choice of functor for things
like lenses to be instantiated with.

forall f. Functor f => (a -> f b) -> s -> f t

becomes (a -> (e, b)) -> s -> (e, t) giving you a secondary result when you
want it.

Saying that a bifunctor is Hask*Hask -> Hask doesn't quite work in haskell,
but we can say that it is a functor to a functor category: Hask -> [Hask,
Hask]. For (,) to be a bifunctor, (,) e should be a functor, or that notion
falls apart as (,) e isn't a functor in the functor category.

The list goes on.

-Edward

On Thu, Feb 18, 2016 at 10:11 AM, Kosyrev Serge <_deepfire at feelingofgreen.ru
> wrote:

> Andreas Abel <andreas.abel at ifi.lmu.de> writes:
> > +1.
> >
> > On 17.02.2016 12:15, Henning Thielemann wrote:
> >> I like consistency, too, and thus propose to remove all Functor,
> >> Foldable, Traversable, Applicative instances from all tuples.
>
> Is there really a convincing case for these instances -- at all?
>
> The confusion and the inevitable bug potential, that they create,
> seem to overwhelm any potential usefulness that comes to my imagination.
>
> But maybe someone feels differently?
>
> --
> с уважениeм / respectfully,
> Косырев Сергей
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20160218/03207b31/attachment.html>


More information about the Libraries mailing list