From: jim Date: Sun, 22 Mar 2015 12:54:25 +0000 (-0400) Subject: some refinements X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=commitdiff_plain;h=caa10a9060a7295040ab497c68621522c4628595 some refinements --- 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)