- 
                Notifications
    You must be signed in to change notification settings 
- Fork 73
Description
I have this type from GPipe library: ContextT Handle os IO a where os is this "thread" type that limits the scope of what's inside ContextT, much like with ST monad
and I have a function runContextT :: (forall os. ContextT Handle os IO x) -> IO x
I'd like to be able to use use this with polysemy so I can mix other effects inside ContexT
currently I my effects are run in IO and then I liftIO to ContextT, but I'd like it to be a bit more streamlined (and testable).
So I wanted to make ContextT be basically the last effect on my stack to be interpreted IO, I tried wrapping this with my own type and interpreting it:
data GPipeWrapped os m a where
   GP :: (ContextT Handle os IO a) -> GPipeWrapped os m a
gp a = Polysemy.Internal.send (GP a)
and then interpreting:
runGPipeWrapped :: forall r os a. Member (Embed IO) r
                => Sem (GPipeWrapped os ': r) a
                -> Sem r a
runGPipeWrapped = interpret $ \case
  GP (x :: ContextT GLFW.Handle os IO x) ->
      embed $ runContextT GLFW.defaultHandleConfig x
I'm getting Could not deduce: os1 ~ os, so look's like I'm missing some RankN forall qualifier somewhere? I'm not even sure what I'm trying is possible in principle, any ideas?