Remove Foldable from Traversable (was Haskell Foldable Wats)

Jeremy voldermort at hotmail.com
Thu Feb 25 11:12:33 UTC 2016


Index Int wrote
> 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.

The difference is that Functor over tuples has some debatable, although
arguably misleading uses, but Foldable has no sensible uses whatsoever.


Index Int wrote
> 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 Monad definition actually uses the Applicative instance. Traversable
makes no use of Foldable.



--
View this message in context: http://haskell.1045720.n5.nabble.com/Proposal-Add-conspicuously-missing-Functor-instances-for-tuples-tp5827530p5831016.html
Sent from the Haskell - Libraries mailing list archive at Nabble.com.


More information about the Libraries mailing list