Crates.io | pa |
lib.rs | pa |
version | 0.1.5 |
source | src |
created_at | 2021-03-16 03:30:04.589861 |
updated_at | 2021-03-16 03:30:04.589861 |
description | Functional Programming tools and ADTs |
homepage | https://github.com/yuulive/pa |
repository | https://github.com/yuulive/pa |
max_upload_size | |
id | 369510 |
size | 48,495 |
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:
Key concerns of this library:
trait object
will be avoided.Add dependency to your Cargo.toml
[dependencies]
pa = "*"
Please refer tests and Docs
Basic function and its signature provided is listed below, function based on map will be applied later
There are two versions: function and macro
For curry version, it act as a macro. The macro will form a new closure, for example
let f = map(|x| x+1, [1,2,3,4,5]);
assert_eq!(f, [2,3,4,5,6]);
let f2 = map!(|x| x+1)([1,2,3,4,5]); // (Number -> Number) -> [Number] -> [Number]
assert_eq!(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.
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 OR send me a email to explain what you want to do for this library as a contributor.
For other questions, please create a new issue for following.
Apache License v2.