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

Groups should be NonEmptySeqs #480

Open
gusty opened this issue May 30, 2022 · 0 comments
Open

Groups should be NonEmptySeqs #480

gusty opened this issue May 30, 2022 · 0 comments

Comments

@gusty
Copy link
Member

gusty commented May 30, 2022

When grouping sequences typically through a groupBy operation, all subsequences we get are never empty.

This means that using a NonEmptySeq should be more appropriate and it will provide additional compile time guarantees for further operations, typically aggregation operations.

The problem is that these grouping operations are defined in F# core and it's against this library design guidelines to redefine a function coming from F# core, for good reasons.

But we could redefine our grouping functions, for instance chunkBy will never yield an empty group. Here the problem is backwards compatibility and the additional burden incurred in having to eventually upcast to seq for certain operations. But for F# 6 it shouldn't be an issue since it does it automatically.

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

No branches or pull requests

1 participant