What techniques can I use in Scala to deal with long type parameter lists?
I am working on a little framework for running various types of games with different simulated environments. I am trying to keep certain parts of the framework relatively generic, so I am introducing various types as type parameters, such as the state of the environment, the game result, etc.
It all works quite well functionally and I do get the desired benefits of a type-safe yet generic framework. But the type signatures have grown to the point where it makes the code rather hard to read and refactoring it has become quite cumbersome. The signature of the top-level Simulator has eight type parameters and many of the primary types have three to five. Individual compiler type errors, since they list out the types of class or function parameters (which of course are also type-parameterized) seem to regularly run to a hundred lines.
Occasionally, but very rarely, I can omit the type parameters, e.g. on constructors. But in most cases at least one of the types wont be inferred so I end up having to insert the entire type signature.
Obviously this is not ideal and I am looking for ways to solve this problem. Any advice would be appreciated!