fp_core/
pure.rs

1use crate::hkt::HKT;
2
3pub trait Pure<A>: HKT<A> {
4    fn of(c: Self::Current) -> Self::Target;
5}
6
7impl<A> Pure<A> for Option<A> {
8    fn of(a: A) -> Self::Target {
9        Some(a)
10    }
11}
12
13impl<A, E> Pure<A> for Result<A, E> {
14    fn of(a: A) -> Self::Target {
15        Ok(a)
16    }
17}