ApplicativeSelect
This commit is contained in:
parent
45923c401e
commit
b9cc2a7eed
@ -1 +1 @@
|
|||||||
Subproject commit 58487121898c8da9c51479f1df4c1055c7df1e6d
|
Subproject commit 80aa72c60ecd0ac605041d22df2ea6a66178c5be
|
@ -7,6 +7,7 @@
|
|||||||
//! * <https://hackage.haskell.org/package/base-4.18.0.0/docs/Control-Applicative.html>
|
//! * <https://hackage.haskell.org/package/base-4.18.0.0/docs/Control-Applicative.html>
|
||||||
//! * <https://hackage.haskell.org/package/base-4.18.0.0/docs/Control-Monad.html>
|
//! * <https://hackage.haskell.org/package/base-4.18.0.0/docs/Control-Monad.html>
|
||||||
|
|
||||||
|
mod applicative_select;
|
||||||
pub mod classes;
|
pub mod classes;
|
||||||
pub mod clone_func;
|
pub mod clone_func;
|
||||||
mod controlflow;
|
mod controlflow;
|
||||||
@ -21,6 +22,7 @@ pub use std::ops::ControlFlow;
|
|||||||
|
|
||||||
pub use radn_derive::{CovariantFunctor, SharedFunctor};
|
pub use radn_derive::{CovariantFunctor, SharedFunctor};
|
||||||
|
|
||||||
|
pub use self::applicative_select::{ApplicativeSelect, Selected};
|
||||||
pub use self::controlflow::{AIterative, AIterativeWrapped, Iterative, IterativeWrapped};
|
pub use self::controlflow::{AIterative, AIterativeWrapped, Iterative, IterativeWrapped};
|
||||||
use self::controlflow::{ArgumentedIterative, BindableMut, ControlFlowClass};
|
use self::controlflow::{ArgumentedIterative, BindableMut, ControlFlowClass};
|
||||||
|
|
||||||
|
16
src/func/applicative_select.rs
Normal file
16
src/func/applicative_select.rs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
use super::*;
|
||||||
|
|
||||||
|
pub enum Selected<'a, A: 'a, B: 'a, T: ?Sized + 'a + WeakFunctor> {
|
||||||
|
A(A, T::F<'a, B>),
|
||||||
|
B(T::F<'a, A>, B),
|
||||||
|
}
|
||||||
|
|
||||||
|
pub trait ApplicativeSelect: Functor {
|
||||||
|
fn select<'a, A: 'a, B: 'a, C: 'a>(
|
||||||
|
f: impl 'a + FnOnce(Selected<'a, A, B, Self>) -> C,
|
||||||
|
fa: Self::F<'a, A>,
|
||||||
|
fb: Self::F<'a, B>,
|
||||||
|
) -> Self::F<'a, C>
|
||||||
|
where
|
||||||
|
Self: 'a;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user