Skip to content

Groups should be NonEmptySeqs #480

Description

@gusty

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.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions