Hi!
I ran into a piece of core today that I don't understand:
(let {
y_Xwv [Dmd=Just L] :: Int#
y_Xwv = -# (+# a_s2gvj 1) a_s2gvj } in
Data.Text.Builder.Buffer
@ s1_a2gph
ww6_s2gx7
ww7_s2gx8
ww8_s2gx9
(+# ww9_s2gxa y_Xwv)
(-# ww10_s2gxb y_Xwv))
I was reading the documentation for the different CoreSyn constructors here:
http://haskell.org/ghc/docs/latest/html/libraries/ghc-6.12.1/CoreSyn.html#t%3AExpr
In particular:
"Recursive and non recursive lets. Operationally this corresponds to
allocating a thunk for the things bound and then executing the
sub-expression."
Does the above code allocate anything on the heap? The Buffer
constructor is strict in all its fields. Why isn't this:
(case -# (+# a_s2gvj 1) a_s2gvj of y_Xwv {
__DEFAULT ->
Data.Text.Builder.Buffer
@ s1_a2gph
ww6_s2gx7
ww7_s2gx8
ww8_s2gx9
(+# ww9_s2gxa y_Xwv)
(-# ww10_s2gxb y_Xwv))
}
In addition, I'm not sure if the expression
-# (+# a_s2gvj 1) a_s2gvj
makes sense. Modulo overflow it seems to always evaluate to 1.
Cheers,
Johan
_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc