Is it possible to use context bounds in type aliases in Scala?
e.g
type U = A : B
No, because the context bound is actually a shorthand for an extra implicit parameter.
For instance:
def sort[A : Ordering](xs: Seq[A])
is a shorthand form for
def sort[A](xs: Seq[A])(implicit ordering: Ordering[A])
and this cannot be represented in a type definition.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With