This is part of what makes lazy State confusing. I haven't really messed with Writer too much. The extra laziness can be very bad for performance in some cases. Since the laws lead to a different performance intuition, any such variance should be documented in Haddock. Note also that fmap and second have *different* strictness for pairs, which seems very surprising as well.
On Feb 17, 2016 4:24 PM, "Edward Kmett" <ekmett@gmail.com> wrote:As a general rule we let the results of many operations be more defined than the laws require.Stream fusion runs into this exact same "issue".
This sort of thing is necessary to makes a lot of things like "lazy state" and "lazy writer" possible at all.-EdwardOn Wed, Feb 17, 2016 at 2:25 PM, David Feuer <david.feuer@gmail.com> wrote:I don't think we should fix this, because it would break code, but I do think we should document it.
Bifunctor law:
bimap id id = id
But actually,
bimap id id _|_ = (_|_, _|_)
_______________________________________________
Libraries mailing list
Libraries@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries