effect docs

This commit is contained in:
AF 2023-05-26 12:02:57 +00:00
parent 445e45ddc9
commit 74c8eaaf5c
2 changed files with 10 additions and 1 deletions

View File

@ -4,7 +4,7 @@
//!
//! For [`MonadFail<E>`] examples, see [`result`][^research].
//!
//! For the simplest form (even ChatGPT can understand it! lol) of [`Monad`], see [`solo`][^production].
//! For the simplest form of [`Monad`], see [`solo`][^production].
//!
//! For async support, see [`future`][^production][^research] and [`tryfuture`][^production][^research].
//!
@ -12,6 +12,8 @@
//!
//! For combining monads, see [`composition`][^research].
//!
//! For adding extra metadata to values, see [`effect`][^research].
//!
//! [^production]: instances expected to be used in production.
//!
//! [^research]: instances used for research purposes to enhance the abstract interfaces.

View File

@ -1,13 +1,20 @@
//! [Monad] for passing and combining metadata related to the evaluation of values.
use crate::func::*;
/// Metadata type.
pub trait Effect {
/// Used in [`Pure::pure`].
fn e_pure() -> Self;
/// Used in [`ApplicativeLA2::la2`] and other [`Applicative`] methods.
fn e_seq(lhs: Self, rhs: Self) -> Self;
/// Used in [`Monad::bind`] and other [`Monad`] methods.
fn e_after(self, effect: Self) -> Self;
}
/// Value and related metadata.
#[derive(Clone)]
pub struct WithEffect<A, E> {
pub value: A,