| 1) In Figure 3 (Semantics of Case Expressions, Part 1) clause c reads:
|
| case v of { p | g1 -> e1 ; ...
| | gn -> en where { decls }
| _ -> e' }
|
| = case e' of
| { y -> -- (where y is a completely new variable)
| case v of {
| p -> let { decls } in
| if g1 then e1 ... else if gn then en else y
| _ -> y }}
|
| My question is this: doesn't this mean that e' all of a sudden
| becomes strict
In Haskell,
case e of { y->b }
is equivalent to
let y=e in b
That is, case is not strict unless the patterns
make it so. You may think it's curious but that's
the way it is. I don't have the report to hand
so I can't give you the page ref. I forget why
we defined this semantics using case rather than
let, which is admittedly odd. I think there was
a reason but I don't know what it is.
| 2) In the following clause (d) it is required that x1',...,xn' be
| completely new variables. Why? It seems to me that reusing
| x1,..,xn works just fine. Is there an alpha conversion requirement
| that I missed?
I bet it was just conservatism, but I'm not
certain.
Simon