11 lines
540 B
HTML
11 lines
540 B
HTML
<h2 id="haskell-functors-for-the-programmer">Haskell Functors for the programmer</h2>
|
|
<p><code>Functor</code> is a type class used for types that can be mapped over.</p>
|
|
<ul>
|
|
<li>Containers: <code>[]</code>, Trees, Map, HashMap...</li>
|
|
<li>"Feature Type":
|
|
<ul>
|
|
<li><code>Maybe a</code>: help to handle absence of <code>a</code>.<br />Ex: <code>safeDiv x 0 ⇒ Nothing</code></li>
|
|
<li><code>Either String a</code>: help to handle errors<br />Ex: <code>reportDiv x 0 ⇒ Left "Division by 0!"</code></li>
|
|
</ul></li>
|
|
</ul>
|