1. typeclassopedia
  2. typeclassopedia.bitbucket.org


John Kodumal  committed df9fda2

A little more clarification on functions-as-functors, again by appeal to Haskell.

  • Participants
  • Parent commits 4202ca0
  • Branches master

Comments (0)

Files changed (2)

File .gitignore

View file

File index.html

View file
 	<h2>The Typeclassopedia</h2>
 	<img src="images/typeclassopedia.png" style="float: right; width: 100%; margin-left: 20px;">
 	<p>A set of interrelated typeclasses that have proven handy for structuring functional code:
-	<ul class="slide">
+	<ul>
 		<li class="slide"><em>Functional design patterns</em></li>
 		<li class="slide">There's mostly* nothing magical about these typeclasses</li>
 		<li class="slide">In scala, they're provided by a library called scalaz (pronounced scala-zed)</li>
 	<h6 class="slide">Pop quiz: I defined map in a slightly funky way. What simple concept is this expressing?</h6>
+	<div class="slide">
+		<p>Again, the Haskell version makes this much clearer. Start with <code>fmap</code>:</p>
+<pre class="haskell">
+    fmap :: (a -> b) -> f a -> f b	
+	</div>
+	<div class="slide">
+		<p>Substitute <code>r -> a</code> for <code>f a</code></p>
+<pre class="haskell">
+    fmap :: (a -> b) -> (r -> a) -> (r -> b)	
+	</div>
 	<p class="slide">Aside: This is where the "box" analogy starts falling apart, and we start throwing around vague terms like "computational context"...</p>