<div dir="ltr">I think you put your finger on the problem here. That `evalP` is a placeholder to get transformed away later. I thought that my `NOINLINE` annotation would prevent GHC from noticing that `evalP` evaluates to bottom. I'll do a better job.<br><br>Thank you!<br><br>-- Conal<br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 11, 2016 at 4:06 PM, Ömer Sinan Ağacan <span dir="ltr"><<a href="mailto:omeragacan@gmail.com" target="_blank">omeragacan@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Empty case expressions like `case evalP @ (Pair Int) ds of wild { }` are only<br>
valid if the scrutinee is bottom, see CoreLint.hs for how exprIsBottom is used<br>
and CoreUtils.hs for how it's defined. So it seems like the simplifier somehow<br>
figured that `evalP @ (Pair Int) ds` is bottom, and generated an empty case.<br>
<br>
Is the linter complaining about this case expression? (you can try it using<br>
CoreLint.lintExpr)<br>
<div><div class="h5"><br>
2016-03-11 16:49 GMT-05:00 Conal Elliott <<a href="mailto:conal@conal.net">conal@conal.net</a>>:<br>
><br>
> I'm working on a GHC plugin, mainly in the form of a "builtin" rewrite rule,<br>
> and I'm seeing a strange disappearance of a case alternative. With<br>
> -ddump-rule-rewrites, I can see before & after the disappearance: Here's one<br>
> rule firing with the alternative present:<br>
><br>
>     Rule fired<br>
>         Rule: reify<br>
>         Before: reifyP<br>
>                   TyArg Pair Int -> Int<br>
>                   ValArg \ (ds :: Pair Int) -><br>
>                            case ds of _ { :# a b -> $fNumInt_$c+ a b }<br>
>         After:  lamP<br>
>                   @ (Pair Int)<br>
>                   @ Int<br>
>                   "ds"#<br>
>                   (\ (ds :: EP (Pair Int)) -><br>
>                      reifyP<br>
>                        @ Int<br>
>                        (case evalP @ (Pair Int) ds of _ { :# a b -><br>
> $fNumInt_$c+ a b }))<br>
>         Cont:   StrictArg toE<br>
>                 Stop[BoringCtxt] E Prim (Pair Int -> Int)<br>
><br>
> The next thing I see is the rule firing again on the residual reifyP<br>
> application, but with the case alternative gone:<br>
><br>
>     Rule fired<br>
>         Rule: reify<br>
>         Before: reifyP<br>
>                   TyArg Int ValArg case evalP @ (Pair Int) ds of wild { }<br>
>         After:  ...<br>
><br>
> Any ideas what's causing the disappearance?<br>
><br>
> Thanks.  - Conal<br>
><br>
><br>
</div></div>> _______________________________________________<br>
> ghc-devs mailing list<br>
> <a href="mailto:ghc-devs@haskell.org">ghc-devs@haskell.org</a><br>
> <a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs</a><br>
><br>
</blockquote></div><br></div>