aboutsummaryrefslogtreecommitdiff
path: root/monad/optional.scm
diff options
context:
space:
mode:
Diffstat (limited to 'monad/optional.scm')
-rw-r--r--monad/optional.scm10
1 files changed, 9 insertions, 1 deletions
diff --git a/monad/optional.scm b/monad/optional.scm
index 015fc90..06c0e67 100644
--- a/monad/optional.scm
+++ b/monad/optional.scm
@@ -1,3 +1,10 @@
+;;; Commentary:
+;;
+;; Your classical optional (Maybe) monad.
+;; It has the constructors @code{just} and @code{nothing}.
+;;
+;;; Code:
+
(define-module (monad optional)
#:use-module (oop goops)
#:use-module (ice-9 match)
@@ -34,7 +41,8 @@ the value embedded in maybe-val"
default))
(define ((wrap-maybe proc) . values)
- "Wraps a function in an optional monad, where #f returns are translated to nothing."
+ "Wraps a function in an optional monad, where #f returns are translated to
+nothing."
(let ((v (apply proc values)))
(if v (just v) (nothing))))