rust_fp_pfds/
lib.rs

1#![feature(generic_associated_types)]
2#![allow(incomplete_features)]
3
4extern crate rust_fp_categories;
5
6mod list;
7mod set;
8mod stack;
9mod tree;
10
11pub use list::*;
12pub use set::*;
13pub use stack::*;
14pub use tree::*;
15
16#[cfg(test)]
17mod tests {
18    use crate::{List, Stack};
19    use rust_fp_categories::*;
20
21    #[test]
22    fn it_works() {
23        let list1: List<i32> = List::empty().cons(30).cons(20).cons(10);
24        println!("{:?}", list1);
25        let list2 = list1.bind(|x| List::empty().cons(x * 2).fmap(|x| x - 1));
26        println!("{:?}", list2);
27    }
28}