Join for Reader

pull/17/head
Chris Allen 10 years ago
parent bed7387341
commit 77d4cea6d5

@ -1097,3 +1097,25 @@ to produce any part of their result).
23:34 < Cale> So for instance, when you're repeatedly updating the contents of an IORef, or recursively updating an 23:34 < Cale> So for instance, when you're repeatedly updating the contents of an IORef, or recursively updating an
accumulating parameter without matching on it, you want to be careful there. accumulating parameter without matching on it, you want to be careful there.
``` ```
## Join for Reader
```
18:51 < OscarZ> about join... im wondering about join (+) 7 = 14
19:14 < pjdelport> OscarZ: join for Reader becomes even more Intuitive when you pronounce Reader e a as "function
from an environment e to a"
19:15 < pjdelport> Then "Reader e (Reader e a)" is just "function from an environment e to function from an
environment e to a"
19:16 < pjdelport> And joining means turning that into just one "function from an environment e to a"
19:16 < pjdelport> And saying it like that should (hopefully) make the implementation and what it does more obvious
:)
19:23 < pjdelport> I still think just pondering "type Reader e a = e -> a" is a great way to to get that "a ha"
moment
```
```haskell
λ> join (+) 7
14
λ> join (*) 7
49
```

Loading…
Cancel
Save