aboutsummaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@hornquist.se>2018-11-10 18:43:54 +0100
committerHugo Hörnquist <hugo@hornquist.se>2018-11-10 18:43:54 +0100
commit2754eae6d0c66b2838dc7566904d920ce216dddc (patch)
tree6a15ee7ee897e6b7aed4a5ef412a804516addf77 /data
parentFix problem with do notation being really broken. (diff)
downloadscheme-monad-2754eae6d0c66b2838dc7566904d920ce216dddc.tar.gz
scheme-monad-2754eae6d0c66b2838dc7566904d920ce216dddc.tar.xz
Fixed up examples.
Diffstat (limited to 'data')
-rw-r--r--data/optional.scm9
-rw-r--r--data/writer.scm5
2 files changed, 6 insertions, 8 deletions
diff --git a/data/optional.scm b/data/optional.scm
index a1968f0..e71c10d 100644
--- a/data/optional.scm
+++ b/data/optional.scm
@@ -5,8 +5,8 @@
#:export (nothing just
nothing? just?
return-optional)
- #:re-export (>>=)
- )
+ ;; TODO is this reexport needed?
+ #:re-export (>>=))
(define-class <optional> ()
(slot #:init-value #f
@@ -40,8 +40,3 @@
((just? this)
(match this
(($ <optional> slot) (proc slot))))))
-
-#;
-(define-method (mappend (a <optional>) (b <optional>))
- (match a
- (($ ))))
diff --git a/data/writer.scm b/data/writer.scm
index b79c670..462d391 100644
--- a/data/writer.scm
+++ b/data/writer.scm
@@ -3,7 +3,7 @@
#:use-module (ice-9 match)
#:use-module (data monoid)
#:use-module (control monad)
- #:export (writer))
+ #:export (writer return-writer))
(read-enable 'curly-infix)
@@ -23,6 +23,9 @@
(($ <writer> nval ncontext)
(writer nval { monoid <> ", " <> ncontext }))))))
+(define (return-writer val)
+ (writer val ""))
+
(define-method (write (this <writer>) port)
(match this (($ <writer> value monoid)
(format port "[Writer ~s, ~s]" value monoid))))