假设以下代码:
override x.OnReceive message =
match message with
| :? SomeActorMessages as m ->
match m with
| Greet(name) -> Console.WriteLine("Hello {0}",name)
| Hi -> Console.WriteLine("Hello from F#!")
| _ -> failwith "unknown message"
“消息”是 System.Object 类型的地方,我可以做些什么来使模式匹配更好?例如一些通用的活动模式或一些这样的?
也许这个问题太短了,但我只是想看看是否有办法使上述语法更好