The problem is that tAppend is too strict; it evaluates both its arguments before producing anything. This is because you are pattern matching on those arguments. You could use lazy patterns or make Temporal a newtype to avoid that. Or you could rewrite to something like

    tAppend as bs = Temporal $ toList as ++ toList bs


On Sun, Apr 26, 2015 at 11:22 AM, martin <martin.drautzburg@web.de> wrote:
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:

https://www.dropbox.com/s/836hykwhhsb0n55/Function_hanging_in_infinite_input.hs?dl=0

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.

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe



--
Matthew Korson
mjkorson@gmail.com