optics-dev / optics-dev/Monocle

Should withDefault be available on lenses with a polymorphic source?

Open
#1,340 0 comments 0 reactions 1 assignee View on GitHub

@yilinwei is already working on this.

Since Jan 3, 2024.

feature
Dominant language
Scala
Stars
1.7k
Forks
207
Avg merge
7h 59m
Merged PRs (30d)
5

Description

It seems to me like the extension methods that are on LensSyntax et al that use andThen (such as withDefault ought to only require A =:= B and not S =:= T. I would expect those to be on something like:

final case class LensTargetSyntax[S, T, A](private val self: PLens[S, T, A, A]) extends AnyVal {
  ...
}

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.