category-theory-presentation/categories/30_How/200_Monads/050_Composition_problem.html
2013-02-28 16:49:12 +01:00

8 lines
420 B
HTML

<h2 id="composition-problem">Composition problem</h2>
<p>The Problem; example with lists:</p>
<pre class="haskell"><code>f x = [x] ⇒ f 1 = [1] ⇒ (f.f) 1 = [[1]] ✗
g x = [x+1] ⇒ g 1 = [2] ⇒ (g.g) 1 = ERROR [2]+1 ✗
h x = [x+1,x*3] ⇒ h 1 = [2,3] ⇒ (h.h) 1 = ERROR [2,3]+1 ✗ </code></pre>
<p>The same problem with most <code>f :: a -&gt; F a</code> functions and functor <code>F</code>.</p>