Can akka typed actors work on polymorphic types ?
For example, can I create an actor that carries out the following type safe operation :
trait TypedActorInterface{
def head[T](l:List[T]):T
}
?
or create polymorphic Typed Actor:
trait TypedActorInterfacePolymorphic[T]{
def getT:T
}
?
or having a type class constraint :
trait TypedActorWithTypeClass{
def show[T:Showable]:String
}
?
Are these possible with Typed Actors ?
My guess is that, at least type class constraints are not possible because then that would involve macros/reflection and other magic (because type information would need to be serialized/deserialized automatically).
Maybe the other two are possible, not sure though.
As you can see in example you don't need to create one more trait for a typed actor. Typed actor is just a proxy. The code outside of the actor knows nothing about actors behind the service.
I don't see any problems with proxying polymorphic traits if a compiler has enough information in place. Please provide your attempts and let's see what went wrong.