Is it possible for hoist to be even more general by making the hoisted return type existential? i.e.
evenMoreGeneralHoist :: Monad m => (forall a b. m a -> n b) -> t m c -> t n d
Use case:
I want to hoistMaybeT IO a to IO () by hoisting with void . runMaybeT. I like using MaybeT in conjunction with void $ runMaybeT $ forever as a way of terminating recursive loops.
Right now, hoisting with void . runMaybeT gives the following error:
Couldn't match type ‘a’ with ‘()’ ‘a’ is a rigid type variable bound by a type expected by the context: MaybeT IO a -> IO a
Is it possible for
hoist
to be even more general by making the hoisted return type existential? i.e.evenMoreGeneralHoist :: Monad m => (forall a b. m a -> n b) -> t m c -> t n d
Use case: I want to
hoist
MaybeT IO a
toIO ()
by hoisting withvoid . runMaybeT
. I like usingMaybeT
in conjunction withvoid $ runMaybeT $ forever
as a way of terminating recursive loops.Right now, hoisting with
void . runMaybeT
gives the following error:Couldn't match type ‘a’ with ‘()’ ‘a’ is a rigid type variable bound by a type expected by the context: MaybeT IO a -> IO a