Could somebody help me understand why Case binds its scrutinee in
CoreSyn?

Unless I'm misreading it (quite possible), the "case" expression does
not bind a variable for its scrutinee in System FC1: the contexts in
which the branches get checked seem to have new expresion variables only
for the fields of the relevant DataCon, but there isn't one for the
scrutinee itself.

My first guess at the motivation for this was that it was to help
desugar patterns like:

   (case escrut of
     | x@(Foo a b) -> ebranch1
     ...
   ) :: t

into (Case escrut x t [ebranch1 ...]).

On the other hand, CoreSyn's case can't do nested patterns directly, so
you might as well consider the "x@(Foo a b)" to be nested and require

   let x = escrut
     in case x of
       Foo a b -> ebranch1

right?  So I'm wondering if there's something I'm not noticing that can
be done with the Case-binder but not without it.

  - a


_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to