optics-dev / optics-dev/Monocle

Code snippet from Lens manual does not compile

Open
#522 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

import monocle.Lens
val streetNumber = Lens[Address, Int](_.streetNumber)(n => a => a.copy(streetNumber = n))

Fails compilation with error not found: value n. I wanted to fix that but then I noticed that actually it's somehow already mentioned in lens.md file:

// REPL bug: `error: not found: value n` if I rename _streetNumber to streetNumber
import monocle.Lens
val _streetNumber = Lens[Address, Int](_.streetNumber)(n => a => a.copy(streetNumber = n))
val streetNumber = _streetNumber

But I cannot see this snippet at http://julien-truffaut.github.io/Monocle/optics/lens.html and I blame it on tut:silent:invisible. Also it's not just in REPL - I cannot compile it with scala 2.12.2.

Would be nice to this hidden code instead of current visible one. Spent at least half an hour on that, it's really confusing.

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

Inspect the lens.md source and the generated lens documentation at the linked page, focusing on the tut:silent:invisible snippet and the currently visible Lens example. Update the documented example so it compiles with Scala 2.12.2, then verify the generated documentation and snippet compilation.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.