optics-dev / optics-dev/Monocle

[Focus] Non-case class getters

Open
#1,034 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

There's no reason not to allow plain old getter methods on non-case classes, generating a Getter. This is something that a user might reasonably guess is supported, and it seems unreasonably to make them bust out the Optics Family documentation to do it.

eg Focus[String](_.length) // Getter[String,Int]

Original issue: https://github.com/optics-dev/Monocly/issues/39

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 tracing the Focus API and how it handles the shown getter expression on case classes. Check how a non-case class expression such as FocusString is processed, then verify that it produces a Getter[String,Int] without requiring the Optics Family documentation path.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
api
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.