summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrekado <rekado@elephly.net>2014-10-30 20:22:54 +0100
committerrekado <rekado@elephly.net>2014-10-30 20:22:54 +0100
commit77cb84cd32cf8e4e7645c25bc580ceec7921eec5 (patch)
tree75f91e66f75f6e14f5606ef48f24984a92126785
parent55c479f841df1db6400802b7953de833b6fc038d (diff)
rename 'with-monad:' to 'with-monad'HEADmaster
-rw-r--r--monad/core.scm12
-rw-r--r--monad/either.scm2
-rw-r--r--monad/maybe.scm2
-rw-r--r--monad/state.scm2
-rw-r--r--test.scm56
5 files changed, 37 insertions, 37 deletions
diff --git a/monad/core.scm b/monad/core.scm
index 1e1252e..05d1a59 100644
--- a/monad/core.scm
+++ b/monad/core.scm
@@ -1,6 +1,6 @@
(define-module (monad core)
#:use-module (srfi srfi-9)
- #:export (make-monad with-monad: monad? monad-bind monad-return))
+ #:export (make-monad with-monad monad? monad-bind monad-return))
(define-record-type monad
(make-monad bind return)
@@ -10,13 +10,13 @@
(define-syntax-parameter >>=
(lambda (s)
- (syntax-violation '>>= ">>= (bind) used outside of 'with-monad:'" s)))
+ (syntax-violation '>>= ">>= (bind) used outside of 'with-monad'" s)))
(define-syntax-parameter return
(lambda (s)
- (syntax-violation 'return "return used outside of 'with-monad:'" s)))
+ (syntax-violation 'return "return used outside of 'with-monad'" s)))
-(define-syntax with-monad:
+(define-syntax with-monad
(lambda (x)
(syntax-case x (<-)
((_ monad action)
@@ -28,10 +28,10 @@
(return (identifier-syntax (monad-return monad))))
(>>= action
(lambda (res)
- (with-monad: monad exp ...)))))
+ (with-monad monad exp ...)))))
((_ monad action exp ...)
#'(syntax-parameterize ((>>= (identifier-syntax (monad-bind monad)))
(return (identifier-syntax (monad-return monad))))
(>>= action
(lambda (_)
- (with-monad: monad exp ...))))))))
+ (with-monad monad exp ...))))))))
diff --git a/monad/either.scm b/monad/either.scm
index 91725b2..e52eaa4 100644
--- a/monad/either.scm
+++ b/monad/either.scm
@@ -2,7 +2,7 @@
#:use-module (monad core)
#:use-module (srfi srfi-9)
#:use-module (ice-9 match)
- #:re-export (with-monad:)
+ #:re-export (with-monad)
#:export (either-monad
Left Right))
diff --git a/monad/maybe.scm b/monad/maybe.scm
index fdf4de7..075d456 100644
--- a/monad/maybe.scm
+++ b/monad/maybe.scm
@@ -2,7 +2,7 @@
#:use-module (monad core)
#:use-module (srfi srfi-9)
#:use-module (ice-9 match)
- #:re-export (with-monad:)
+ #:re-export (with-monad)
#:export (maybe-monad
Just just? from-just
Nothing))
diff --git a/monad/state.scm b/monad/state.scm
index 86a5c75..12275d1 100644
--- a/monad/state.scm
+++ b/monad/state.scm
@@ -1,6 +1,6 @@
(define-module (monad state)
#:use-module (monad core)
- #:re-export (with-monad:)
+ #:re-export (with-monad)
#:export (state-monad run-state
get put modify))
diff --git a/test.scm b/test.scm
index c0e7297..02f5f0a 100644
--- a/test.scm
+++ b/test.scm
@@ -16,47 +16,47 @@
(begin
(test "maybe 1"
- '(with-monad: maybe-monad
- (a <- (Just 5))
- (b <- (f 2))
- (c <- (Just 10))
- (return (+ a b c)))
+ '(with-monad maybe-monad
+ (a <- (Just 5))
+ (b <- (f 2))
+ (c <- (Just 10))
+ (return (+ a b c)))
(Just 17))
(test "maybe 2"
- '(with-monad: maybe-monad
- (a <- (Just 5))
- (b <- (f 0))
- (c <- (Just 10))
- (return (+ a b c)))
+ '(with-monad maybe-monad
+ (a <- (Just 5))
+ (b <- (f 0))
+ (c <- (Just 10))
+ (return (+ a b c)))
(Nothing))
(test "state 1"
- '(run-state 0 (with-monad: state-monad
- (put 10)
- (put 9)
- (modify (lambda (x) (+ 2 x)))
- (modify (lambda (x) (+ 2 x)))
- (get)))
+ '(run-state 0 (with-monad state-monad
+ (put 10)
+ (put 9)
+ (modify (lambda (x) (+ 2 x)))
+ (modify (lambda (x) (+ 2 x)))
+ (get)))
13)
(test "state 2"
- '(run-state 10 (with-monad: state-monad
- (get)))
+ '(run-state 10 (with-monad state-monad
+ (get)))
10)
(test "either 1"
- '(with-monad: either-monad
- (a <- (Right 5))
- (b <- (Right 0))
- (c <- (Right 10))
- (return (+ a b c)))
+ '(with-monad either-monad
+ (a <- (Right 5))
+ (b <- (Right 0))
+ (c <- (Right 10))
+ (return (+ a b c)))
(Right 15))
(test "either 2"
- '(with-monad: either-monad
- (a <- (Right 5))
- (b <- (Left "an error"))
- (c <- (Right 10))
- (return (+ a b c)))
+ '(with-monad either-monad
+ (a <- (Right 5))
+ (b <- (Left "an error"))
+ (c <- (Right 10))
+ (return (+ a b c)))
(Left "an error")))