dependent-type

How to emulate a dependent type in Scala

I'm trying to define a generic residue class ring in Scala. A residue class ring is defined by some base ring (e.g. the integers) and a modulus (e.g. two), which is a value from the base ring. Both rings and their elements are objects, hence the type of the modulus would normally be a dependent type, depending on the base ring. I underst...