Skip to main content

JoinDispatch

Trait JoinDispatch 

Source
pub trait JoinDispatch<'a, Brand: Kind_cdc7cd43dac7585f, A: 'a, Marker> {
    // Required method
    fn dispatch(self) -> <Brand as Kind_cdc7cd43dac7585f>::Of<'a, A>;
}
Expand description

Trait that routes a join operation to the appropriate type class method.

The Marker type parameter is an implementation detail resolved by the compiler from the container type; callers never specify it directly. Owned containers resolve to Val, borrowed containers resolve to Ref.

§Type Parameters

  • 'a: The lifetime of the values.
  • Brand: The brand of the monad.
  • A: The type of the value(s) inside the inner layer.
  • Marker: Dispatch marker type, inferred automatically. Either Val or Ref.

Required Methods§

Source

fn dispatch(self) -> <Brand as Kind_cdc7cd43dac7585f>::Of<'a, A>

Perform the dispatched join operation.

§Type Signature

self -> Brand A

§Returns

A container with one layer of nesting removed.

§Examples
use fp_library::{
	brands::*,
	functions::explicit::*,
};

let result = join::<OptionBrand, _, _>(Some(Some(5)));
assert_eq!(result, Some(5));

Implementors§

Source§

impl<'a, Brand, A> JoinDispatch<'a, Brand, A, Ref> for &<Brand as Kind_cdc7cd43dac7585f>::Of<'a, <Brand as Kind_cdc7cd43dac7585f>::Of<'a, A>>
where Brand: RefSemimonad, A: 'a, <Brand as Kind_cdc7cd43dac7585f>::Of<'a, A>: Clone,

Routes borrowed containers to RefSemimonad::ref_bind with clone.

§Type Parameters
  • 'a: The lifetime.
  • Brand: The brand.
  • A: The inner element type.
Source§

impl<'a, Brand, A> JoinDispatch<'a, Brand, A, Val> for <Brand as Kind_cdc7cd43dac7585f>::Of<'a, <Brand as Kind_cdc7cd43dac7585f>::Of<'a, A>>
where Brand: Semimonad, A: 'a,

Routes owned containers to Semimonad::bind with identity.

§Type Parameters
  • 'a: The lifetime.
  • Brand: The brand.
  • A: The inner element type.