Functor, Applicative, Monad, Foldable, Traversable instances for (, , ) a b

Henning Thielemann lemming at
Thu Mar 30 21:18:10 UTC 2017

On Thu, 30 Mar 2017, Bryan Richter wrote:

> My intuition, based on observed usage in Haskell and elsewhere, is that
> tuples are used as anonymous product types. Thus, I am interested in
> the rationale for making them Functors because I feel it has denied me
> a common, valuable tool. I no longer feel that I should use pairs as
> product types. By making "(,) a" a Functor, it is no longer an anonymous
> product type —— it is an anonymous Reader. Are anonymous Readers
> really all that much more valuable than anonymous product types? I cannot
> conceive it. I must be missing something.

Pairs as functors are Writers. The function type got a Functor instance 
that corresponds to Readers. Functions as Readers (and Either as exception 
monad) must have happened in the GHC-6 version range and Pairs as Writers 
is quite recent and happened together with moving Monoid to Prelude 
(because Writers need Monoid for the left pair element).

I think the only reason is that some programmers got "laziness" wrong and 
try to use primitive types for everything instead of using (and importing) 
dedicated types.

More information about the Libraries mailing list