mukesh tiwari <mukeshtiwari.iiitm@gmail.com> writes:I assumed that just means using plain Strings for that job will take
> It's already mentioned there "A String is represented as a list of
> Char values; each element of a list is allocated individually, and has
> some book-keeping overhead. These factors affect the memory
> consumption and performance of a program that must read or write text
> or binary data. On simple benchmarks like this, even programs written
> in interpreted languages such as Python can outperform Haskell code
> that uses String by an order of magnitude".
more time.
I get the same result, the stack overflow. Though I don't have wait as
> import qualified Data.ByteString.Lazy.Char8 as BS
> import Data.Maybe ( fromJust )
>
> readI :: BS.ByteString -> Integer
> readI = fst . fromJust . BS.readInteger
>
> main = BS.interact sumFile where
> sumFile = BS.pack . show . sum . map readI . BS.words
long for it to break.
I think that there is something about the summation that makes it
impossible for the compiler to do it's magic and optimize the thing to
something less stack overflowing. I just don't understand what that is.
--
Axel Wegen
_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners