From a6102be6bb0e9a9ea61dfec183410aeced9a2ce3 Mon Sep 17 00:00:00 2001 From: jim Date: Thu, 19 Mar 2015 13:03:25 -0400 Subject: [PATCH] lowercase monad --- topics/week7_introducing_monads.mdwn | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/topics/week7_introducing_monads.mdwn b/topics/week7_introducing_monads.mdwn index 1dbd5101..84fdace5 100644 --- a/topics/week7_introducing_monads.mdwn +++ b/topics/week7_introducing_monads.mdwn @@ -180,7 +180,7 @@ Identity is a monad. Here is a demonstration that the laws hold: ~~> \x.j((\x.k(lx)) x) ~~> \x.j(k(lx)) -The Identity Monad is favored by mimes. +The Identity monad is favored by mimes. To take a slightly less trivial (and even more useful) example, consider the box type `α list`, with the following operations: @@ -214,7 +214,7 @@ Contrast that to `m$` (`mapply`, which operates not on two *box-producing functi mapply gs xs ==> [49, 25, 14, 10] -As we illustrated in class, there are clear patterns shared between lists and option types and trees, so perhaps you can see why people want to identify the general structures. But it probably isn't obvious yet why it would be useful to do so. To a large extent, this will only emerge over the next few classes. But we'll begin to demonstrate the usefulness of these patterns by talking through a simple example, that uses the Monadic functions of the Option/Maybe box type. +As we illustrated in class, there are clear patterns shared between lists and option types and trees, so perhaps you can see why people want to identify the general structures. But it probably isn't obvious yet why it would be useful to do so. To a large extent, this will only emerge over the next few classes. But we'll begin to demonstrate the usefulness of these patterns by talking through a simple example, that uses the monadic functions of the Option/Maybe box type. ## Safe division ## @@ -325,7 +325,7 @@ it needs to be adjusted because someone else might make trouble. But we can automate the adjustment, using the monadic machinery we introduced above. As we said, there needs to be different `>>=`, `map2` and so on operations for each -Monad or box type we're working with. +monad or box type we're working with. Haskell finesses this by "overloading" the single symbol `>>=`; you can just input that symbol and it will calculate from the context of the surrounding type constraints what monad you must have meant. In OCaml, the monadic operators are not pre-defined, but we will -- 2.11.0