Do you think a free proxy transformer is possible? Something like
data FreePT f p a' a b' b m r = ....
instance (Proxy p,Functor f) => Proxy (FreePT f p) where
....
instance (Functor f) => ProxyTrans (FreePT f) where
....
This is not only curiosity I would actually find this useful.
This isn't an answer, but it won't fit within a comment.
I've wanted a similar functionality, too. I suspect the internal type will look like this:
-- The same `FreeF` type from the `free` package in `Control.Monad.Trans.Free`
data FreeF f a x = Pure a | Free (f x)
newtype FreeP f p a' a b' b m r
= FreeP { unFreeP ::
p a'
(FreeF f a (FreeP f p a' a b' b m r))
b'
(FreeF f b (FreeP f p a' a b' b m r))
m
(FreeF f r (FreeP f p a' a b' b m r)) }
Also, it might not be possible with the currently existing machinery, but that is okay. For example, consult the StateP
proxy transformer, which relies on thread_P
from ProxyInternal
. A similar analog to thread_P
might be necessary to implement FreeP
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With