Skip to content
This repository has been archived by the owner on Jun 1, 2024. It is now read-only.

[Feature Request] Add a datastructure for Tuple #127

Closed
puneetar opened this issue Apr 17, 2018 · 5 comments
Closed

[Feature Request] Add a datastructure for Tuple #127

puneetar opened this issue Apr 17, 2018 · 5 comments

Comments

@puneetar
Copy link

puneetar commented Apr 17, 2018

#It would be great to have a data structure for Tuple

Tuple <A, B>{
  _1 : A
  _2 : B
}

// functions
function fold()
function bimap()
@ErunamoJAZZ
Copy link

Why do you think this?

I feel a tuple type innecesary in JavaScript because arrays can do the work.
Tuples are interesing in typed languages where you cant mix types in arrays without lost their types, but this does not happen in js.

@puneetar
Copy link
Author

puneetar commented Apr 28, 2018 via email

@ErunamoJAZZ
Copy link

But in the way you suggested this, _1 and _2 have the same type, maybe you are thinking in some like Tuple<A, B> instead?

I am not using flow or ts right now, so I really don't see why this could be interesting :/

@puneetar
Copy link
Author

🤦 corrected it.

True, it may not be interesting right now, but it is helpful when you want to return 2 types and creating a class with 2 objects is an overkill.

Take a look at https://github.com/fantasyland/fantasy-tuples, it is perfect but just don't have typescript or flow types. Therefore, though it would be perfect for funfix : Functional Programming Library for JavaScript, TypeScript and Flow

@puneetar
Copy link
Author

Will the authors be willing to include tuples if I work on it and create a PR ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants