Skip to content

using quicklens with tagged datatypes #42

Description

@alexandervanhecke

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions