Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ispringle/masala


https://github.com/ispringle/masala

Last synced: 9 days ago
JSON representation

Awesome Lists containing this project

README

        

# Masala

An autocurrying macro for Rust.

## Usage

This crate requires nightly:

```rust
use masala::curry;

#[curry]
fn mul(a: T, b: T) -> T {
a * b
}

#[curry]
fn add(a: Fn(T), b: T, t:T) -> T {
a + b
}

#[curry]
pub fn psi(a: fn(T, T) -> T, b: fn(T) -> T, c: T, d: T) -> T {
a(b(c.clone()), b(d))
}

fn main() {
let add_10 = add(10);
println!("{}", psi(mul)(add)(10)(3)); // (10 + 10) * (3 + 10) = 33
}
```

## TODO

- [x] Allow for Generics
- [ ] ~Allow for curry functions to be written similar to~