Hi, Am Donnerstag, den 14.12.2017, 16:53 -0800 schrieb Evan Laforge:
Nice, it looks like "Note [Case 2: CSEing case binders]" applies to what I was talking about.
I assume once I can upgrade to 8.2 (or 8.4 more likely) then both my examples should wind up looking different at the core level, but then both be a coerce in STG? Well, I guess implicitly a coerce since STG doesn't have types like that.
precisely: $ ghc-8.2 -O -ddump-stg test.hs [1 of 1] Compiling Foo ( test.hs, test.o ) … ==================== STG syntax: ==================== Foo.dmapNoCoerce :: forall a b. (a -> b) -> Foo.D a -> Foo.D b [GblId, Arity=2, Caf=NoCafRefs, Str=<L,1*C1(U)><S,1*U>, Unf=OtherCon []] = \r [f_s15C ds_s15D] case ds_s15D of { Foo.A a1_s15F [Occ=Once] -> let { sat_s15G [Occ=Once] :: b_aTu [LclId] = \u [] f_s15C a1_s15F; } in Foo.A [sat_s15G]; Foo.B i_s15H [Occ=Once] c_s15I [Occ=Once] -> wild_s15E; }; … The pretty-printing is actually a bit broken, but the wild_s15E is the case-binder of the "case ds_s15D" construct. Joachim -- Joachim Breitner mail@joachim-breitner.de http://www.joachim-breitner.de/