Macro polytype::arrow [] [src]

macro_rules! arrow {
    [$x:expr] => { ... };
    [$x:expr, $($xs:expr),*] => { ... };
    [$x:expr, $($xs:expr,)*] => { ... };
}

Creates a Type::Arrow of tp0 → tp1 → ... (convenice for nested arrows).

This is equivalent to:

Be careful when using this code, it's not being tested!
Type::Arrow(Arrow::new(
    tp0,
    Arrow::new(
        tp1,
        Arrow::new(
            tp2,
            ...
        ).into(),
    ).into(),
))

Examples

#[macro_use] extern crate polytype;
use polytype::Type;

let t = arrow![Type::Variable(0), Type::Variable(1), Type::Variable(2)];
assert_eq!(format!("{}", t),
           "t0 → t1 → t2");