given:
trait record { type id val id: id } trait datasource { type id def read(id: id): try[r] } i'd able describe read function generically.
type reader[r <: record, ds <: datasource] = (ds#id) => try[r] how can guarantee type safety here such ds#id won't dissimilar type r#id? tried...
type reader[r <: record, ds <: datasource, r#id <: ds#id] = (ds#id) => try[r] but doens't compile. correct syntax situation?
when dealing type parameters of reader, id has pulled out it's own parameter.
type reader[r <: record, ds <: datasource, id] = (id) => try[r] once done it's possible place additional bounds onto it...
type reader[r <: record, ds <: datasource, id <: ds#id =:= r#id] = (id) => try[r]
Comments
Post a Comment