I want to implement lift :: Member e r => Sem '[e] a -> Sem r a. Raise doesn't work for my purposes because everything is necessarily polymorphic and the instances don't terminate
inject :: forall eff r a. Member eff r => Sem '[eff] a -> Sem r a
inject (Sem a) = Sem $ \k -> a $ \case
Union Here (Weaving e s f n v) ->
k $ Union (membership @eff) $ Weaving e s (inject . f) n v
inject :: Inject effs r => Sem effs a -> Sem r a
inject (Sem a) = a $ liftSem . deject . hoist inject
class Inject effs r where
deject :: Union effs (Sem r) a -> Union r (Sem r) a
instance Inject '[] r where
deject = absurdU
instance (Member eff r, Inject effs r) => Inject (eff ': effs) r where
deject u =
case decomp u of
Left u' -> deject u'
Right w -> Union membership w
I want to implement
lift :: Member e r => Sem '[e] a -> Sem r a
.Raise
doesn't work for my purposes because everything is necessarily polymorphic and the instances don't terminateHmm, maybe you could just go through
Sem
, unpacking thatUnion
with single effect and sending it further?yeah, was trying that, but the types make my head spin
who wrote this library even??
Wait, couldn't you just raise it over
Embed (Sem r)
, interpret into it and callrunEmbedded
?now that's an interesting idea
this seems to do it:
amazing what a nap can do
full solution:
nice
starting to get my sea legs back
hsakell sucks ass
no, doesnt seem to work great actually
adding
Members effs effs
to the context works /shrugput this all together to make some stuff that can prove equivalence of interpreters https://gist.github.com/isovector/681d15e9ca398692278df3612dcfc3cd