Skip to content

Unclear CTE using set"..." ~= { ... } with a generic case class #41

@oleg-py

Description

@oleg-py

I was trying to use goggles to modify a value inside a case class with a type parameter (type parameters should remain the same).

Simplified, code like this:

import goggles._
case class Boxed[+A](get: A)
set"${Boxed(1)}.get" ~= { _ + 1 }

results in following error:

The types of consecutive sections don't match.
 found   : Playground.this.Boxed[Int]
 required: Playground.this.Boxed[Int] 

 Sections │ Types            │ Optics 
──────────┼──────────────────┼────────
 $        │ Boxed[Int]       │        
 .get     │ Boxed[Int]  ⇒  A │ Setter

while I would expect Boxed(2), it would be nice even if compile-time error was less misleading.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions