From b4ac0fa66a3212fad3373a68d84d4b74c5fd309c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Mon, 18 Mar 2019 21:57:47 +0100 Subject: Wrote a bunch of documentation. --- monad/optional.scm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'monad/optional.scm') 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)))) -- cgit v1.2.3