fp-core 0.1.9

A library for functional programming in Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use crate::hkt::HKT;

pub trait Pure<A>: HKT<A> {
    fn of(c: Self::Current) -> Self::Target;
}

impl<A> Pure<A> for Option<A> {
    fn of(a: A) -> Self::Target {
        Some(a)
    }
}

impl<A, E> Pure<A> for Result<A, E> {
    fn of(a: A) -> Self::Target {
        Ok(a)
    }
}