... | ... | @@ -56,7 +56,7 @@ Informally the `-XStrict` language extension switches functions, data types, and |
|
|
|
|
|
which will strictly evaluate the RHS, and bind `p` and `q` to the components of the pair. But the pair itself is lazy (unless we also compile the Prelude with `-XStrict`; see "Modularity" below). So `p` and `q` may end up bound to `undefined`. See also "Recursive and polymorphic let bindings" below.
|
|
|
|
|
|
- **Case expressions.** The patterns of a case expression get an implicit bang, unless disabled with `~`. For eexample
|
|
|
- **Case expressions.** The patterns of a case expression get an implicit bang, unless disabled with `~`. For example
|
|
|
|
|
|
```wiki
|
|
|
case x of (a,b) -> rhs
|
... | ... | @@ -170,7 +170,7 @@ Continuing with this rule would mean that `-XStrict` would not allow recursive o |
|
|
- **(SPLIT)**. Replace any binding `p = e`, where `p` is not a variable, with `v = e; x1 = case v of p -> x1; ...; xn = case v of p -> xn`, where `v` is fresh and `x1`..`xn` are the bound variables of `p`. Again if `e` is a variable, you can optimised his by not introducing a fresh variable.
|
|
|
|
|
|
>
|
|
|
> The result will be a (possibly) recursive set of bindings, binding only simple variables on the LHS. (One could go one step further, as in the Hsakell Report and make the recursive bindings non-recursive using `fix`, but we do not do so in Core, and it only obfuscates matters, so we do not do so here.)
|
|
|
> The result will be a (possibly) recursive set of bindings, binding only simple variables on the LHS. (One could go one step further, as in the Haskell Report and make the recursive bindings non-recursive using `fix`, but we do not do so in Core, and it only obfuscates matters, so we do not do so here.)
|
|
|
|
|
|
|
|
|
Here are some examples of how this translation works. The first expression of each sequence is Haskell source; the subsequent ones are Core.
|
... | ... | |