Given the following Typeclassopedia exercise:
--Implement join :: M (N (M (N a))) -> M (N a),
--given distrib :: N (M a) -> M (N a) and
--assuming M and N are instances of Monad.
distrib :: (Monad m, Monad n) => n (m a) => m (n a)
distrib = undefined
I get the following compile-time error.
ghci> :l MonadTransformers.hs
[1 of 1] Compiling Main ( MonadTransformers.hs, interpreted )
MonadTransformers.hs:7:34:
Expected a constraint, but `n (m a)' has kind `*'
In the type signature for `distrib':
distrib :: (Monad m, Monad n) => n (m a) => m (n a)
Failed, modules loaded: none.
How can I resolve it?