softwaremill / softwaremill/quicklens

using quicklens with tagged datatypes

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

Nobody has claimed this yet.

Dominant language
Scala
Stars
852
Forks
53
PR merge metrics
No merged PRs in 30d

Description

Hi,
I'm using quicklens 1.4.11 and com.softwaremill.common tagging v 2.2.0. I'm unable to modify a value containing tagged datatypes. For example :

    import com.softwaremill.tagging._
    import com.softwaremill.quicklens._
    case class A(data: String)
    sealed trait B
    type C = A @@ B
    case class D(value: C)
    val a: C = A("test").taggedWith[B]
    val d = D(a)
    d.modify(_.value.data).setTo("modified")

This does not compile :

[error]      type mismatch;
[error]       found   : A
[error]       required: C
[error]          (which expands to)  A with AnyRef{type Tag <: B}
[error]      L145:    d.modify(_.value.data).setTo("modified")

I understand why this doesn't compile but I was wondering if there is any way around this.

I also tried using shapeless tagging (it uses a trait instead of a type for tagging) but the issue remains.

Apologies if this has been asked before, I searched open & closed issues but could not find anything relevant.

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

The issue names no repository files or tests. Start by reproducing the tagged-datatype example with Scala, quicklens 1.4.11, and tagging 2.2.0, then locate the modification entry point and existing tagged-value handling. Done means the example compiles with a supported behavior or the limitation is documented, with a regression test if applicable.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
developer-experience
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.