fsprojects / fsprojects/FSharpPlus

Currying error on the wrong side

Open
#245 19 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

discussion F#+ v2.0 RFC urgent
Dominant language
F#
Stars
941
Forks
106
PR merge metrics
No merged PRs in 30d

Description

This story tracks back to the first release of F# where the function Async.Catch was added, using the type on the left for the "right" value.

This in a type system with HKT support is the wrong decision, as we're interested in currying types, then we want to have the good value on the rightmost position.

Now, in F# land we don't have real HKTs so that's not a technical restriction, just theorotical at the moment.

So, people started adopting it, then the new Result type landed in F# and guess what? They did it again. Left type for the right type.

Now, people is asking for some Result functions added to F# core. This is when the problem becomes a real problem, because here we're not talking about types, we're talking about actual values.

For values, it's fair to think that's also convenient to curry on the good one. See this comment from @kspeakman https://github.com/fsharp/fslang-suggestions/issues/526#issuecomment-393539604

Now the problem is we still don't know what would be the standard for F# it's probably a bit early. Here in F#+ we did the either function with the error on the right, we can change it in V2 but now we're about to ship bifoldables, so the question is do we want to swap the functions? If the answer is yes, we can still do it for v1.1 but not later.

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

Review the existing either function and the bifoldables API, then read the linked F# language discussion about Async.Catch and Result conventions. Done means reaching a project-wide decision about the error/value argument order and determining whether the affected functions should be swapped before v1.1.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.