dotty-feature-requests
dotty-feature-requests copied to clipboard
Context Bound for Polymorphic Functions
desugar
val combine = [T: Semigroup] => (x: T) => (y: T) => x `combine` y
to
val combine = [T] => (x: T) => (y: T) => given (ev: Semigroup[T]) => x `combine` y
i.e. a given parameter list before the body
If we do this we might want to be even bolder and support the full syntax of methods, like @LPTK suggested a while ago: https://github.com/lampepfl/dotty/pull/4672#issuecomment-399009667