Remove Foldable from Traversable (was Haskell Foldable Wats)

Index Int vlad.z.4096 at gmail.com
Thu Feb 25 08:43:56 UTC 2016


This is getting ridiculous. The main problem with the `Foldable` instance
for tuples seems to be that it's asymmetric (takes only the second element
into account). Yet tuples are already asymmetric given their `Functor`
instance! No one seems to complain about that although for a beginner it's
a total WAT (judging from my own experience and people that I explained
Haskell to). Why does `succ <$> (1, 2)` evaluate to `(1, 3)` and not `(2,
3)`? Current definitions are entirely consistent, and consistency is the
most valuable property.

And given that `Traversable` gives a rise to a `Foldable` similarly to how
a `Monad` gives a rise to an `Applicative`, it is the same stupid mistake
not to reflect this relation in the type system.

The ship has sailed, but not when the `Foldable` instance defined. It has
sailed when the `Functor` instance was defined, everything else is a
follow-up. Just get over it already.

On Thu, Feb 25, 2016 at 11:28 AM, Jeremy <voldermort at hotmail.com> wrote:

> Several suggestions have been made in this thread. The one with the highest
> cost-to-benefit ratio would seem to be removing the Foldable constraint
> from
> Traversable, as it is simply not required by the Traversable definition.
> Lennart actually tried recompiling base with this "and it hardly needed any
> changes".
>
> I suggest that we consider this change first, as it brings the benefit of
> allowing Traversable types without having to define possibly nonsensical
> Foldable instances, and according to Lennart's experiment, has trivial
> impact.
>
> Lennart, what changes did you have to make? Anybody care to recompile their
> pet project with this change and see if there's any significant impact?
>
>
>
> --
> View this message in context:
> http://haskell.1045720.n5.nabble.com/Proposal-Add-conspicuously-missing-Functor-instances-for-tuples-tp5827530p5831008.html
> Sent from the Haskell - Libraries mailing list archive at Nabble.com.
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20160225/24883761/attachment-0001.html>


More information about the Libraries mailing list