
26 Apr
2015
26 Apr
'15
3:23 p.m.
Am 04/26/2015 um 08:38 PM schrieb Matthew Korson:
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
Mathew, you made my day! At least things work now as expected. But could you please elaborate on the difference between tAppend (Temporal as) (Temporal bs) = Temporal (as ++ bs) vs tAppend as bs = Temporal $ (toList as) ++ (toList bs) toList (Temporal xs) = xs Why is the first one more strict than the second?