Skip to content

[Feature]: concat function #621

@gusty

Description

@gusty

Background and motivation

A generalization of F# collection's concat function.
Here's a possible generic definition let inline concat x = bind (toSeq >> ofSeq) x.

But we have to define its expected behaviour with different types, and what are the constraints for the input types.
For instance, the above definition would require 'M<'F<'T>> when M should be a monad (support for >>=) and F a foldable (support for toSeq) but it also should be a Collection (support for ofSeq).

Tricky types are options, dictionaries. For instance a dictionary of options won't work with the above definition.

Alternative Concerns

What is the expectation forL

  • concat (dict [ (1, [1;2;3]); (3, [6;7;8]) ])
  • concat (Some [1; 3])

Are you willing help with a pull-request?

Maybe

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