This is not an answer, but it does not fit in a comment.
I also needed similar functionality. I suspect the inner type will look like this:
-- The same `FreeF` type from the `free` package in `Control.Monad.Trans.Free` data FreeF fax = Pure a | Free (fx) newtype FreeP fpa' ab' bmr = FreeP { unFreeP :: pa' (FreeF fa (FreeP fpa' ab' bmr)) b' (FreeF fb (FreeP fpa' ab' bmr)) m (FreeF fr (FreeP fpa' ab' bmr)) }
In addition, this may not be possible with current equipment, but this is normal. For example, refer to the StateP proxy transformer, which relies on thread_P from ProxyInternal . A similar thread_P may be required to implement FreeP .
Gabriel gonzalez
source share