projects
/
lambda.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
a30ae04
)
Ref.getref,putref
author
Jim
<jim.pryor@nyu.edu>
Wed, 8 Apr 2015 06:05:50 +0000
(
02:05
-0400)
committer
Jim
<jim.pryor@nyu.edu>
Wed, 8 Apr 2015 06:05:50 +0000
(
02:05
-0400)
topics/week8_monads_and_modules.mdwn
patch
|
blob
|
history
diff --git
a/topics/week8_monads_and_modules.mdwn
b/topics/week8_monads_and_modules.mdwn
index
e7372d3
..
2737ed5
100644
(file)
--- a/
topics/week8_monads_and_modules.mdwn
+++ b/
topics/week8_monads_and_modules.mdwn
@@
-539,7
+539,7
@@
Here is some code showing how to generate the common monad modules, and also som
module S = Monad.State(struct type store = int end) (* or any other implementation of stores *)
S.(get,gets,put,modify) (* same additional interface as Haskell has; we'll explain them later *)
module Ref = Monad.Ref(struct type value = string end) (* this is essentially a State monad, but with a different interface *)
module S = Monad.State(struct type store = int end) (* or any other implementation of stores *)
S.(get,gets,put,modify) (* same additional interface as Haskell has; we'll explain them later *)
module Ref = Monad.Ref(struct type value = string end) (* this is essentially a State monad, but with a different interface *)
- Ref.(newref,
deref,change
)
+ Ref.(newref,
getref,putref
)
module W = Monad.Writer(struct type log = string let empty = "" let append = (^) end) (* or any other implementation of logs *)
W.(listen,listens,tell,censor)
module E = Monad.Error(struct type err = string exception Exc = Failure end) (* or other specifications of type err and exception Exc of err *)
module W = Monad.Writer(struct type log = string let empty = "" let append = (^) end) (* or any other implementation of logs *)
W.(listen,listens,tell,censor)
module E = Monad.Error(struct type err = string exception Exc = Failure end) (* or other specifications of type err and exception Exc of err *)