monadic 0.1.5

macro to define monadic actions à la Haskell
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use monadic::{monadic, Monad};
use num::Integer;

fn main() {
    let xs = monadic!{ 
    
        x <- 1..7;
        y <- 1..x;
        guard (&y).is_odd() ;
        let z = &y + 1 ;
        Option::pure((x, z)) 
        
    }.collect::<Vec<(i32,i32)>>();
    
    println!("result: {:?}", xs); 
}