#[fp_macros::document_module]
mod inner {
use {
crate::{
classes::*,
functions::*,
kinds::*,
},
fp_macros::*,
};
#[document_examples]
pub trait Bitraversable: Bifunctor + Bifoldable {
#[document_signature]
#[document_type_parameters(
"The lifetime of the values.",
"The type of the first-position elements.",
"The type of the second-position elements.",
"The output type for first-position elements.",
"The output type for second-position elements.",
"The applicative context."
)]
#[document_parameters(
"The function for first-position elements.",
"The function for second-position elements.",
"The bitraversable structure to traverse."
)]
#[document_returns("The transformed structure wrapped in the applicative context.")]
#[document_examples]
fn bi_traverse<
'a,
A: 'a + Clone,
B: 'a + Clone,
C: 'a + Clone,
D: 'a + Clone,
F: Applicative,
>(
f: impl Fn(A) -> Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, C>) + 'a,
g: impl Fn(B) -> Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, D>) + 'a,
p: Apply!(<Self as Kind!( type Of<'a, A: 'a, B: 'a>: 'a; )>::Of<'a, A, B>),
) -> Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, Apply!(<Self as Kind!( type Of<'a, A: 'a, B: 'a>: 'a; )>::Of<'a, C, D>)>);
#[document_signature]
#[document_type_parameters(
"The lifetime of the values.",
"The type of the first-position elements.",
"The type of the second-position elements.",
"The applicative context."
)]
#[document_parameters("The bitraversable structure containing applicative values.")]
#[document_returns("The applicative context wrapping the bitraversable structure.")]
#[document_examples]
fn bi_sequence<'a, A: 'a + Clone, B: 'a + Clone, F: Applicative>(
ta: Apply!(<Self as Kind!( type Of<'a, A: 'a, B: 'a>: 'a; )>::Of<'a, Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, A>), Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, B>)>)
) -> Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, Apply!(<Self as Kind!( type Of<'a, A: 'a, B: 'a>: 'a; )>::Of<'a, A, B>)>)
where
Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, A>): Clone,
Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, B>): Clone, {
Self::bi_traverse::<
Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, A>),
Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, B>),
A,
B,
F,
>(identity, identity, ta)
}
}
#[document_signature]
#[document_type_parameters(
"The lifetime of the values.",
"The brand of the bitraversable structure.",
"The type of the first-position elements.",
"The type of the second-position elements.",
"The output type for first-position elements.",
"The output type for second-position elements.",
"The applicative context."
)]
#[document_parameters(
"The function for first-position elements.",
"The function for second-position elements.",
"The bitraversable structure to traverse."
)]
#[document_returns("The transformed structure wrapped in the applicative context.")]
#[document_examples]
pub fn bi_traverse<
'a,
Brand: Bitraversable,
A: 'a + Clone,
B: 'a + Clone,
C: 'a + Clone,
D: 'a + Clone,
F: Applicative,
>(
f: impl Fn(A) -> Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, C>) + 'a,
g: impl Fn(B) -> Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, D>) + 'a,
p: Apply!(<Brand as Kind!( type Of<'a, A: 'a, B: 'a>: 'a; )>::Of<'a, A, B>),
) -> Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, Apply!(<Brand as Kind!( type Of<'a, A: 'a, B: 'a>: 'a; )>::Of<'a, C, D>)>)
{
Brand::bi_traverse::<A, B, C, D, F>(f, g, p)
}
#[document_signature]
#[document_type_parameters(
"The lifetime of the values.",
"The brand of the bitraversable structure.",
"The type of the first-position elements.",
"The type of the second-position elements.",
"The applicative context."
)]
#[document_parameters("The bitraversable structure containing applicative values.")]
#[document_returns("The applicative context wrapping the bitraversable structure.")]
#[document_examples]
pub fn bi_sequence<'a, Brand: Bitraversable, A: 'a + Clone, B: 'a + Clone, F: Applicative>(
ta: Apply!(<Brand as Kind!( type Of<'a, A: 'a, B: 'a>: 'a; )>::Of<'a, Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, A>), Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, B>)>)
) -> Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, Apply!(<Brand as Kind!( type Of<'a, A: 'a, B: 'a>: 'a; )>::Of<'a, A, B>)>)
where
Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, A>): Clone,
Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, B>): Clone, {
Brand::bi_sequence::<A, B, F>(ta)
}
#[document_signature]
#[document_type_parameters(
"The lifetime of the values.",
"The brand of the bitraversable structure.",
"The type of the first-position elements.",
"The type of the second-position elements (unchanged).",
"The output type for first-position elements.",
"The applicative context."
)]
#[document_parameters(
"The function for first-position elements.",
"The bitraversable structure to traverse."
)]
#[document_returns("The transformed structure wrapped in the applicative context.")]
#[document_examples]
pub fn traverse_left<
'a,
Brand: Bitraversable,
A: 'a + Clone,
B: 'a + Clone,
C: 'a + Clone,
F: Applicative,
>(
f: impl Fn(A) -> Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, C>) + 'a,
p: Apply!(<Brand as Kind!( type Of<'a, A: 'a, B: 'a>: 'a; )>::Of<'a, A, B>),
) -> Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, Apply!(<Brand as Kind!( type Of<'a, A: 'a, B: 'a>: 'a; )>::Of<'a, C, B>)>)
{
Brand::bi_traverse::<A, B, C, B, F>(f, |b| F::pure(b), p)
}
#[document_signature]
#[document_type_parameters(
"The lifetime of the values.",
"The brand of the bitraversable structure.",
"The type of the first-position elements (unchanged).",
"The type of the second-position elements.",
"The output type for second-position elements.",
"The applicative context."
)]
#[document_parameters(
"The function for second-position elements.",
"The bitraversable structure to traverse."
)]
#[document_returns("The transformed structure wrapped in the applicative context.")]
#[document_examples]
pub fn traverse_right<
'a,
Brand: Bitraversable,
A: 'a + Clone,
B: 'a + Clone,
D: 'a + Clone,
F: Applicative,
>(
g: impl Fn(B) -> Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, D>) + 'a,
p: Apply!(<Brand as Kind!( type Of<'a, A: 'a, B: 'a>: 'a; )>::Of<'a, A, B>),
) -> Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, Apply!(<Brand as Kind!( type Of<'a, A: 'a, B: 'a>: 'a; )>::Of<'a, A, D>)>)
{
Brand::bi_traverse::<A, B, A, D, F>(|a| F::pure(a), g, p)
}
#[document_signature]
#[document_type_parameters(
"The lifetime of the values.",
"The brand of the bitraversable structure.",
"The type of the first-position elements.",
"The type of the second-position elements.",
"The output type for first-position elements.",
"The output type for second-position elements.",
"The applicative context."
)]
#[document_parameters(
"The bitraversable structure to traverse.",
"The function for first-position elements.",
"The function for second-position elements."
)]
#[document_returns("The transformed structure wrapped in the applicative context.")]
#[document_examples]
pub fn bi_for<
'a,
Brand: Bitraversable,
A: 'a + Clone,
B: 'a + Clone,
C: 'a + Clone,
D: 'a + Clone,
F: Applicative,
>(
p: Apply!(<Brand as Kind!( type Of<'a, A: 'a, B: 'a>: 'a; )>::Of<'a, A, B>),
f: impl Fn(A) -> Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, C>) + 'a,
g: impl Fn(B) -> Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, D>) + 'a,
) -> Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, Apply!(<Brand as Kind!( type Of<'a, A: 'a, B: 'a>: 'a; )>::Of<'a, C, D>)>)
{
Brand::bi_traverse::<A, B, C, D, F>(f, g, p)
}
#[document_signature]
#[document_type_parameters(
"The lifetime of the values.",
"The brand of the bitraversable structure.",
"The type of the first-position elements.",
"The type of the second-position elements (unchanged).",
"The output type for first-position elements.",
"The applicative context."
)]
#[document_parameters(
"The bitraversable structure to traverse.",
"The function for first-position elements."
)]
#[document_returns("The transformed structure wrapped in the applicative context.")]
#[document_examples]
pub fn for_left<
'a,
Brand: Bitraversable,
A: 'a + Clone,
B: 'a + Clone,
C: 'a + Clone,
F: Applicative,
>(
p: Apply!(<Brand as Kind!( type Of<'a, A: 'a, B: 'a>: 'a; )>::Of<'a, A, B>),
f: impl Fn(A) -> Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, C>) + 'a,
) -> Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, Apply!(<Brand as Kind!( type Of<'a, A: 'a, B: 'a>: 'a; )>::Of<'a, C, B>)>)
{
Brand::bi_traverse::<A, B, C, B, F>(f, |b| F::pure(b), p)
}
#[document_signature]
#[document_type_parameters(
"The lifetime of the values.",
"The brand of the bitraversable structure.",
"The type of the first-position elements (unchanged).",
"The type of the second-position elements.",
"The output type for second-position elements.",
"The applicative context."
)]
#[document_parameters(
"The bitraversable structure to traverse.",
"The function for second-position elements."
)]
#[document_returns("The transformed structure wrapped in the applicative context.")]
#[document_examples]
pub fn for_right<
'a,
Brand: Bitraversable,
A: 'a + Clone,
B: 'a + Clone,
D: 'a + Clone,
F: Applicative,
>(
p: Apply!(<Brand as Kind!( type Of<'a, A: 'a, B: 'a>: 'a; )>::Of<'a, A, B>),
g: impl Fn(B) -> Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, D>) + 'a,
) -> Apply!(<F as Kind!( type Of<'a, T: 'a>: 'a; )>::Of<'a, Apply!(<Brand as Kind!( type Of<'a, A: 'a, B: 'a>: 'a; )>::Of<'a, A, D>)>)
{
Brand::bi_traverse::<A, B, A, D, F>(|a| F::pure(a), g, p)
}
}
pub use inner::*;