From: Jim Pryor
Date: Sun, 12 Dec 2010 23:15:52 +0000 (-0500)
Subject: why monads?
X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=commitdiff_plain;h=2f6e770665caa164a2c608417954b24359b10f56
why monads?
Signed-off-by: Jim Pryor
---
diff --git a/state_monad_tutorial.mdwn b/state_monad_tutorial.mdwn
index 3add9bd2..d878edca 100644
--- a/state_monad_tutorial.mdwn
+++ b/state_monad_tutorial.mdwn
@@ -134,7 +134,7 @@ or, using pattern-matching on the record (you don't have to specify every field
let { total = value; _ } = s0
in (value, { total = s0.total + 2; modifications = s0.modifications + 2};;
-But **the point of learning how to do this monadically** is that (1) monads show us how to embed more sophisticated programming techniques, such as imperative state and continuations, into frameworks that don't natively possess them (such as the set-theoretic metalanguage of Groenendijk, Stokhof and Veltman's paper); and (2) monads are delicious.
+But **the point of learning how to do this monadically** is that (1) monads show us how to embed more sophisticated programming techniques, such as imperative state and continuations, into frameworks that don't natively possess them (such as the set-theoretic metalanguage of Groenendijk, Stokhof and Veltman's paper); (2) becoming familiar with monads will enable you to see patterns you'd otherwise miss, and implement some seemingly complex computations using the same simple patterns (same-fringe is an example); and finally, of course (3) monads are delicious.
Keep in mind that the final result of a bind chain doesn't have to be the same type as the starting value: