Using types to model arbitrary constraints for compile-time checking
问题 Given the strong type system of Scala, I had an ambitious project which I'm about to abandon now because the effort to usefulness ratio seems to be too high. Basically I have some graph elements ( GE ) and they correspond to sound processes which are carried out at a given calculation rate . Graph elements are composed from other graph elements forming their inputs. Now there are rather arbitrary constraints on the inputs' rates. In the source language (SuperCollider) the rates are checked at