-XStrict: Why some binders are not made strict?

Ömer Sinan Ağacan omeragacan at gmail.com
Tue Dec 8 01:47:21 UTC 2015


> Aren't those already guaranteed to be strict because of pattern matching? Try
> it again with irrefutable patterns.

But pattern matching only forces the evaluation up to the pattern that is
matched. We need another pattern matching(or seq etc.) on x, y, xs and ys here.
If you look at the generated Core you'll see it more clearly I think(you'll see
that no pattern matching on x y xs and ys are done in Core).

2015-12-07 20:43 GMT-05:00 Brandon Allbery <allbery.b at gmail.com>:
> On Mon, Dec 7, 2015 at 8:40 PM, Ömer Sinan Ağacan <omeragacan at gmail.com>
> wrote:
>>
>> With -XStrict 'x', 'xs', 'y' and 'ys' don't become strict. I'm wondering
>> about
>> the motivation behind this, I found this interesting. I always thought
>> -XStrict
>> gives me this guarantee: If I'm using an already-defined variable(bound by
>> a
>> let or pattern matching) in an expression, I can be sure that the variable
>> won't be bottom in that expression, because it would be `seq`d before the
>> expression is evaluated.
>
>
> Aren't those already guaranteed to be strict because of pattern matching?
> Try it again with irrefutable patterns.
>
> --
> brandon s allbery kf8nh                               sine nomine associates
> allbery.b at gmail.com                                  ballbery at sinenomine.net
> unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net


More information about the ghc-devs mailing list