diff options
Diffstat (limited to 'control/monad/state.scm')
-rw-r--r-- | control/monad/state.scm | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/control/monad/state.scm b/control/monad/state.scm index e369d5d..1097567 100644 --- a/control/monad/state.scm +++ b/control/monad/state.scm @@ -2,9 +2,12 @@ #:use-module (oop goops) #:use-module (ice-9 match) #:use-module (control monad) - #:export (make-state return-state - get put - run-state) + #:export (return-state run-state + get put + ;; TODO + ;; should these even be exported? + define-stateful + define-stateful-method) #:re-export (>>= >>)) @@ -28,6 +31,12 @@ "Creates a state object from a State procedure" (make <state> #:proc proc)) +;;; Define a procedure which is in the state monad. This means that it takes a +;;; state list as a curried argument, and it's return is wrappen in a <state> +;;; object. +;;; It's fully possible to create stateful objects without these macros, but it's +;;; ill adviced since that would just be boilerplate. + (define-syntax-rule (define-stateful ((proc args ...) st) body ...) (define (proc args ...) (make-state |