Skip to main content

Selective

Trait Selective 

Source
pub trait Selective: Applicative {
    // Required method
    fn select<A, B, F>(
        fab: Self::Of<Result<A, B>>,
        ff: Self::Of<F>,
    ) -> Self::Of<B>
       where A: Clone,
             F: Fn(A) -> B;
}
Expand description

Selective: an Applicative that can conditionally apply effects.

Laws:

  • Identity: select(fmap(Right, x), _) == fmap(id, x) (where Right means Ok variant)

Required Methods§

Source

fn select<A, B, F>(fab: Self::Of<Result<A, B>>, ff: Self::Of<F>) -> Self::Of<B>
where A: Clone, F: Fn(A) -> B,

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§