By the title, I mean types like Monad m => m (m a).
When the structure of a monad is simple, I can easily think of a usage of such type:
[[a]], which is a multidimensional listMaybe (Maybe a), which is a type adjoined by two error statesEither e (Either e a), which is like above, but with messagesMonoid m => (m,(m,a)), which is a writer monad with two things to write overr -> r -> a, which is a reader monad with two things to read fromIdentity (Identity a), which is still the identity monadComplex (Complex a), which is a 2-by-2 matrix
But it goes haywire in my mind if I think about the following types:
ReadP (ReadP a)? Why would it be useful whenReadPisn't an instance ofRead?ReadPrec (ReadPrec a)? Like above?Monad m => Kleisli m a (Kleisli m a b)?IO (IO a)!? This must be useful. It just is too hard to think about it.forall s. ST s (ST s a)!? This should be like the above.
Is there a practical use for such types? Especially for the IO one?
On the second thought, I might need to randomly pick an IO action. That's an example of IO (IO a) which focuses on inputs. What about one focusing on outputs?