robrix / Prelude

Swift µframework of simple functional programming tools
MIT License
408 stars 26 forks source link

Flipping curried functions. #54

Open nikita-leonov opened 7 years ago

nikita-leonov commented 7 years ago

By default, Swift provides all entity functions as curried static functions so calls to entity functions can be represented in a two ways:

//regular use
let something: Something = ...
something.map { ... }
//curried function use
Something.map(something)({ ... })

The existing implementation of flip works only on uncurried functions, while there are a lot of use cases for a curried version of flip. Does it make sense to introduce a curried version of flip?

335g commented 7 years ago

I think it's a good idea 👍

werediver commented 7 years ago

I think both the curried and the uncurried flip are of great value and should be implemented (I would write both from the start).