diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2019-03-18 21:57:47 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2019-03-18 21:57:47 +0100 |
commit | b4ac0fa66a3212fad3373a68d84d4b74c5fd309c (patch) | |
tree | aecf6d89f36849e5efb999315c38d572cbbed48e /monad/optional.scm | |
parent | Remove entire examples directory. (diff) | |
download | scheme-monad-b4ac0fa66a3212fad3373a68d84d4b74c5fd309c.tar.gz scheme-monad-b4ac0fa66a3212fad3373a68d84d4b74c5fd309c.tar.xz |
Wrote a bunch of documentation.
Diffstat (limited to 'monad/optional.scm')
-rw-r--r-- | monad/optional.scm | 10 |
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)))) |