Well I've updated GHC yet again to solve the last problem, but it's
made things even worse, because GHC has now forgotten an instance
declaration which it remembered before.
Specifically file Interaction.hs contains the line:
instance Event IA where
(etc)
Interaction.hi contains the line:
To my
ghc-4.02 treats sum strangely.
In the below program, sum xs needs small, constant size stack,
sm xs needs stack proportional to length xs.
And sm is the implementation of sum shown in src/.../PrelList.lhs
I apply ghc -c -O.
[..]
Simon Peyton-Jones [EMAIL PROTECTED]
Using Haskell programs and libraries with different compilers and/or
interpreters (or even with different versions of the same system!) is
currently quite a frustrating experience. This is can be attributed to
the following problems:
* Different language versions (1.3, 1.4, 98, ...) exist.
It wasn't your main question, but I'd like to respond to one point that
you raised:
| (Works with ghc. Doesn't work with Hugs because of incompatible Random
| module (?).)
The Haskell 98 Random library changed quite significantly, and we didn't
get to do anything about it before the last
I tried to haskellize an algorithm which poorly fits into the
functional style: plasma fractal generation. It computes a rectangular
array in a funny order, using previously computed elements, and uses
random numbers all the time.
It works (I didn't check if the result is correct but it's not
foldl looks like this:
foldl k z [] = z
foldl k z (x:xs) = foldl k (z `k` x) xs
To work in constant space, foldl needs to evaluate its second argument
before the call, rather than building a thunk that is later forced
(which in turn builds stack). But in general, foldl is not strict in z.
To my
ghc-4.02 treats sum strangely.
In the below program, sum xs needs small, constant size stack,
sm xs needs stack proportional to length xs.
And sm is the implementation of sum shown in src/.../PrelList.lhs
I apply ghc -c -O.
[..]
Simon Peyton-Jones [EMAIL PROTECTED]
ghc-4.02 treats sum strangely.
In the below program, sum xs needs small, constant size stack,
sm xs needs stack proportional to length xs.
And sm is the implementation of sum shown in src/.../PrelList.lhs
I apply ghc -c -O.
What keys are needed to code sum like it is in this