trait ActorRef[-T] {
def !(msg: T): Unit = ()
}
class Behavior[T]
object Behaviors {
def receive[T](onMessage: T => Behavior[T]): Behavior[T] = ???
def same[T]: Behavior[T] = ???
}
sealed trait Command
final case class Spawn[T](behavior: Behavior[T], replyTo: ActorRef[ActorRef[T]]) extends Command
object Test {
def spawn[U](behavior: Behavior[U]): ActorRef[U] = ???
def apply(): Behavior[Command] = Behaviors.receive { msg =>
msg match {
case Spawn(b: Behavior[t], replyTo) =>
def sp(): ActorRef[t] = if (toString == "") sp() else spawn(b)
replyTo ! sp()
Behaviors.same
}
}
}
Last active
May 21, 2021 12:30
-
-
Save lrytz/6ac5b22647f6e465460f36548e7483ce to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment