[Haskell-cafe] Function hanging in infinite input
Jerzy Karczmarczuk
jerzy.karczmarczuk at unicaen.fr
Sun Apr 26 17:05:01 UTC 2015
Martin reacts to my non-answer:
> Am 04/26/2015 um 05:28 PM schrieb Jerzy Karczmarczuk:
>
> ...
> and GHCi says:
>
> *Main> ex10
> *** Exception: Prelude.head: empty list
> This is because I have commented out two corner cases in tBind, to make sure it's not them. Remove the comments and
> it'll work
Martin I sent you a private follow-up. I repeat it here.
I uncommented those lines.
Your program goes until the end of the list, and returns the /*last*/
element (modified). The form
*tBind tpr f
...
(tTail tpr `tBind` f) *
loops until ...
Now, I know about laziness... It seems that it doesn't help. Most
probably your hd is simply empty, and the tail gets stuck in an idle loop.
Jerzy Karczmarczuk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20150426/1836109a/attachment.html>
More information about the Haskell-Cafe
mailing list