title: Why are monads not closed under composition?
body: <p>While I was learning <code>Composing Types</code> chapter from Haskell Book, I was given tasks to write Functor and Applicative instances for the following type.</p>
  <pre><code>newtype Compose f g a = Compose { getCompose :: f (g a) }
  </code></pre>
  <p>I wrote the following definitions</p>
  <h2>Functor:</h2>
  <pre><code>fmap f (Compose fga) = Compose $ (fmap . fmap) f fga
  </code></pre>
  <h2>Applicative:</h2>
  <pre><code>(Compose f) &lt;*&gt; (Compose a) = Compose $ (&lt;*&gt;) &lt;$&gt; f &lt;*&gt; a
  </code></pre>
  <p>I learned that composing two Functors or Applicatives gives Functor and Applicative respectively.</p>
  <p>The author also explained it is not possible to compose two Monads the same way. So we use Monad Transformers. I just do not want to read Monad Transformers unless I'm clear with why Monads do not compose.</p>
  <p>So far I tried to write <code>bind</code> function like this:</p>
  <h2>Monad:</h2>
  <pre><code>(&gt;&gt;=) :: Compose f g a -&gt; (a -&gt; Compose f g b) -&gt; Compose f g b
  (Compose fga) &gt;&gt;= h = (fmap.fmap) h fga
  </code></pre>
  <p>and of course got this error from GHC</p>
  <blockquote>
  <p>Expected type: Compose f g b</p>
  <p>Actual type: f (g (Compose f g b))</p>
  </blockquote>
  <p>If I can strip the outermost <code>f g</code> somehow, the composition gives us a monad right? (I still couldn't figure out how to strip that though)</p>
  <p>I tried reading answers from other Stack Overflow questions like <a href="https://stackoverflow.com/questions/29453915/composing-monads-v-applicative-functors">this</a>, but all answers are more theoretical or some Math. I still haven't learned why Monads do not compose. Can somebody explain me without using Math?</p>