This is a fairly simple algebraic transformation Monad ((->) r)at the type level. See how we specialize and simplify the type join.
join :: Monad m => m (m a) -> m a
join :: ((->) r) (((->) r) a) -> ((->) r) a -- Specializing
join :: (r -> (r -> a)) -> (r -> a) -- Infix
join :: (r -> r -> a) -> r -> a -- Simplifying
source
share