X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=blobdiff_plain;f=topics%2Fweek7_introducing_monads.mdwn;h=fc508a835f7802e8bb00e7f311080210ab0bfbe8;hp=c7f658d38e32ea635c11fa5cc9f9b069e9a95f11;hb=caa10a9060a7295040ab497c68621522c4628595;hpb=73d48308509ff2628a7425a1e9d30b6fa031fe8e diff --git a/topics/week7_introducing_monads.mdwn b/topics/week7_introducing_monads.mdwn index c7f658d3..fc508a83 100644 --- a/topics/week7_introducing_monads.mdwn +++ b/topics/week7_introducing_monads.mdwn @@ -128,7 +128,7 @@ Here are the types of our crucial functions, together with our pronunciation, an m$ or mapply (/εm@plai/): P -> Q -> P -> Q -> We'll use `m$` as a left-associative infix operator, reminiscent of (the right-associative) `$` which is just ordinary function application (also expressed by mere left-associative juxtaposition). In the class presentation Jim called `m$` `●`. In Haskell, it's called `Control.Monad.ap` or `Control.Applicative.<*>`. +> We'll use `m$` as a left-associative infix operator, reminiscent of (the right-associative) `$` which is just ordinary function application (also expressed by mere left-associative juxtaposition). In the class presentation Jim called `m$` `⚫`. In Haskell, it's called `Control.Monad.ap` or `Control.Applicative.<*>`. <=< or mcomp : (Q -> R) -> (P -> Q) -> (P -> R) @@ -220,7 +220,9 @@ has to obey the following Map Laws: u >>= mid == u mid a >>= k == k a - Also, Haskell calls `mid` `return` or `pure`, but we've stuck to our terminology in this context. + (Also, Haskell calls `mid` `return` or `pure`, but we've stuck to our terminology in this context.) Some authors try to make the first of those Laws look more symmetrical by writing it as: + + (A >>= \a -> B) >>= \b -> C == A >>= (\a -> B >>= \b -> C) > In Category Theory discussion, the Monad Laws are instead expressed in terms of `join` (which they call `μ`) and `mid` (which they call `η`). These are assumed to be "natural transformations" for their box type, which means that they satisfy these equations with that box type's `map`: >
map f ○ mid == mid ○ f
map f ○ join == join ○ map (map f)