{"id":15288093,"url":"https://github.com/oppiliappan/cutlass","last_synced_at":"2025-04-13T06:35:08.885Z","repository":{"id":57614973,"uuid":"261402918","full_name":"oppiliappan/cutlass","owner":"oppiliappan","description":"experimental auto-currying for rust functions","archived":false,"fork":false,"pushed_at":"2020-05-12T13:07:07.000Z","size":5,"stargazers_count":32,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-26T23:05:01.913Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://crates.io/crates/cutlass","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/oppiliappan.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}},"created_at":"2020-05-05T08:39:54.000Z","updated_at":"2024-09-06T13:12:40.000Z","dependencies_parsed_at":"2022-09-11T03:00:39.781Z","dependency_job_id":null,"html_url":"https://github.com/oppiliappan/cutlass","commit_stats":null,"previous_names":["oppiliappan/cutlass","nerdypepper/cutlass"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oppiliappan%2Fcutlass","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oppiliappan%2Fcutlass/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oppiliappan%2Fcutlass/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oppiliappan%2Fcutlass/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oppiliappan","download_url":"https://codeload.github.com/oppiliappan/cutlass/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248674998,"owners_count":21143761,"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","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":[],"created_at":"2024-09-30T15:44:06.847Z","updated_at":"2025-04-13T06:35:08.831Z","avatar_url":"https://github.com/oppiliappan.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cutlass\n\n\u003e experimental auto-currying for rust functions\n\n### example\n\nthis currently works only on nightly with the\n`type_alias_impl_trait` feature enabled.\n\n```rust\n#![feature(type_alias_impl_trait)]\n\n#[cutlass::curry]\nfn add(x: u32, y: u32, z: u32) -\u003e u32 {\n    return x + y + z;\n}\n\nfn main() {\n    let plus_3 = add(1)(2);\n    let v: Vec\u003cu32\u003e = (1..=3).map(plus_3).collect();\n    assert_eq!(v, vec![4, 5, 6]);\n}\n```\n\n### how it works\n\nthe `#[curry]` proc-macro expands the above `add` function to\nsomething like this (roughly):\n\n```rust\ntype T0 = u32;\ntype T1 = impl Fn(u32) -\u003e T0;\ntype T2 = impl Fn(u32) -\u003e T1;\nfn add(x: u32) -\u003e T2 {\n    return (move |y| move |z| x + y + z);\n}\n```\n\n### gotchas\n\n - doesn't yet work for method functions (signatures with\n   `self`)\n - the function has to have a return value\n - works only on nightly with `type_alias_impl_trait`\n   enabled\n\n### testing\n\ntest this crate with `cargo +nightly test`. \n\nto view macro expansions, install `cargo-expand` and run `cargo expand\n--test \u003ctest name\u003e`. expand `tests/smoke.rs` for example:\n\n```\ncargo expand --test smoke\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foppiliappan%2Fcutlass","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foppiliappan%2Fcutlass","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foppiliappan%2Fcutlass/lists"}