<div dir="ltr"><div>Hey all, <br></div><div>I've been spending a little bit of time hacking out my own little "erase coercions"</div><div>branch, and with asserts enabled i'm seeing a very strange panic that seems to be invalid?</div><div>namely: its stating that the types have changed, <br></div><div><br></div><div>BUT the error output indicates that the  types  are the same on both sides!<br></div><div><br></div><div><br></div><div><br></div><div>ghc: panic! (the 'impossible' happened)<br>  (GHC version 8.11.0.20200106:<br>        ASSERT failed!<br>  optCoercion changed types!<br>  in_co:<br>    Univ(representational Erased<br>         :: IO a_a2Pd, State# RealWorld -> (# State# RealWorld, a_a2Pd #))<br>  in_ty1: IO a_a2Pd<br>  in_ty2: State# RealWorld -> (# State# RealWorld, a_a2Pd #)<br>  out_co:<br>    Univ(representational Erased<br>         :: IO a_a2Pd, State# RealWorld -> (# State# RealWorld, a_a2Pd #))<br>  out_ty1: IO a_a2Pd<br>  out_ty2: State# RealWorld -> (# State# RealWorld, a_a2Pd #)<br>  subst:<br>    [TCvSubst<br>       In scope: InScope {wild_00 augment ++ build foldr eqString bindIO<br>                          returnIO otherwise assert thenIO breakpoint breakpointCond map $<br>                          join f_a19W x_a19X x_a1hI s_a1hZ $c==_a2rD $c/=_a2rM $cp1Ord_a2rY<br>                          $ccompare_a2s0 $c<_a2se $c<=_a2ss $c>_a2sy $c>=_a2sE $cmax_a2sL<br>                          $cmin_a2sS $cp1Monoid_a2t4 $cmappend_a2tf $cmconcat_a2tl $c>>=_a2tD<br>                          $c>>_a2tS $creturn_a2u3 $cpure_a2uo $c<*>_a2uA $cliftA2_a2uN<br>                          $c*>_a2v0 $c<*_a2vb $c>>=_a2vw $c>>_a2vJ $creturn_a2vU $cpure_a2wd<br>                          $c<*>_a2wn $cliftA2_a2wy $c*>_a2wL $c<*_a2wW $c>>=_a2xf $c>>_a2xq<br>                          $creturn_a2xB $c<*>_a2y0 $cliftA2_a2y9 $c*>_a2yj $c<*_a2yu<br>                          $cmappend_a2yS $cmconcat_a2yY $cmappend_a2ze $cmconcat_a2zk<br>                          $cp1Monoid_a2zE $cmempty_a2zG $cmappend_a2zU $cmconcat_a2A0<br>                          $cp1Monoid_a2Ai $cmempty_a2Ak $cmappend_a2Aw $cmconcat_a2AC<br>                          $cp1Monoid_a2AS $cmempty_a2AU $cmappend_a2B4 $cmconcat_a2Ba<br>                          $cp1Monoid_a2Bo $cmempty_a2Bq $cmappend_a2By $cmconcat_a2BE<br>                          $cmappend_a2BU $cmconcat_a2C0 $cp1Monoid_a2Cb $cmappend_a2Cj<br>                          $cmconcat_a2Cp $cmappend_a2CH $cmconcat_a2CN $c<>_a2CX<br>                          $csconcat_a2D8 $cstimes_a2De $c<>_a2Dt $csconcat_a2DA $c<>_a2DV<br>                          $csconcat_a2DZ $cstimes_a2E5 $c<>_a2Eu $csconcat_a2EI $cstimes_a2EO<br>                          $c<>_a2Fp $csconcat_a2FB $cstimes_a2FH $c<>_a2Gc $csconcat_a2Gm<br>                          $cstimes_a2Gs $c<>_a2GR $csconcat_a2GZ $cstimes_a2H5 $c<>_a2Hm<br>                          $csconcat_a2Hq $cstimes_a2Hu $c<>_a2HG $csconcat_a2HM $cstimes_a2HS<br>                          $c<>_a2I6 $csconcat_a2Id $cstimes_a2Ij $csconcat_a2IC $cstimes_a2II<br>                          $c>>=_a2J0 $c>>_a2JO $creturn_a2JZ $cpure_a2Ke $c<*>_a2Kl<br>                          $cliftA2_a2Kw $c*>_a2KJ $c<*_a2KU $cfmap_a2L7 $c<$_a2Lj<br>                          $cmzero_a2LF $cmplus_a2LO $cmzero_a2M7 $cmplus_a2Mg $cmzero_a2Mz<br>                          $cmplus_a2MI $csome_a2Na $cmany_a2Nj $csome_a2NK $cmany_a2NT<br>                          $c<|>_a2Oe $csome_a2Oj $cmany_a2Os $c>>_a2OP $creturn_a2P0<br>                          $cfmap_a2Pb $c<$_a2Ps a_a2Pu b_a2Pv $c>>=_a2PJ $creturn_a2Q2<br>                          $c>>=_a2Qh $creturn_a2Qz $c>>=_a2QP $c>>_a2QV $creturn_a2R6<br>                          $c<*>_a2Rr $cliftA2_a2RC $c<*_a2RX $cpure_a2Se $c<*>_a2Sj<br>                          $cliftA2_a2Sr $c*>_a2SA $c<*_a2SI $c<*>_a2T5 $cliftA2_a2Th<br>                          $c*>_a2Tq $c<*_a2Tx $c<*>_a2TW $cliftA2_a2U2 $c*>_a2U9 $c<*_a2Uk<br>                          $c<$_a2UF $cfmap_a2US $c<$_a2V0 $cfmap_a2Ve $c<$_a2Vk $c<$_a2VH<br>                          $cfmap_a2VX $c<$_a2W3 $cfmap_a2Wi $c<$_a2Wo $krep_a37a $krep_a37b<br>                          $krep_a37c $krep_a37d $krep_a37e $krep_a37f $krep_a37g $krep_a37h<br>                          $krep_a37i $krep_a37j $krep_a37k $krep_a37l $krep_a37m $krep_a37n<br>                          $krep_a37o $krep_a37p $krep_a37q $krep_a37r $krep_a37s $sap_d3dm<br>                          $sap_d3dn $sliftM5_d3ds $sliftM5_d3dt $sliftM4_d3dy $sliftM4_d3dz<br>                          $sliftM3_d3dE $sliftM3_d3dF $sliftM2_d3dK $sliftM2_d3dL<br>                          $sliftM_d3dQ $sliftM_d3dR $swhen_d3e3 $swhen_d3e4 $s=<<_d3e9<br>                          $sliftA3_d3eh $sliftA3_d3ei $sliftA_d3em $sliftA_d3en $tcMonoid<br>                          $tcSemigroup $trModule <**> liftA liftA3 =<< when sequence mapM<br>                          liftM liftM2 liftM3 liftM4 liftM5 ap mapFB unsafeChr ord minInt<br>                          maxInt id const . flip $! until asTypeOf failIO unIO getTag quotInt<br>                          remInt divInt modInt quotRemInt divModInt divModInt# shiftL#<br>                          shiftRL# iShiftL# iShiftRA# iShiftRL# $tcFunctor $dm<$ $fFunctor[]<br>                          $fFunctorMaybe $fFunctor(,) $fFunctor-> $fFunctor(,,,)<br>                          $fFunctor(,,) $tcApplicative $dm<*> $dmliftA2 $dm*> $dm<*<br>                          $fApplicativeIO $fApplicative[] $fApplicativeMaybe $fApplicative-><br>                          $tcMonad $dm>> $dmreturn $fMonadIO $fFunctorIO $fMonad[]<br>                          $fMonadMaybe $fMonad-> $tcAlternative $dmsome $dmmany<br>                          $fAlternativeIO $fAlternative[] $fAlternativeMaybe $tcMonadPlus<br>                          $dmmzero $dmmplus $fMonadPlusIO $fMonadPlus[] $fMonadPlusMaybe<br>                          $tc':| $tcNonEmpty $fMonadNonEmpty $fApplicativeNonEmpty<br>                          $fFunctorNonEmpty $dmsconcat $dmstimes $fSemigroupIO<br>                          $fSemigroupMaybe $fSemigroupOrdering $fSemigroup(,,,,)<br>                          $fSemigroup(,,,) $fSemigroup(,,) $fSemigroup(,) $fSemigroup()<br>                          $fSemigroup-> $fSemigroupNonEmpty $fSemigroup[] $dmmappend<br>                          $dmmconcat $tc'C:Monoid $fMonoidIO $fMonad(,,,) $fApplicative(,,,)<br>                          $fMonad(,,) $fApplicative(,,) $fMonad(,) $fApplicative(,)<br>                          $fMonoidMaybe $fMonoidOrdering $fMonoid(,,,,) $fMonoid(,,,)<br>                          $fMonoid(,,) $fMonoid(,) $fMonoid() $fMonoid-> $fMonoid[] $tc'O<br>                          $tcOpaque $fEqNonEmpty $fOrdNonEmpty returnIO_s3A8 failIO_s3A9<br>                          $cempty_s3Ab unIO_s3Ac thenIO_s3Ah bindIO_s3Am $trModule_s3AL<br>                          $trModule_s3AM $trModule_s3AN $trModule_s3AO $krep_s3AP<br>                          $tcFunctor_s3AQ $tcFunctor_s3AR $tcApplicative_s3AS<br>                          $tcApplicative_s3AT $tcMonad_s3AU $tcMonad_s3AV $tcAlternative_s3AW<br>                          $tcAlternative_s3AX $tcMonadPlus_s3AY $tcMonadPlus_s3AZ<br>                          $tcNonEmpty_s3B0 $tcNonEmpty_s3B1 $krep_s3B2 $tc':|_s3B3<br>                          $tc':|_s3B4 $tcSemigroup_s3B5 $tcSemigroup_s3B6 $krep_s3B7<br>                          $tcMonoid_s3B8 $tcMonoid_s3B9 $krep_s3Ba $tc'C:Monoid_s3Bb<br>                          $tc'C:Monoid_s3Bc $tcOpaque_s3Bd $tcOpaque_s3Be $tc'O_s3Bf<br>                          $tc'O_s3Bg $cliftA2_s3BL $cfmap_s3BP $c<*>_s3BT $sap_s3BW<br>                          $sliftM2_s3BZ $sliftM5_s3Cc $sliftM4_s3Ch $sliftM3_s3Cl<br>                          $sliftM_s3Co f_s3FS}<br>       Type env: [a2Pd :-> b_a2Pv, a2Pe :-> a_a2Pu]<br>       Co env: []]<br>  Call stack:<br>      CallStack (from HasCallStack):<br>        callStackDoc, called at compiler/utils/Outputable.hs:1173:37 in ghc:Outputable<br>        pprPanic, called at compiler/utils/Outputable.hs:1243:5 in ghc:Outputable<br>        assertPprPanic, called at compiler/types/OptCoercion.hs:122:41 in ghc:OptCoercion</div></div>