This is a speculative answer. Use caution.
First, let's look at the KleisliFunctor
, focusing on binding to the arrow:
class (Monad m, Functor f) => KleisliFunctor mf where kmap :: (a -> mb) -> fa -> fb
To do this, in fact, a functor from the Claysley category from m
to Hask , kmap
must follow the corresponding functor laws:
The fact that two Functor
involved makes things a little unusual, but not unreasonable - for example, laws are preserved for mapMaybe
, which is the first concrete example referenced by KleisliFunctor
.
As for Absorb
, I can easily redo the linking method:
class (Functor f, Monad m) => Absorb fm where (~<<) :: (a -> mb) -> fa -> mb
If we are looking for something similar to KleisliFunctor
, the question arises which of the categories will have functions like fa -> mb
like arrows. This, of course, cannot be Hask , since its identifier (of type fa -> ma
) cannot be id
. We would have to find out not only the personality, but also the composition. For something that doesn't quite look like Monad
...
idAbsorb :: fa -> ma compAbsorb :: (fb -> mc) -> (fa -> mb) -> (fa -> mc)
... the only plausible thing I can think of right now is to have a monad morphism like idAbsorb
and use the second monad morphism in the opposite direction (i.e. m
to f
), so compAbsorb
can be implemented by applying the first function, and then go back to f
and finally apply the second function. We will need to do this in order to understand if my assumptions are suitable, if this approach works, and if it leads to something useful for your purposes.