fp_library/typeclasses/
sequence.rs1use crate::hkt::{Apply, Kind};
2
3pub trait Sequence {
4 fn sequence<F, A, B>(ff: Apply<Self, (F,)>) -> impl Fn(Apply<Self, (A,)>) -> Apply<Self, (B,)>
6 where
7 Self: Kind<(F,)> + Kind<(A,)> + Kind<(B,)>,
8 F: Fn(A) -> B,
9 Apply<Self, (F,)>: Clone;
10}
11
12pub fn sequence<Brand, F, A, B>(
14 ff: Apply<Brand, (F,)>
15) -> impl Fn(Apply<Brand, (A,)>) -> Apply<Brand, (B,)>
16where
17 Brand: Kind<(F,)> + Kind<(A,)> + Kind<(B,)> + Sequence,
18 F: Fn(A) -> B,
19 Apply<Brand, (F,)>: Clone,
20{
21 move |fa| Brand::sequence::<F, _, _>(ff.to_owned())(fa)
22}