[Haskell-cafe] Is Haskell a Good Choice for Web Applications?
ketil at malde.org
Thu May 7 03:30:04 EDT 2009
Anton van Straaten <anton at appsolutions.com> writes:
>> Exactly. I'm worried about, e.g. needing to use something as simple as
>> a stream of [...]
> Haskell lets you easily create "infinite" lists, which is a powerful
> and useful feature.
This has bit me on several occasions, and I think streaming over
an infinite list with too little strictness has been the cause of most
of my space "leaks". I've become pretty good at spotting this in
advance now, so I no longer need to whip out the profiling as often.
The archetypical case is parsing a large file into a non-strict data
structure. The data structure will then tend to hang onto the whole
input, instead of the result, which typically is much more compact.
Making the data structure strict solves the problem.
> It'd be a stretch to characterize this as "hard".
I guess it's hard in the sense that a) it's something different from
what you need to think about in other languages, and b) it's not
really an error, so you don't get as much help from the compiler or
> I don't see much connection between this and the space efficiency of
> long-running programs.
Except a long-running program could be doing something like
parsing a conceptually infinite input stream.
If I haven't seen further, it is by standing in the footprints of giants
More information about the Haskell-Cafe