does
withRunInIO
useunliftStrategy
?
Yeah.
i guess my
unsafeCoerce
violates some invariant ofgetStaticRep
?
The problem is not related to effectful, it’s more general. You have unsafeCoerce (MkDict @(KatipE :> es)) :: Dict (KatipE :> es, IOE :> es)
, so you have a dictionary of KatipE :> es
(an Int
internally) and you pretend that you have dictionaries for (KatipE :> es, IOE :> es)
(two Int
S). unliftStrategy
simply tries to use the underlying Int
of IOE :> es
, but it’s not there so it accesses “something” and a segfault ensues.
After giving it more thought it seems to me that the current situation in which dictionary for KatipE :> es
can still be properly accessed after the coerce is a coincidental consequence of what the code gets compiled into and you should not rely on it. Not 100% sure though.