Functions as a monad and profunctor