{"id":21573540,"url":"https://github.com/sigurd4/currying","last_synced_at":"2025-09-09T23:39:11.191Z","repository":{"id":143647741,"uuid":"616573371","full_name":"sigurd4/currying","owner":"sigurd4","description":"A crate for argument-currying anything implementing FnOnce.  Arguments can be passed one at a time, yielding a new something implementing FnOnce (and possibly FnMut and Fn) which can be called with one less argument.","archived":false,"fork":false,"pushed_at":"2024-12-29T03:54:08.000Z","size":88,"stargazers_count":16,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-10T16:24:23.816Z","etag":null,"topics":["curry","currying","fp","function","functions","lambda","no-std","no-std-alloc","rust"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/currying","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sigurd4.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-20T16:45:51.000Z","updated_at":"2025-03-20T15:29:20.000Z","dependencies_parsed_at":"2024-11-24T15:04:28.278Z","dependency_job_id":null,"html_url":"https://github.com/sigurd4/currying","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sigurd4/currying","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sigurd4%2Fcurrying","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sigurd4%2Fcurrying/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sigurd4%2Fcurrying/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sigurd4%2Fcurrying/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sigurd4","download_url":"https://codeload.github.com/sigurd4/currying/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sigurd4%2Fcurrying/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274383877,"owners_count":25275186,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-09T02:00:10.223Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["curry","currying","fp","function","functions","lambda","no-std","no-std-alloc","rust"],"created_at":"2024-11-24T12:07:06.581Z","updated_at":"2025-09-09T23:39:11.150Z","avatar_url":"https://github.com/sigurd4.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status (nightly)](https://github.com/sigurd4/currying/workflows/Build-nightly/badge.svg)](https://github.com/sigurd4/currying/actions/workflows/build-nightly.yml)\n[![Build Status (nightly, all features)](https://github.com/sigurd4/currying/workflows/Build-nightly-all-features/badge.svg)](https://github.com/sigurd4/currying/actions/workflows/build-nightly-all-features.yml)\n\n[![Build Status (stable)](https://github.com/sigurd4/currying/workflows/Build-stable/badge.svg)](https://github.com/sigurd4/currying/actions/workflows/build-stable.yml)\n[![Build Status (stable, all features)](https://github.com/sigurd4/currying/workflows/Build-stable-all-features/badge.svg)](https://github.com/sigurd4/currying/actions/workflows/build-stable-all-features.yml)\n\n[![Test Status](https://github.com/sigurd4/currying/workflows/Test/badge.svg)](https://github.com/sigurd4/currying/actions/workflows/test.yml)\n[![Lint Status](https://github.com/sigurd4/currying/workflows/Lint/badge.svg)](https://github.com/sigurd4/currying/actions/workflows/lint.yml)\n\n[![Latest Version](https://img.shields.io/crates/v/currying.svg)](https://crates.io/crates/currying)\n[![License:MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Documentation](https://img.shields.io/docsrs/currying)](https://docs.rs/currying)\n[![Coverage Status](https://img.shields.io/codecov/c/github/sigurd4/currying)](https://app.codecov.io/github/sigurd4/currying)\n\n# Currying\n\nA crate for currying anything implementing `FnOnce`.\n\nArguments can be passed one at a time, yielding a new something implementing `FnOnce` (and possibly `FnMut` and `Fn`) which can be called with one less argument. It also implements `AsyncFnOnce`, `AsyncFnMut` and `AsyncFn` if the feature `async` is enabled, since this is an experimental feature. Curried arguments are then omitted when calling the curried function, as they have already been passed.\n\n## Example\n\n```rust\nuse currying::*;\n\nlet f = |x, y, z| x + y + z;\nlet (x, y, z) = (1, 2, 3);\n\nlet fx = f.curry(x);\n\nassert_eq!(fx(y, z), f(x, y, z));\n\nlet fxz = fx.rcurry(z);\n\nassert_eq!(fxz(y), f(x, y, z));\n\nlet fxyz = fxy.curry(y);\n\nassert_eq!(fxyz(), f(x, y, z));\n```\n\n## Experimental features\n\nWhile this crate does use nightly features regardless, i've found that especially the compile-time stuff tend to break in new versions of the rust language. This is why i've isolated it into a special opt-in feature. If it no longer compiles, please report the error here on github, however the base crate should still work at the very least.\n\n### Asyncronous function traits\n\nAsyncronous function traits are an experminental feature. Enable it with the `async` or the `experimental` feature flag.\n\nIt should work, but i've not tested it yet.\n\n### Compile-time currying\n\nCurrying also works at compile-time.\n\n```rust\n#![feature(const_trait_impl)]\n\nuse currying::*;\n\nconst fn f(x: u8, y: u8, z: u8) -\u003e u8 {\n    x + y + z\n}\n\nconst X: u8 = 1;\nconst Y: u8 = 2;\nconst Z: u8 = 3;\n\ntype FType = fn(u8, u8, u8) -\u003e u8;\ntype FXType = Curried\u003c(u8,), (), FType\u003e;\ntype FXZType = Curried\u003c(), (u8,), FXType\u003e;\ntype FXYZType = Curried\u003c(u8,), (), FXZType\u003e;\n\nconst F: FType = f;\nconst FX: FXType = F.curry(X);\nconst FXZ: FXZType = FX.rcurry(Z);\nconst FXYZ: FXYZType = FXZ.curry(Y);\n\nassert_eq!(FX(Y, Z), f(X, Y, Z));\nassert_eq!(FXZ(Y), f(X, Y, Z));\nassert_eq!(FXYZ(), f(X, Y, Z));\n```\n\nCompile-time currying is an experminental feature. Enable it with the `const` or the `experimental` feature flag.\n\n### Compile-time function traits\n\nThis did work fine initially, but in later rust-nightly releases, it broke. It's currently not possible as of writing. I want to add this again when the language supports it.\n\n## Currying from the right\n\nCurrying can be done from the right too, with the method `rcurry()`.\n\nThis is a stable feature, and is enabled by default. You can opt out of it by disabling the `rcurry` feature flag.\n\n## Pedantic\n\nBy default, anything can technically be curried. While it would be nice to be able to prevent currying of something that isn't a function, this makes type inferrence much worse.\n\nIf you want this a type-constraint so that only function-types can be curried, at the cost of ideal type-inferrence, use the feature flag `pedantic`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsigurd4%2Fcurrying","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsigurd4%2Fcurrying","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsigurd4%2Fcurrying/lists"}