Swift implementations for function currying.
For more info on function currying in Swift, please refer to this blog post
Note that we're aggressive about pushing
master forward along with new
versions of Swift. Therefore, we highly recommend against pointing at
and instead using one of the releases we've provided.
Add this as a package dependency in Xcode:
Or add it as a dependency in your Package.swift file:
dependencies: [ .package(url: "https://github.com/thoughtbot/Curry", from: "5.0.0"), ]
Follow the current instructions in Carthage's README for up to date installation instructions.
Add the following to your Podfile:
You will also need to make sure you're opting into using frameworks:
pod install with CocoaPods 0.36 or newer.
Curry is Copyright (c) 2015 thoughtbot, inc. It is free software, and may be redistributed under the terms specified in the LICENSE file.
Curry is maintained and funded by thoughtbot, inc. The names and logos for thoughtbot are trademarks of thoughtbot, inc.
We love open source software! See our other projects or look at our product case studies and hire us to help build your iOS app. We also have a collection of resources for learning iOS development at Upcase.
You may find interesting
5.0: five point oh - 2020-05-22 00:57:01
This release doesn't have any source changes, but does add tooling support for Swift 5 and Swift 5.2 so that should probably count for something.
4.0.2: Packaging - 2019-03-12 13:35:25
This is a small compatibility release for future versions of the Swift Package Manager. We now (theoretically) support building with Swift 3, 4, and 5 simultaneously.
4.0.1: Xcode nonsense - 2018-04-15 16:18:32
This is a tiny release that only serves to silence warnings in the Xcode project when opening it with Xcode 9.3. If you're not using the Xcode project as a sub-project this release will mean nothing to you. If you are using the Xcode project as a sub-project this release will mean everything to you.
4.0: No you're ambiguous - 2017-12-13 18:42:42
Curry 4.0 improves compatibility with Swift 4.0, specifically including a fix for the "Ambiguous use of 'curry'" errors that were thrown at compile time. (Thanks @tkohout!)
3.0.0: #OddReleaseMagic - 2016-10-12 21:58:49
Official Swift 3.0 release!
Thanks @eliperkins, @gfontenot, @sharplet, @jshier, and @ikesyo
2.3.3: Better Xcode 8 support - 2016-07-22 18:17:03
This release records the migration attempt for Xcode 8 so that it doesn't throw needless warnings in the project.
2.3.2: The Legacy of Xcode 8 - 2016-07-08 18:16:59
This version adds explicit support for Swift 2.3 projects in Xcode 8. A future release will add explicit support for Swift 3.0.
2.3.1: Death to argument labels - 2016-06-17 21:38:21
As a part of 2.3, we (I) totally forgot that Swift 3.0 no longer ignores the external label on the initial argument. That's my bad. 2.3.1 fixes that by re-ignoring that external label so that we get back to API compatibility.
2.3: A More Parenthetical Future - 2016-06-14 15:25:40
This release introduces Swift 3.0 support. The only change is that the types in the curried return value are wrapped in parens as required by Swift 3.0. This change is backwards compatible with Swift 2.X.
2.2: Steve - 2016-04-07 23:14:00
That thing where I said 2.1 included versions of
curry for functions out to 21 arguments? I 100% lied to you and I apologize. 2.1 only included implementations for up to 19 arguments. Unacceptable. @mbrandonw noticed the mistake and fixed our code generator so that this release includes
curry for functions out to 21 arguments.
2.1: Stephen - 2016-04-06 17:50:06
Curry 2.1 increases the number of
curry definitions back up to 21 arguments. Huge thanks to @ikesyo and @mbrandonw for working on this and testing various compile times.
2.0: Back to the Future - 2016-03-05 20:28:58
Curry.framework 2.0 reverts the syntax used for
curry back to the explicit closure syntax, making it compatible with the upcoming changes to Swift.
- [CHANGED]: Curry now uses an explicit currying syntax for the
- [CHANGED]: Due to compiler limitations, the number of
curryimplementations has been dropped back to 18 arguments. This is a breaking change.
- [NEW]: Curry.framework now fully supports building with Swift Package Manager :tada:
1.4: TV Killed The Radio Star - 2015-10-30 20:51:11
- [NEW]: We now support tvOS (Thanks @nickygerritsen!)
- [NEW]: Bitcode is explicitly enabled for tvOS and watchOS targets
1.3 The Parameter With No Name - 2015-10-11 18:47:50
- [NEW]: Curry functions have been rewritten to have no external labels. This helps prevent issues with partial application where the type didn't match up because the compiler was expecting a named parameter (Thanks @tonyd256!)
- [NEW]: Curry functions are now implemented out to 64 (!!) parameters, which is insane and if you need more than that you should probably seek serious psychological treatment. (Thanks @tonyd256!)
- [NEW]: Curry functions are generated by a swift script, because typing all of these out by hand is for suckers, and I definitely didn't do that when I originally wrote this lib (Thanks @mokagio!)
1.2: Watch me - 2015-09-11 21:38:27
We now include a watchOS framework target
1.1.1: Whatever you say, Xcode - 2015-09-04 20:55:55
This updates the Xcode project file so that Xcode 7 will stop yelling at me.
It's an abusive relationship.
1.1: Singularity - 2015-08-10 21:30:13
curryfor a single argument function (it just returns the function). Thanks, @paulyoung! (PR #5)
1.0: Kari - 2015-07-09 19:29:36
Initial release. This includes implementations for
curry out to 15 arguments.