DeriveFoldable treatment of tuples is surprising
ollie at ocharles.org.uk
Wed Mar 22 09:38:58 UTC 2017
> there is a fair bit of user code for things like vector types that do
newtype V3 a = V3 (a,a,a,a)
^ 1 2 3 4(!?)
Oh boy, I sure hope not ;)
On Wed, Mar 22, 2017 at 8:14 AM Sven Panne <svenpanne at gmail.com> wrote:
> 2017-03-21 22:29 GMT+01:00 Edward Kmett <ekmett at gmail.com>:
> [... In general I think the current behavior is the least surprising as it
> "walks all the a's it can" and is the only definition compatible with
> further extension with Traversable. [...]
> OTOH, the current behavior contradicts my intuition that wrapping a type
> into data/newtype plus using the deriving machinery is basically a no-op
> (modulo bottoms etc.). When I e.g. wrap a type t, I would be very surprised
> if the Eq/Ord instances of the wrapped type would behave differently than
> the one on t. I know that this is very handwavy argument, but I think the
> current behavior is *very* surprising.
> Somehow the current behavior seems to be incompatible with the FTP, where
> pairs are given a special treatment (if that't the right/intuitive choice
> is a completely different topic, though).
> Given the fact that "deriving Foldable" is quite old and therefore hard to
> change, I would at least suggest a big, fat warning in the documentation,
> including various examples where intuition and implementation do not
> necessarily meet.
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Glasgow-haskell-users