KaguyaRs is a TOY functional library of Rust.
In fact, this is just the way I get familiar with Rust. I will try my best to implement as many as utilities. But NEVER try this in production environment UNTIL:
TOY
in Introduction. ORKey concerns of this library:
trait object
will be avoided.Basic function and its signature provided is listed below, function based on map will be applied later
There are three versions: curry or not, macro
For curry version, each param will form a new closure, for example ```rust let f = map(|x| x+1, [1,2,3,4,5]); assert_eq!(f, [2,3,4,5,6]);
let f2 = cmap(|x| x+1)([1,2,3,4,5]); // (Number -> Number) -> [Number] -> [Number] asserteq!(f2, [2,3,4,5,6]) ``` For macro version, please refer test for further details as macro can curry automatically depends on the way to invoke macro.
All function with more than one param will have a curry version start with "c", like cmap
For details, please refer TODO.md.
In Haskell, there are so many useful typeclass such as Monad, Functor, Applicative etc. I will implement as much as typeclass as I can. This can greatly empower ability of Functional Programming in Rust.
There are some struct and enum that are widely used in Rust, e.g. Vec, HashMap, Option, Result etc. They can be treat as ADT that can impl typeclass of Haskell like Monad. I will implement them to enhance the power of std struct and enum.
Feel free to contribute and develop base on this lib. Make sure you MUST follow the constraint of LICENSE.
If you are interested to develop this library together, just make PRs with new issues OR send me a email to explain what you want to do for this library as a contributor.
For PR and any other questions, please create a new issue for following.
Apache License v2.