pub trait Functor: Kind0L1T {
// Required method
fn map<'a, ClonableFnBrand: 'a + ClonableFn, A: 'a, B: 'a>(
f: ApplyClonableFn<'a, ClonableFnBrand, A, B>,
) -> ApplyClonableFn<'a, ClonableFnBrand, Apply0L1T<Self, A>, Apply0L1T<Self, B>>;
}👎Deprecated since 0.0.21: Use fp_library::v2::classes instead
Expand description
A type class for types that can be mapped over.
A Functor represents a context or container that allows functions to be applied
to values within that context without altering the structure of the context itself.
§Laws
Functor instances must satisfy the following laws:
- Identity:
map(identity) = identity. - Composition:
map(compose(f)(g)) = compose(map(f))(map(g)).
Required Methods§
Sourcefn map<'a, ClonableFnBrand: 'a + ClonableFn, A: 'a, B: 'a>(
f: ApplyClonableFn<'a, ClonableFnBrand, A, B>,
) -> ApplyClonableFn<'a, ClonableFnBrand, Apply0L1T<Self, A>, Apply0L1T<Self, B>>
👎Deprecated since 0.0.21: Use fp_library::v2::classes instead
fn map<'a, ClonableFnBrand: 'a + ClonableFn, A: 'a, B: 'a>( f: ApplyClonableFn<'a, ClonableFnBrand, A, B>, ) -> ApplyClonableFn<'a, ClonableFnBrand, Apply0L1T<Self, A>, Apply0L1T<Self, B>>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.