From 2482c5e779b563835cac4b24281fccb92cded1ee Mon Sep 17 00:00:00 2001 From: Thibault Martin <thi.martin.pro@pm.me> Date: Wed, 8 Jan 2025 15:38:08 +0100 Subject: [PATCH] [doc] Fix odoc bullets --- src/libraries/monads/monad.mli | 6 ++++++ src/libraries/monads/result.mli | 7 +++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/libraries/monads/monad.mli b/src/libraries/monads/monad.mli index a31294b6e4..a871fa7343 100644 --- a/src/libraries/monads/monad.mli +++ b/src/libraries/monads/monad.mli @@ -20,6 +20,8 @@ (* *) (**************************************************************************) +(** This module provides a generic monad interface based on Keisli and Categoric + defintion of monads. *) (** {2 Kleisli triple signature for a monadic type constructor ['a t]} @@ -115,7 +117,9 @@ end nested applications of the monad. It must also satisfy some laws : 2. ∀m:('a t t t), [map flatten (flatten m) ≣ flatten (flatten m)] + 3. ∀m:('a t), [flatten (map return m) ≣ flatten (return m) ≣ m] + 4. ∀m:('a t t), ∀f: ('a -> 'b), [flatten (map (map f) m) ≣ map f (flatten m)] As there is no way in the OCaml type system to enforce those properties, @@ -162,7 +166,9 @@ end using the operations required by the others. Indeed : 1. ∀m:('a t), ∀f:('a -> 'b), [map f m ≣ bind (fun x -> return (f x)) m] + 2. ∀m:('a t t), [flatten m ≣ bind identity m] + 3. ∀m:('a t), ∀f:('a -> 'b t), [bind f m ≣ flatten (map f m)] All required laws expressed in both minimal signatures are respected diff --git a/src/libraries/monads/result.mli b/src/libraries/monads/result.mli index 0411390df5..7e8edc10e9 100644 --- a/src/libraries/monads/result.mli +++ b/src/libraries/monads/result.mli @@ -20,8 +20,11 @@ (* *) (**************************************************************************) -(* Adding let binding operators to the Result module. See - https://v2.ocaml.org/manual/bindingops.html for more information. *) +(** Adding let binding operators to the Result module. + @see <https://v2.ocaml.org/manual/bindingops.html> + This module does not use the generic monad interface (cf. {!Monad}) because + of the error type, which would require another layer of functors. +*) include module type of Stdlib.Result -- GitLab