You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My personal intuition suggests that most instances should be "strict in the leaves, lazy in the spine" like the [] instance. However, most of them seem to be lazy all over the place.
NB: Data.Sequence.Seq actually needs its unzip to be lazy in the leaves in order to be lazy in the spine. If it tried to be strict in the leaves but lazy in the spine, it would end up being strict in part of the spine, which would break the abstraction barrier. sigh.
Thinking about this a bit more, I wonder if it would actually make sense to offer several more unzipping methods, to get precisely the behavior you want.
Strict in the leaf-pair separation; strict in the spine.
Strict in the leaf-pair separation; lazy in the spine if possible.
Lazy in the leaf-pair separation; strict in the spine.
Lazy in the leaf-pair separation; lazy in the spine if possible.
I would expect all of them to be head-strict (unzip _|_ = _|_), though that might be a tad confusing for a functor like Identity.
We can offer sensible defaults of all of these except (as far as I can tell) lazy-spine/strict-separation for Traversable types. I think that one type probably just requires too much human judgement to say what it means.
Activity
treeowl commentedon Aug 22, 2021
Thinking about this a bit more, I wonder if it would actually make sense to offer several more unzipping methods, to get precisely the behavior you want.
I would expect all of them to be head-strict (
unzip _|_ = _|_), though that might be a tad confusing for a functor likeIdentity.We can offer sensible defaults of all of these except (as far as I can tell) lazy-spine/strict-separation for
Traversabletypes. I think that one type probably just requires too much human judgement to say what it means.