A distributive law between monads must satisfy laws that are usually given in terms of the units $\eta$ and multiplications $\mu$ of the two monads. Among the four laws there are:$\mu^S T \circ S l \circ l S = l \circ T \mu^S$, and$S \mu^T \circ l T \circ T l = l \circ \mu^T S$I would like to state those laws in Haskell in terms of fmap, return and (>>=). By replacing $\mu$ in the above equation I respectively get:fmap l (l n) >>= id  ==  l (fmap (\m  -> m >>= id) n), andfmap (\m -> m >>= id) (l (fmap l n))  ==  l (n >>= id)But those equations in this form are not very useful for making proofs by rewriting because such patterns never arise directly in practice and thus I cannot use them for rewriting.Is there a nicer, smarter and equivalent way to define a distributive law for monads in Haskell terms of fmap, return and (>>=)? I searched the literature on Haskell but the closer I found were monad transformers which seem to involve special cases of distributive law where one of the monad is fixed. However I am interested in the general case.
Distributive law between monads in Haskell
functional programming;ct.category theory;haskell;monad