effect icon indicating copy to clipboard operation
effect copied to clipboard

Clarify length requirements in tuple documentation

Open cyberixae opened this issue 6 months ago • 0 comments

What is the type of issue?

Documentation is confusing

What is the issue?

The Tuple module contains functions like map, that work on tuples of arbitrary length, but also functions like mapBoth, that only work on tuples with exactly two items.

I think it would be good to clarify the length requirement in prose.

  • map "Transforms each element of a tuple using the given function"
  • mapBoth "Transforms both elements of a 2-tuple using the given functions"

I'm not sure if it makes sense for these two functions to be in the same module to begin with. The mapBoth function could perhaps be moved to a separate module called Pair, or Tuple2 in case similar functions are to be expected for other tuple lengths. I guess some of the 2-tuple specific functions could alternatively be updated to work with arbitrary length tuples.

Where did you find it?

https://effect-ts.github.io/effect/effect/Tuple.ts.html

cyberixae avatar Jun 22 '25 21:06 cyberixae