<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>I think the "official" version could be implemented with a lazy
pattern match and it'd be the same as yours, no?<br>
<br>
Cheers,<br>
Vanessa<br>
</p>
<div class="moz-cite-prefix">On 12/11/18 12:55 AM, Isaac Elliott
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CADNFHyNd=S702NnRdZx_RruKcs_S8qWXgMJEK0SS-UfCbj-HSg@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div>I was reading this article <a
href="https://wiki.haskell.org/Correctness_of_short_cut_fusion"
moz-do-not-send="true">https://wiki.haskell.org/Correctness_of_short_cut_fusion</a>
on the Haskell wiki. It presents an example (2.1.2) where
destroy/unfoldr fusion behaves oddly. If I use a lazier
definition of unfoldr, then this problem goes away:</div>
<div><br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex">unfoldr :: (b ->
Maybe (a, b)) -> b -> [a]<br>
unfoldr f b =<br>
case f b of<br>
Nothing -> []<br>
Just z -> fst z : unfoldr f (snd z)</blockquote>
<div dir="ltr"><br>
</div>
<div>Does this mean unfoldr is 'too strict'? Or is there a
good reason for not writing it this way (performance,
perhaps?) </div>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
<a class="moz-txt-link-freetext" href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a>
Only members subscribed via the mailman list are allowed to post.</pre>
</blockquote>
</body>
</html>