[Haskell-beginners] do not understand Semantics of Case Expressions
in report
Michael Mekhanoshin
mmexanosh at gmail.com
Mon Oct 20 14:17:56 EDT 2008
at http://www.haskell.org/onlinereport/exps.html
on figure Figure 4 (Semantics of Case Expressions, Part 2)
one can see:
(m) case v of { K { f1 = p1 , f2 = p2 , ... } -> e ; _ -
> e' }
= case e' of {
y ->
case v of {
K { f1 = p1 } ->
case v of { K { f2 = p2 , ... } -> e ; _ ->
y };
_ -> y }}
where f1, f2, ... are fields of constructor K; y is a new variable
(In Figures 3.1--3.2: e, e' and ei are expressions; g and gi are
boolean-valued expressions; p and pi are patterns; v, x, and xi are
variables; K and K' are algebraic datatype (data) constructors
(including tuple constructors); and N is a newtype constructor.)
I'm totally confused with this identity. Especialy with " = case e'".
Can anyone explain a little what does this rule stand, please?
It is better to see some example.
Respect,
Michael
More information about the Beginners
mailing list