trait JsonOps[J] {
type ObjectFields
def partitionObjectFields(fields: ObjectFields, fieldNames: List[String]): (ObjectFields, ObjectFields)
}
def compilerNoLikey[J](stuff: ops.ObjectFields)(implicit ops:JsonOps[J]) = {}
def compilerLikey[J](stuff: Any)(implicit ops:JsonOps[J]) = {
val stuff2 = stuff.asInstanceOf[ops.ObjectFields]
}
You can see my intent here. I define a type in JsonOps to encapsulate a structure dependant on J. Then later when I want to use this, I have a function that implicitly passes a JsonOps[J] object and also a parameter of type ObjectFields.
Problem is, ObjectFields is defined in ops, which occurs after the stuff in the signature.
How can I unscramble this?
The second def works, but I don't like passing Any around. I'd like the compiler to be able to check what's being passed in.