Skip to content

Use NonEmpty for group, group' and groupBy? #75

@sharkdp

Description

@sharkdp

Using purescript-nonempty, the signature of group could be changed from

group :: forall a. Eq a => List a -> List (List a)

to

group :: forall a. Eq a => List a -> List (NonEmpty List a)

I believe this is not just more descriptive, but also useful because it helps people to avoid unsafePartial <<< Data.List.Partial.head or similar constructions.

On the downside, it pulls in the purescript-nonempty dependency.

The same applies to group' and groupBy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions