You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For a given type class F[T], Simulacrum can currently generate operators for all methods of the shape def f(t:T): X. It would be nice if it also supported operator generation for methods of the shape def f(): T.
As a concrete example, consider the following type class:
trait Decoder[T] {
def decode(s: String): T
}
It would be convenient for String to be enriched with a decode operator, enabling code such as "123".decode[Int] (provided a Decoder[Int] is in scope).
A possible issue would be that, in order to support subtyping of type classes, Simulacrum would need to generate 2 classes for each enhanced type - Decoder.StringOps and Decoder.AllStringOps in our example, for instance.
For a given type class
F[T]
, Simulacrum can currently generate operators for all methods of the shapedef f(t:T): X
. It would be nice if it also supported operator generation for methods of the shapedef f(): T
.As a concrete example, consider the following type class:
It would be convenient for
String
to be enriched with adecode
operator, enabling code such as"123".decode[Int]
(provided aDecoder[Int]
is in scope).A possible issue would be that, in order to support subtyping of type classes, Simulacrum would need to generate 2 classes for each enhanced type -
Decoder.StringOps
andDecoder.AllStringOps
in our example, for instance.See this gitter thread for additional context.
The text was updated successfully, but these errors were encountered: