[Haskell-cafe] Function hanging in infinite input

Jerzy Karczmarczuk jerzy.karczmarczuk at unicaen.fr
Sun Apr 26 15:28:49 UTC 2015


Le 26/04/2015 15:20, martin a écrit :
> I was trying to implement >>= (tBind) on my "Temporal" data type and found that it hangs on an operation like
>
> 	takeInitialPart $ infiniteTemporal >>= (\x -> finiteTemporal)
>
> I am pretty sure the result is well defined and by no means infinite./*Also the code works on finite Temporals.*/
I am not sure about this...
I replaced  [5,10 ..] by [5,10 .. 100], so outer becomes

Temporal [(DPast,0),(T 5,5),(T 10,10),(T 15,15),(T 20,20),(T 25,25),(T 
30,30),(T 35,35),(T 40,40),(T 45,45),(T 50,50),(T 55,55),(T 60,60),(T 
65,65),(T 70,70),(T 75,75),(T 80,80),(T 85,85),(T 90,90),(T 95,95),(T 
100,100)]

and GHCi says:

*Main> ex10
*** Exception: Prelude.head: empty list

==

Jerzy Karczmarczuk

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20150426/9604f8b4/attachment.html>


More information about the Haskell-Cafe mailing list