DeriveFoldable treatment of tuples is surprising
Twan van Laarhoven
twanvl at gmail.com
Wed Mar 22 13:54:05 UTC 2017
On 2017-03-21 21:34, David Feuer wrote:
> This seems much too weird:
>
> *> :set -XDeriveFoldable
> *> data Foo a = Foo ((a,a),a) deriving Foldable
> *> length ((1,1),1)
> 1
> *> length $ Foo ((1,1),1)
> 3
This is not unique to tuples, consider:
> :set -XDeriveFoldable
> data Foo a = Foo [[a]] deriving Foldable
> length [[1,2]]
1
> length $ Foo [[1,2]]
2
Twan
More information about the Glasgow-haskell-users
mailing list