Skip to content

given cannot express implicit conversion using cbn parameter #24629

@two-horned

Description

@two-horned

Sometimes it is crucial to convert types without evaluating the value.
For example, like this:

implicit def toB[R](x: => A[R]): B[R] = B(myFun(x))

There exists no equivalent given statement, which I wish would.

If I define a given [R]: Conversion[A[R], B[R]], the apply function has to have type A[R] as parameter, disallowing type => A[R]. So currently I am forced to use the implicit def, which is at odds with modern
coding style that uses given.

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