I am confused by the fact that this example uses type instances, not types. Because objects in the Hask category are types, not instances of them.
The example uses an instance of the class, which itself is a type.
In Haskell, yes, this is the same object (type). Monad instances must be type constructors, and type constructors are injective. Then it should be pretty clear that
X = X => M(X) = M(X) => M(M(X)) = M(M(X))
The trap here is that it means that they are the same type, not value. Just because fmap join and join can have their own types specialized for Monad m => m (m (ma)) -> m (ma) does not mean that they do the same.
They do not.
ghci> (fmap join) [[[1],[2],[3]]] [[1,2,3]] ghci> join [[[1],[2],[3]]] [[1],[2],[3]]
Not all category drawings should end with commuting diagrams. :)
source share