diff options
author | Hugo Hörnquist <hugo@hornquist.se> | 2018-11-10 23:57:53 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@hornquist.se> | 2018-11-10 23:57:53 +0100 |
commit | d86d88b96cd7aba976ab58b909fd4eae48323bb0 (patch) | |
tree | 0c7f93144cbe8c93a5a7c838165bd0e8a0cf24b0 /data/writer.scm | |
parent | Add README. (diff) | |
download | scheme-monad-d86d88b96cd7aba976ab58b909fd4eae48323bb0.tar.gz scheme-monad-d86d88b96cd7aba976ab58b909fd4eae48323bb0.tar.xz |
Add >>, fix do to use it.
Diffstat (limited to 'data/writer.scm')
-rw-r--r-- | data/writer.scm | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/data/writer.scm b/data/writer.scm index 462d391..93f3798 100644 --- a/data/writer.scm +++ b/data/writer.scm @@ -21,7 +21,14 @@ (match this (($ <writer> value monoid) (match (proc value) (($ <writer> nval ncontext) - (writer nval { monoid <> ", " <> ncontext })))))) + (writer nval { monoid <> ncontext })))))) + +(define-method (>> (a <writer>) + (b <writer>)) + (match a (($ <writer> _ monoid-a) + (match b (($ <writer> val monoid-b) + (writer val (<> monoid-a monoid-b)) + ))))) (define (return-writer val) (writer val "")) |