
5 Jun
2012
5 Jun
'12
10:13 p.m.
On Tue, 5 Jun 2012, Andres Löh wrote:
Btw. the mapM memory leak can be easily and accidentally resurrected by writing
when_ b (mapM f xs)
with
f :: a -> m () when_ :: Bool -> m a -> m ()
I don't understand the whole mapM analogy (yet). I don't need when_ to get into trouble with using mapM.
If I write when b (mapM f xs) with f :: a -> m () when :: Bool -> m () -> m () then GHC will say something like: Cannot match [()] (result of 'mapM') with () (argument of 'when').