pub trait Unary<A> {
type Output;
fn then<B>(
self,
f: impl Fn(Self::Output) -> B + Clone + Send,
) -> impl Fn(A) -> B + Clone + Send;
}
impl<F, A, O> Unary<A> for F
where
F: Fn(A) -> O + Clone + Send,
{
type Output = O;
fn then<B>(
self,
f: impl Fn(Self::Output) -> B + Clone + Send,
) -> impl Fn(A) -> B + Clone + Send {
move |a| f(self(a))
}
}