diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2019-03-18 18:25:25 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2019-03-18 18:25:25 +0100 |
commit | e41ade0f54d47ec3e07593f0763521aedc8ad390 (patch) | |
tree | ebc7cc7f7ea598b15b3d04728dd48767d597ed7f /data | |
parent | Generilified return, monads now truly functors. (diff) | |
download | scheme-monad-e41ade0f54d47ec3e07593f0763521aedc8ad390.tar.gz scheme-monad-e41ade0f54d47ec3e07593f0763521aedc8ad390.tar.xz |
Assorted comments and cleanup.
Diffstat (limited to 'data')
-rw-r--r-- | data/either.scm | 4 | ||||
-rw-r--r-- | data/monoid.scm | 1 | ||||
-rw-r--r-- | data/stack.scm | 3 | ||||
-rw-r--r-- | data/writer.scm | 1 |
4 files changed, 8 insertions, 1 deletions
diff --git a/data/either.scm b/data/either.scm index d6e0f73..c597a60 100644 --- a/data/either.scm +++ b/data/either.scm @@ -1,3 +1,5 @@ +;;; TODO UNFINISHED + (define-module (data either) #:use-module (oop goops) #:use-module (ice-9 match)) @@ -22,7 +24,7 @@ (define-method (>>= (this <either>) (proc <procedure>)) (case (slot-ref this 'dir) - ((left) this) + ((left) this) ((right) (match this (($ <either> slot) (proc slot)))))) (define return-either right) diff --git a/data/monoid.scm b/data/monoid.scm index 45d30cd..d33557e 100644 --- a/data/monoid.scm +++ b/data/monoid.scm @@ -1,3 +1,4 @@ +;;; ??? (define-module (data monoid) #:use-module (oop goops) #:use-module (srfi srfi-1) diff --git a/data/stack.scm b/data/stack.scm index c28d648..d470394 100644 --- a/data/stack.scm +++ b/data/stack.scm @@ -1,4 +1,5 @@ (define-module (data stack) + #:export (pop peek push) #:use-module (control monad) #:use-module (control monad state)) @@ -6,6 +7,8 @@ ;;; in action. These functions assume that they are in a ;;; (state list) monad. But dynamic types! +;;; TODO test these for empty stack + (define (pop) (do st <- (get) let top = (car st) diff --git a/data/writer.scm b/data/writer.scm index 93f3798..bf391c2 100644 --- a/data/writer.scm +++ b/data/writer.scm @@ -30,6 +30,7 @@ (writer val (<> monoid-a monoid-b)) ))))) +;;; TODO replace this (define (return-writer val) (writer val "")) |