I want to be able to define such a nice receive function in scala
sealed trait DoParent
case object DoThis extends DoParent
case object DoThat extends DoParent
object MyApp extends App {
val receive = {
case DoThis => println("dothis")
case DoThat => println("dothat")
}
receive(DoThis)
}
but it generates
missing parameter type for expanded function
The argument types of an anonymous function must be fully known. (SLS 8.5)
Expected type was: ?
val receive = {
^
I now I understand it asks me to add the type but i want the receive to look as neat and clean (define only the cases inside as shown without the types) as actors receive looks like, what am i missing?
thanks