[Haskell-cafe] Function hanging in infinite input

martin martin.drautzburg at web.de
Sun Apr 26 18:22:06 UTC 2015

Am 04/26/2015 um 07:05 PM schrieb Jerzy Karczmarczuk:
> Martin reacts to my non-answer:

> 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.

Thanks a lot for taking the time to look into my code.

I had made a mistake when I stripped down my code. In tUntil the inequality is wrong. I updated the example and put it here:


The strange thing is: I can set an upper limit to "outer" and I get the result

	Temporal [(DPast,1),(T 3,3)]

When I push the upper limit to later times, the result doesn't change. This is as expected, because I am only taking
everything until (T 5). It looks like Haskell doesn't know that and believes that later recursions might contribute to
the result. But I don't see why. tUntil is basically an innocent takeWhile.

More information about the Haskell-Cafe mailing list