optics-dev / optics-dev/Monocle
Variance for optics type parameters
Nobody has claimed this yet.
- Dominant language
- Scala
- Stars
- 1.7k
- Forks
- 207
- Avg merge
- 7h 59m
- Merged PRs (30d)
- 5
Description
Add variance to the optics type parameters, eg [-S, +T, +A, -B].
Julien:
It helps with
Some(1).focus(_.some).replace(2)
Without variance, I believe you get an error and need to manually upcast
Some(1): Option[Int]
This example used to work in Monocly: https://github.com/optics-dev/Monocly/blob/master/src/main/scala/Main.scala#L24-L26
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the optics type parameter definitions and compare their current bounds with the requested [-S, +T, +A, -B] variance. Reproduce the Some(1).focus(_.some).replace(2) example from the issue, then verify that the example works without manually upcasting Some(1).
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100