Commits

Anonymous committed 6734fe8

Start editing reader

  • Participants
  • Parent commits 5768345

Comments (0)

Files changed (1)

 	</div>	
 </section>
 
+<section>
+	<h2>Reader as Functional Dependency Injection</h2>
+<div class="slide">
+	<p><code>Reader</code> can be used as a functional alternative to dependency injection frameworks.</p>
+
+</div>
+</section>
+
 <section class="slide">
 	<h2>Monad as Embedded Language</h2>
 	<div class="slide">
 	<div class="slide">
 	<p>Let's see why working with stacked monads gets ugly. We'll add a read-only environment to our calculator:</p>
 <pre class="scala">
-def lookup(s: String)(env: Map[String, Int]) = env.get(s) orElse parse(s)
+def lookup(s: String)(env: Map[String, Int]): Option[] = env.get(s) orElse parse(s)
 </pre>
 	</div>
 	<div class="slide">
 }
 </pre>
 	</div>
+</section>
+
+<!-- 
 	<div class="slide">
 		<p>Our solution will involve introducing a new typeclass for <em>monad transformers</em>:</p>
 <pre class="scala">
 }
 </pre>
 	</div>
-
-</section>
+-->
 
 
 <section class="slide">
 	<h2>More on transformers</h2>
 	<div class="slide">
-		<p>We're going to box a monadic computation:</p>
+		<p>We're going to box a monadic value:</p>
 <pre class="scala">
 case class OptionT[F[+_], +A](run: F[Option[A]]) { ... }
 </pre>
 	</div>
 	<div class="slide">
-		<p>The boxed value exposes the underlying monad's utility functions:</p>
+		<p>The boxed value will expose the underlying monad's utility functions:</p>
 		<pre code="scala">
 OptionT(List(Some(3), None, Some(4))).getOrElse(0) // List(3, 0, 4)
 		</pre>
 	</div>
 	<div class="slide">
-		<p>Most importantly, the boxed value is itself a monad:</p>
+		<p>Most importantly, the boxed value will itself be a monad:</p>
 <pre class="scala">
 (for {
 	x <- OptionT(List(Some(3), None))
 <section class="slide">
 	<h2>Monad composition for free</h2>
 	<div class="slide">
-		<p>Assuming we also have a <code>Traverse</code> requirement on monads <code>M</code> and <code>N</code>, we can get a composed monad for "free": </p>
+		<p>Assuming we also have a <code>Traverse</code> requirement on monad <code>N</code>, we can get a composed monad for "free": </p>
 <pre class="scala">
 implicit val ComposedMonad[M: Monad, N: Monad: Traverse] = new Monad[...] {
 	def >>=[A, B](fa: M[N[A]])(f: A => M[N[B]]) : M[N[B]] = // ???