Thanks for the clarification!
Ryan
On Wed, Mar 22, 2017 at 9:47 AM, Ryan Scott wrote:
> I believe what Sven was saying is not that the Foldable instance for
> tuples are given "special treatment" (which is arguably an orthogonal
> discussion), but rather that -XDeriveFoldable special-cases tupl
I believe what Sven was saying is not that the Foldable instance for tuples
are given "special treatment" (which is arguably an orthogonal discussion),
but rather that -XDeriveFoldable special-cases tuples, which is certainly
true.
As Edward noted, there is one possible justification for this beha
On Wed, Mar 22, 2017 at 4:12 AM, Sven Panne wrote:
> 2017-03-21 22:29 GMT+01:00 Edward Kmett :
>
>> [... 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. [...]
>>
>
2017-03-21 22:29 GMT+01:00 Edward Kmett :
> [... 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 wra
As I recall, Richard Eisenberg has been pushing, off and on, for us to get
a better vocabulary to specify "how" something is derived, via
DeriveAnyClass, generalized newtype deriving, DeriveFoldable, etc.
In general I think the current behavior is the least surprising as it
"walks all the a's it c
For `Traversable` one have to `traverse` over everything:
traverse @Foo = forall f. Applicative f => (a -> f b) -> Foo a -> f
(Foo b)
~= -> ((a,a), a) -> f ((b,b), b)
And thus the same behavior for `Foldable`.
You should define:
data Foo b a = Foo ((b,b), a) deriving Foldable
The point is that there are two reasonable ways to do it, and the
deriving mechanism, as a rule, does not make choices between
reasonable alternatives.
On Tue, Mar 21, 2017 at 5:05 PM, Jake McArthur wrote:
> I think it's a question of what one considers consistent. Is it more
> consistent to trea
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
I've opened Trac #13465 [*] for this. As I write there, I think the
right thing is to refuse to derive Foldable for a type whose Foldable
instance