
1 Jul
2011
1 Jul
'11
4:40 a.m.
($!!) :: (NFData a) => (a -> b) ->a -> b f $!! x = x `deepseq` f x
Could be useful.
force :: (NFData a) => a -> a force x = x `deepseq` x
I'm not convinced this forces x at the point where you want it to. For instance, foldlw f a (x:xs) = foldlw f (force (f a x)) xs would not give you the foldl' you might be looking for - indeed it is identical to the space-leaking foldl, apart from the extra class constraint. Regards, Malcolm