typelevel / typelevel/cats

Questioning Ior.valueOr

Open
#750 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Scala
Stars
5.5k
Forks
1.2k
Avg merge
2d 10h
Merged PRs (30d)
5

Description

I find the valueOr signature/implementation on Ior to be a little surprising. From the name of the method, I would expect it to return the b value within the Ior if one exists, or else call the provided function on the a value to return a B. However, in the case of Both, it calls the provided function on the a value and uses a Semigroup instance to combine the result with the b value.

I noticed that this method is currently completely untested. Has anyone used valueOr on Ior (or on \&/ in scalaz) and wanted the current behavior? I'm inclined to remove it unless/until someone shows interest in having it.

Contributor guide

Open the contributing guide

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 reviewing the Ior.valueOr signature and implementation, then compare it with the corresponding &/ behavior in scalaz as described in the issue. Determine whether current behavior has users or should be removed; done requires a resolved decision about retaining or removing the untested method.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
api
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.