effect
docs
This commit is contained in:
parent
445e45ddc9
commit
74c8eaaf5c
@ -4,7 +4,7 @@
|
|||||||
//!
|
//!
|
||||||
//! For [`MonadFail<E>`] examples, see [`result`][^research].
|
//! 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].
|
//! For async support, see [`future`][^production][^research] and [`tryfuture`][^production][^research].
|
||||||
//!
|
//!
|
||||||
@ -12,6 +12,8 @@
|
|||||||
//!
|
//!
|
||||||
//! For combining monads, see [`composition`][^research].
|
//! For combining monads, see [`composition`][^research].
|
||||||
//!
|
//!
|
||||||
|
//! For adding extra metadata to values, see [`effect`][^research].
|
||||||
|
//!
|
||||||
//! [^production]: instances expected to be used in production.
|
//! [^production]: instances expected to be used in production.
|
||||||
//!
|
//!
|
||||||
//! [^research]: instances used for research purposes to enhance the abstract interfaces.
|
//! [^research]: instances used for research purposes to enhance the abstract interfaces.
|
||||||
|
@ -1,13 +1,20 @@
|
|||||||
|
//! [Monad] for passing and combining metadata related to the evaluation of values.
|
||||||
|
|
||||||
use crate::func::*;
|
use crate::func::*;
|
||||||
|
|
||||||
|
/// Metadata type.
|
||||||
pub trait Effect {
|
pub trait Effect {
|
||||||
|
/// Used in [`Pure::pure`].
|
||||||
fn e_pure() -> Self;
|
fn e_pure() -> Self;
|
||||||
|
|
||||||
|
/// Used in [`ApplicativeLA2::la2`] and other [`Applicative`] methods.
|
||||||
fn e_seq(lhs: Self, rhs: Self) -> Self;
|
fn e_seq(lhs: Self, rhs: Self) -> Self;
|
||||||
|
|
||||||
|
/// Used in [`Monad::bind`] and other [`Monad`] methods.
|
||||||
fn e_after(self, effect: Self) -> Self;
|
fn e_after(self, effect: Self) -> Self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Value and related metadata.
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct WithEffect<A, E> {
|
pub struct WithEffect<A, E> {
|
||||||
pub value: A,
|
pub value: A,
|
||||||
|
Loading…
Reference in New Issue
Block a user