scala - Implicit conversion not working with type-safe builder pattern -
i using scala type-safe builder pattern simple rest request. works great fluent api. sealed abstract class method(name: string) case object extends method("get") case object post extends method("post") abstract class true abstract class false case class builder[hasmethod, hasuri]( method: option[method], uri: option[string]) { def withmethod(method: method): builder[true, hasuri] = copy(method = some(method)) def withuri(uri: string): builder[hasmethod, true] = copy(uri = some(uri)) } implicit val init: builder[false, false] = builder[false, false](none, none) //fluent examples val b1: builder[true, false] = init.withmethod(get) val b2: builder[true, true] = init.withmethod(get).withuri("bar") i make more dsl-like allowing method instance converted builder instance, when add try implicitly include init builder combination of implicit conversion , type parameters confuse compiler. implicit def tomethod[hasuri](m: method) (impli...