Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

From Discord: Improving NonEmptyReadonlyArray Handling in Types #2606

Closed
effect-bot opened this issue Apr 24, 2024 · 0 comments
Closed

From Discord: Improving NonEmptyReadonlyArray Handling in Types #2606

effect-bot opened this issue Apr 24, 2024 · 0 comments

Comments

@effect-bot
Copy link

Summary

The discussion revolves around enhancing the handling of NonEmptyReadonlyArray within the Effect-TS ecosystem, particularly in preserving its non-empty characteristic through various operations. The conversation points out specific areas for improvement:

  1. Effect.forEach: Suggests that when Effect.forEach is applied to a NonEmptyReadonlyArray, the output should ideally maintain the non-empty array characteristic in its type.

  2. BatchedRequestResolver: It's mentioned that the requests parameter should also be typed as a NonEmptyReadonlyArray to ensure that the batched request inherently requires at least one request to function.

  3. Effect.all: It's noted that Effect.all([Effect.succeed(1)]) already correctly handles a NonEmptyReadonlyArray, implying that similar functions should strive to maintain this level of type accuracy.

Key Takeaways:

  • The focus is on improving type safety and operational semantics related to NonEmptyReadonlyArray in the Effect-TS ecosystem.
  • Ensuring that functions like Effect.forEach and structures like BatchedRequestResolver acknowledge and preserve the non-empty nature of arrays in their type definitions can enhance the robustness and correctness of the code.
  • The conversation highlights a broader theme of leveraging TypeScript's type system to enforce more precise and meaningful constraints on data structures and operations, particularly in functional programming contexts.

Discord thread

https://discord.com/channels/795981131316985866/1232685077985759323

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

No branches or pull requests

2 participants