[Haskell-cafe] coercing D a to D b

Joachim Breitner mail at joachim-breitner.de
Fri Dec 15 01:28:08 UTC 2017


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.

$ 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
 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 Breitner
  mail at joachim-breitner.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20171214/c53e08b4/attachment.sig>

More information about the Haskell-Cafe mailing list