Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using quicklens with tagged datatypes #42

Open
alexandervanhecke opened this issue Jan 24, 2018 · 0 comments
Open

using quicklens with tagged datatypes #42

alexandervanhecke opened this issue Jan 24, 2018 · 0 comments

Comments

@alexandervanhecke
Copy link

alexandervanhecke commented Jan 24, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant