by vilhelm_s · 11y ago · 0 comments
val securityRepresentation = R(numSecurities)
val pcaRepresentation = R(numSecurities)
and gives the error [error] found : securityRepresentation.V
[error] required: pcaRepresentation.V
But securityRepresentation and pcaRepresentation are the same thing! If the Scala typechecker was more agressive, it could deduce that these types are equal. (And in a pure language like Coq and Agda, this would compile).So I think this example is more about details of the Scala type system (nominal typing, coarseness of type equality) than about dependency as such.
Why? The path to V is obviously different, that's the whole point of it. If I wanted them to be the same, I wouldn't need to write it that way.