strictness of interpreted haskell implementations

Are there well-known differences in the implementations of Haskell in ghci and hugs? I've got some moderately intricate code (simulations of pipelined processors) that behave differently - apparently because ghci Haskell is stricter than hugs Haskell, and I cannot find any obviously relevant claims about strictness in the documentation.

Geraint.Jones:
Are there well-known differences in the implementations of Haskell in ghci and hugs? I've got some moderately intricate code (simulations of pipelined processors) that behave differently - apparently because ghci Haskell is stricter than hugs Haskell, and I cannot find any obviously relevant claims about strictness in the documentation.
Hugs does no optimisations, while GHC does a truckload, including strictness analysis. Some of these optimisations prevent space leaks. You might want to also check with ghc -Onot , ghc -O2 (esp. if performance matters). -- Don

On Fri, 2008-04-25 at 09:08 -0700, Don Stewart wrote:
Geraint.Jones:
Are there well-known differences in the implementations of Haskell in ghci and hugs? I've got some moderately intricate code (simulations of pipelined processors) that behave differently - apparently because ghci Haskell is stricter than hugs Haskell, and I cannot find any obviously relevant claims about strictness in the documentation.
I think they should give the same answer. It sounds like a bug in one implementation or the other.
Hugs does no optimisations, while GHC does a truckload, including strictness analysis. Some of these optimisations prevent space leaks.
Though none should change the static semantics. Post the code. Even if you don't have time to track down the difference, someone might. Duncan

On Fri, Apr 25, 2008 at 9:17 PM, Duncan Coutts
On Fri, 2008-04-25 at 09:08 -0700, Don Stewart wrote:
Geraint.Jones:
Are there well-known differences in the implementations of Haskell in ghci and hugs? I've got some moderately intricate code (simulations of pipelined processors) that behave differently - apparently because ghci Haskell is stricter than hugs Haskell, and I cannot find any obviously relevant claims about strictness in the documentation.
I think they should give the same answer. It sounds like a bug in one implementation or the other.
I suspect this might be a library thing. If ghc and hugs uses different versions of the library and some function had its strictness property changed then that might account for the discrepancy.
Hugs does no optimisations, while GHC does a truckload, including strictness analysis. Some of these optimisations prevent space leaks.
Though none should change the static semantics.
That was my initial reaction as well, but then I recalled that some of ghc's optimizations actually changes the strictness behavior. The foldr/build transformation for instance can actually change the strictness of a function such that you can actually observe it. So we can't rule out that ghc is doing something it shouldn't be doing.
Post the code. Even if you don't have time to track down the difference, someone might.
Yep, without the code we're just fumbling in the dark. Cheers, Josef
participants (4)
-
Don Stewart
-
Duncan Coutts
-
Geraint Jones
-
Josef Svenningsson