
Am 04/26/2015 um 05:28 PM schrieb Jerzy Karczmarczuk:
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
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