[Haskell-cafe] Please help me spot where space leak occur.

Jason Dagit dagitj at gmail.com
Thu Jul 28 00:19:36 CEST 2011


On Fri, Jul 22, 2011 at 1:54 AM, Olexander Kozlov <ookozlov at gmail.com> wrote:
> Jason, thank you for your help. The hint for using -s option is very
> valuable.
> It is good to see people answering questions about Haskell here on
> haskell-cafe.

stackoverflow is another good place to ask.

> This is really matter. I hope I will be helpfull some day too :)
> As for the question I didn't mention in my psot that Fn can be of arbitrary
> size.

You could extend my solution pretty easily to work for arbitrary size.

> Now I have another question which I'm concerned with. I used foldl' (strict)
> in my implementation
> instead of just foldl (lazy). Does it mean that libraries are to be in two
> implementations one strict
> and another one lazy? Because there no way to affect strictness/lazyness of
> function without modifying
> its implementation. I' going to ask this question as a separate thread.

It doesn't come up that much.  It comes up here with your foldl, with
Chans, modifyIORef, modifySTRef, and a few things like that.  But most
of the time you want a lazy version until you spot a space leak.  Most
of the time the library creator notices and makes a strict version as
needed.  One of the nice things about Haskell is that you get a choice
between lazy and strict, and lazy by default is nice in many ways.
Space leaks like this are not usually show stoppers for experienced
Haskell folks.

Good luck!
Jason



More information about the Haskell-Cafe mailing list