I'm working on a GHC plugin, mainly in the form of a "builtin" rewrite rule, and I'm seeing a strange disappearance of a case alternative. With -ddump-rule-rewrites, I can see before & after the disappearance: Here's one rule firing with the alternative present:
Rule fired
Rule: reify
Before: reifyP
TyArg Pair Int -> Int
ValArg \ (ds :: Pair Int) ->
case ds of _ { :# a b -> $fNumInt_$c+ a b }
After: lamP
@ (Pair Int)
@ Int
"ds"#
(\ (ds :: EP (Pair Int)) ->
reifyP
@ Int
(case evalP @ (Pair Int) ds of _ { :# a b -> $fNumInt_$c+ a b }))
Cont: StrictArg toE
Stop[BoringCtxt] E Prim (Pair Int -> Int)
The next thing I see is the rule firing again on the residual reifyP application, but with the case alternative gone:
Rule fired
Rule: reify
Before: reifyP
TyArg Int ValArg case evalP @ (Pair Int) ds of wild { }
After: ...
Any ideas what's causing the disappearance?
Thanks. - Conal