<div dir="ltr">Joachim Breitner wrote:<br><div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Am Samstag, den 13.09.2014, 00:01 -0400 schrieb David Feuer:<br>
> On Sep 12, 2014 2:35 PM, "Joachim Breitner" <<a href="mailto:mail@joachim-breitner.de">mail@joachim-breitner.de</a>><br>
> wrote:<br>
> > Interesting. I assumed that some wrap.unwrap=id law would hold, or<br>
> at<br>
> > least some moral approximation (e.g. disregarding bottoms in an<br>
> > acceptable manner). But if the wrappers have to do arbitrary stuff<br>
> that<br>
> > can arbitrarily interact with how the producer calls them, this<br>
> becomes<br>
> > a bit less appealing.<br>
><br>
> No, nothing pleasant like that, I'm afraid. isoSimple is like that of<br>
> course, but once it gets to foldl, the fusion rule is handing the<br>
> builder a wrap/unwrap pair that isn't even close to that.<br>
<br>
and parametricity doesn't help here? Note that due to the forall in the<br>
type of buildW, you can probably reason about what kind of values buildW<br>
can produce, as it can only use whatever the consumer handed to it.<br>
Maybe there is an invariant for that type, and the worker/wrapper pair<br>
is the identity for values that fulfill that invariant.<br></blockquote><div> </div><div>That seems reasonable, and I suspect without any proof that Takano Akio's wrapper for foldl and Dan Doel's wrapper for reverse probably satisfy it. Scans seem to be more of a challenge. It appears to me that Dan's scanl wrapper probably does *not* satisfy that requirement, and I don't know enough to have much chance of finding one that does.<br><br></div><div>David</div></div></div></div></div>