1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/// Creates a curried function.
///
/// The given function definition should be specified in the form
///
/// ```text
/// (arg ->)+ (*|@return_type) {
/// function_body
/// }
/// ```
///
/// No types are specified on the function parameters. An explicit return type can be specified
/// with a type preceded by an `@`; specifying `*` will deduce the return type. The macro will not
/// perform any type conversions.
///
/// # Examples
///
/// ```
/// # #[macro_use] extern crate mcurry;
/// # fn main() {
/// let add_3 = curry!(a -> b -> c -> * {
/// a + b + c
/// });
///
/// assert_eq!(add_3(13)(71)(26), 110);
/// # }
/// ```
///
/// ```
/// # #[macro_use] extern crate mcurry;
/// # fn main() {
/// let haiku = curry!(a -> b -> c -> @String {
/// let lines = vec![a, b, c];
/// lines.join("\n")
/// });
///
/// assert_eq!(haiku("The first cold shower")
/// ("Even the monkey seems to want")
/// ("A little coat of straw"),
///
/// "The first cold shower\n\
/// Even the monkey seems to want\n\
/// A little coat of straw");
/// # }
/// ```
///
/// ```compile_fail
/// # #[macro_use] extern crate mcurry;
/// # fn main() {
/// let add_3 = curry!(a -> b -> c -> @usize {
/// a + b + c // error; evaluates to i32
/// });
///
/// assert_eq!(add_3(13)(71)(26), 110);
/// # }
/// ```
;