Hi all,
I've seen it said in various places that for Core the semantics are basically:
- case = only place evaluation occurs
- let = only place heap allocation occurs / thunk creation / introduce laziness
However looking at Core this doesn't seem to hold. Core seems to have
the same semantics as Haskell, where you need to still look at
function application as potentially creating a thunk.
e.g In the paper 'A transformation-based optimiser for Haskell' the
above two rules for reading core are given, as is the example:
g :: (Double -> Double -> Double) -> Double -> Double -> Double
g f x y = f (sin x) y
becomes in Core:
let v = sin x
in f v y
so that the laziness is explicit. However in Core (as dumped through
'-ddump-simpl') g appears as:
f (GHC.Float.sin @ GHC.Types.Double GHC.Float.$fFloatingDouble x) y
I have found that if I dump STG though I seem to get the semantics
that people normally attribute to Core, so in STG, g appears as:
let {
e = \u srt:(0,*bitmap*) [] GHC.Float.sin GHC.Float.$fFloatingDouble x_svK;
} in f e y;
Can anyone confirm that in Core let bindings _aren't_ the only place
allocation occur (so read it like Haskell) but the 2 rules do hold for
STG? Or maybe I'm dumping core wrong...
Cheers,
David
_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc