Proposal: Add conspicuously missing Functor instances for tuples

Manuel Gómez targen at
Thu Feb 18 15:41:15 UTC 2016

On Thu, Feb 18, 2016 at 11:05 AM, Edward Kmett <ekmett at> wrote:
> 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.

FWIW, as anecdotes have been requested, I use all of these extensively
in production, especially that particular usage of sequence.

More information about the Libraries mailing list