#[fp_macros::document_module]
mod inner {
use {
crate::{
classes::*,
kinds::*,
},
fp_macros::*,
};
pub trait Cochoice: Profunctor {
#[document_signature]
#[document_type_parameters(
"The lifetime of the values.",
"The input type of the resulting profunctor.",
"The output type of the resulting profunctor.",
"The type of the alternative (Ok) variant (threaded through unchanged)."
)]
#[document_parameters("The profunctor instance to extract from.")]
#[document_returns("A profunctor operating on the unwrapped types.")]
#[document_examples]
fn unleft<'a, A: 'a, B: 'a, C: 'a>(
pab: Apply!(<Self as Kind!( type Of<'a, T: 'a, U: 'a>: 'a; )>::Of<'a, Result<C, A>, Result<C, B>>)
) -> Apply!(<Self as Kind!( type Of<'a, T: 'a, U: 'a>: 'a; )>::Of<'a, A, B>);
#[document_signature]
#[document_type_parameters(
"The lifetime of the values.",
"The input type of the resulting profunctor.",
"The output type of the resulting profunctor.",
"The type of the alternative (Err) variant (threaded through unchanged)."
)]
#[document_parameters("The profunctor instance to extract from.")]
#[document_returns("A profunctor operating on the unwrapped types.")]
#[document_examples]
fn unright<'a, A: 'a, B: 'a, C: 'a>(
pab: Apply!(<Self as Kind!( type Of<'a, T: 'a, U: 'a>: 'a; )>::Of<'a, Result<A, C>, Result<B, C>>)
) -> Apply!(<Self as Kind!( type Of<'a, T: 'a, U: 'a>: 'a; )>::Of<'a, A, B>) {
Self::unleft(Self::dimap(
|r: Result<C, A>| match r {
Ok(c) => Err(c),
Err(a) => Ok(a),
},
|r: Result<B, C>| match r {
Ok(b) => Err(b),
Err(c) => Ok(c),
},
pab,
))
}
}
#[document_signature]
#[document_type_parameters(
"The lifetime of the values.",
"The brand of the cochoice profunctor.",
"The input type of the resulting profunctor.",
"The output type of the resulting profunctor.",
"The type of the alternative (Ok) variant (threaded through unchanged)."
)]
#[document_parameters("The profunctor instance to extract from.")]
#[document_returns("A profunctor operating on the unwrapped types.")]
#[document_examples]
pub fn unleft<'a, Brand: Cochoice, A: 'a, B: 'a, C: 'a>(
pab: Apply!(<Brand as Kind!( type Of<'a, T: 'a, U: 'a>: 'a; )>::Of<'a, Result<C, A>, Result<C, B>>)
) -> Apply!(<Brand as Kind!( type Of<'a, T: 'a, U: 'a>: 'a; )>::Of<'a, A, B>) {
Brand::unleft(pab)
}
#[document_signature]
#[document_type_parameters(
"The lifetime of the values.",
"The brand of the cochoice profunctor.",
"The input type of the resulting profunctor.",
"The output type of the resulting profunctor.",
"The type of the alternative (Err) variant (threaded through unchanged)."
)]
#[document_parameters("The profunctor instance to extract from.")]
#[document_returns("A profunctor operating on the unwrapped types.")]
#[document_examples]
pub fn unright<'a, Brand: Cochoice, A: 'a, B: 'a, C: 'a>(
pab: Apply!(<Brand as Kind!( type Of<'a, T: 'a, U: 'a>: 'a; )>::Of<'a, Result<A, C>, Result<B, C>>)
) -> Apply!(<Brand as Kind!( type Of<'a, T: 'a, U: 'a>: 'a; )>::Of<'a, A, B>) {
Brand::unright(pab)
}
}
pub use inner::*;