Surprising Core -> STG transformation on master/Clear up what DataConRep is.
After I rebase I suddenly got panic's in a (up to then) working patch.
What seems to happen is that we start with this core:
-- RHS size: {terms: 8, types: 19, coercions: 1, joins: 0/0}
GHC.Types.heq_sel [InlPrag=[~]]
:: forall k0 k1 (a :: k0) (b :: k1). (a ~~ b) => a GHC.Prim.~# b
[GblId[ClassOp],
Arity=1,
Caf=NoCafRefs,
Str=<SP(SL)>,
Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True,
Guidance=ALWAYS_IF(arity=1,unsat_ok=False,boring_ok=False)
Tmpl= \ (@k0_10)
(@k1_11)
(@(a_12 :: k0_10))
(@(b_13 :: k1_11))
(v_B1 [Occ=Once1!] :: a_12 ~~ b_13) ->
case v_B1 of { GHC.Types.HEq# v_B2 -> CO: v_B2 }},
RULES: Built in rule for GHC.Types.heq_sel: "Class op heq_sel"]
GHC.Types.heq_sel
= \ (@k0_10)
(@k1_11)
(@(a_12 :: k0_10))
(@(b_13 :: k1_11))
(v_B1 :: a_12 ~~ b_13) ->
case v_B1 of v_B1 { GHC.Types.HEq# v_B2 -> CO: v_B2 }
And turn it into this STG:
GHC.Types.heq_sel [InlPrag=[~]]
:: forall k0 k1 (a :: k0) (b :: k1).
(a GHC.Types.~~ b) =>
a GHC.Prim.~# b
[GblId[ClassOp],
Arity=1,
Caf=NoCafRefs,
Str=<SP(SL)>,
Unf=OtherCon []] =
\r [v_s5u]
case v_s5u of { GHC.Types.HEq# -> GHC.Prim.coercionToken#; };
The problem being that the binder for v_B2
in the case alternative disappears.
However GHC.Types.HEq#
has dataConRepArity of one. So according to that it should have an argument.
So either the binder should exist, or the repArity is wrong. I'm not familiar enough with the relevant implementation to easily say which one.
@simonpj This seems like something that might have been a sideeffect of 6c7fff0b. Does it ring a bell?