[Haskell-cafe] ansi2html - one program, several issues
chaddai.fouche at gmail.com
Sat Jul 19 15:52:45 EDT 2008
2008/7/19 Krzysztof Skrzętnicki <gtener at gmail.com>:
> Hi all
> 1) Profiling shows that very simple functions are source of great memory and
> time consumption. However, if I turn them off and simply print their input
> arguments instead, the overall time and memory consumption doesn't change.
> But now another function is acting badly. My guess: somehow the cost of
> Parsec code is shifted into whatever function is using it's output. Let's
Are you using Parsec to parse the whole file ? Then your problem is
there : Parsec needs to read and process the whole file before it can
give us any output since it thinks it could have to give us an error
instead and it can't be sure of that before he has read the whole
In your case, your problem is such that you would prefer to treat the
file as a stream, isn't it ?
There are some parser library that can give output lazily (look at
polyparse flavour), another option would be to only use Parsec where
you need it and just read and print the ordinary text for example.
More information about the Haskell-Cafe