gcanti / fp-ts

Functional programming in TypeScript
https://gcanti.github.io/fp-ts/
MIT License
10.74k stars 503 forks source link

Basic Tuple Operations #1074

Closed cyberixae closed 4 years ago

cyberixae commented 4 years ago

🚀 Feature request

It would be nice to have some basic operations for tuples.Namely prepend, append, concat and reverse.

Suggested Solution

I ended up writing my own implementation for some of them with types from package typescript-tuple. For some reason the package provides types without implementation. See ksxnodemodules/typescript-tuple#18

cyberixae commented 4 years ago

The said Tuple type library has some problems with latest TypeScript version ksxnodemodules/typescript-tuple#8

gcanti commented 4 years ago

@cyberixae this kind of operations on tuples seems pretty rare.

Anyway I would stay away from such a risky type-level programming in TypeScript.

cyberixae commented 4 years ago

For the record I think Tuple operations are mostly useful for currying and uncurrying functions. It doesn't matter so much when using functions that are curried out of the box but is still relevant for compatibility with uncurried functions. Whether or not such compatibility should or should not be implemented in fp-ts is another thing entirely. Perhaps we'll eventually get native support in TypeScript. See microsoft/TypeScript#33783