Can HLint help spot space leaks? (was: Re: [Haskell-cafe] Generating Haskell with associated types (and kind annotations))

Neil Mitchell ndmitchell at
Sat May 9 05:08:13 EDT 2009

Hi Jason,

> Hi Neil,
> A bit off-topic, but your post reminded me:  Does HLint currently help the
> user find space leaks?  For example, does it recommend strict folds instead
> of lazy folds?  I looked at the FAQ but this was not listed.  I don't really
> know how feasible this is.

It spots when you use replicateM or mapM, but don't use the result,
and should have actually used the _ versions.

It doesn't spot foldl s that should be foldl' s - in general you only
know that if you have the strictness information, which HLint doesn't.
You could add the rule foldl ==> foldl', but it's not in general
correct, so it won't be added to the default rule set.



More information about the Haskell-Cafe mailing list