fsprojects / fsprojects/FSharpPlus

[Feature]: concat function

Open
#621 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
F#
Stars
941
Forks
106
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by resolving the expected behavior for the dictionary and option examples in the issue, along with the constraints on the generic input types. Compare those expectations with the proposed bind/toSeq/ofSeq definition; done means the supported cases and type constraints are agreed and the concat behavior is specified clearly enough to implement.

Written by the indexing model from the issue text.

Assessment

Tech stack
fsharp
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.