MonadFix Sliding Law
Unfortunately, the link you provided has an incorrect description of the sliding law. It states:
mfix (fmap h . f) = fmap h (mfix (f . h)) -- for strict h
The actual sliding law is slightly different:
mfix (fmap h . f) = fmap h (mfix (f . h)), when f (h _|_) = f _|_
That is, the precondition is weaker than asking h
to be strict. It simply asks f (h _|_) = f _|_
. Note that if h
is strict, then this precondition is automatically satisfied. (See below for that particular case.) The distinction is important in the monadic case, even though the corresponding law for fix
does not have it:
fix (f . g) = f (fix (g . f)) -- holds without any conditions!
This is because the bind of the underlying monad is usually strict in its left argument, and hence "moving" things around can be observed. For details see Section 2.4 of Value Recursion in Monadic Computations.
The strict h
case
When h
is strict, then the law actually directly follows from the parametricity theorem for the type (A -> M A) -> M A
. This is established in Section 2.6.4, and in particular Corollary 2.6.12 of the same text. In a sense, this is the "boring" case: That is, all monads with an mfix
satisfy it. (So, there isn't really a point in making that specific case a "law.")
With the weaker requirement of f (h _|_) = f _|_
we get a more useful equation that lets us manipulate terms involving mfix
as it is applied to functions that are compositions of regular monadic ones (i.e., f
above) and pure ones (i.e., h
above).
Why do we care?
You can still ask, "why do we care about the sliding law?" @chi's answer provides the intuition. If you write the law using monadic bind, it becomes more clear. Here's the consequent in that notation:
mfix (\x -> f x >>= return . h) = mfix (f . h) >>= return .h
If you look at the left-hand side, we see that return . h
is a central arrow (i.e., one that only affect the value but not the "monadic" part), and thus we'd expect to be able to "lift" it out of the right-hand side of the >>=
. It turns out that this requirement is too much to ask for, for arbitrary h
: It can be shown that many monads of practical interest does not posses such a definition of mfix
. (Details: See Corollary 3.1.7 in Chapter 3.) But the weakened form where we only require f (h _|_) = h _|_
is satisfied by many practical instances.
In pictures, the sliding law allows us to do the following transformation:

which gives us the intuition: We would like the monadic knot-tying to be applied to the "smallest" possible scope, allowing other computations to be rearranged/shuffled around as necessary. The sliding property tells us exactly when this is possible.