Frust
Functional programming in Rust. Still largely a WIP.
General idea
Hopefully, make things easier by allowing stuff like this:
use *;
let v = vec!;
assert_eq!;
// Slightly more magical
let t1 = ;
let t2 = ;
let t3 = ;
let tuples = vec!;
let expected = ;
assert_eq!;
Examples
Semigroup
Things that can be combined.
use *;
assert_eq!;
assert_eq!; // bit-wise &&
assert_eq!;
Monoid
Things that can be combined and have an empty/id value.
use *;
let t1 = ;
let t2 = ;
let t3 = ;
let tuples = vec!;
let expected = ;
assert_eq!
let product_nums = vec!;
assert_eq!
HList
Statically typed heterogeneous lists. Pop as much as you want from one of these; everything remains typed.
extern crate frust;
use *;
let h = hlist!;
let = h.pop;
assert_eq!;
assert_eq!;
Todo
It makes sense to start by implementing things that are useful even for idiomatic Rust usage (efficient, and safe). The following might be nice to have:
- Validation (See cats)
These are not implemented at all, nor do I know for sure if they
are possible given that Rust has no support for Higher Kinded Types. In addition,
Rustaceans are used to calling iter()
on collections to get a lazy view,
manipulating their lists, and then doing a collect()
at the end to keep things efficient.
The use of these following structures maybe limited in that context.
Functor
Monad
Apply
Applicative
Show
, Monoid
, HList
, and Semigroup
are at least partially (mostly?) implemented.
Benchmarks would be nice but they're an unstable feature, so perhaps in a different branch.
Inspirations
Scalaz, Cats, Haskell, the usual suspects ;)
Contributing
Yes please !
The following are considered important, in keeping with the spirit of Rust and functional programming:
- Safety (type and memory)
- Efficiency
- Correctness