Skip to content

Instantly share code, notes, and snippets.

@rogeralsing
Created February 14, 2015 15:54
Show Gist options
  • Save rogeralsing/80bafe4d9a7d9fe5f2db to your computer and use it in GitHub Desktop.
Save rogeralsing/80bafe4d9a7d9fe5f2db to your computer and use it in GitHub Desktop.
open Akka.FSharp
open Akka
open Akka.Configuration
let system = System.create "my-system" (Configuration.defaultConfig())
let aref =
spawn system "my-actor"
(fun mailbox ->
let rec loop(state) = actor {
let! message = mailbox.Receive()
//pseudo code:
// receive a message with upgraded code, extract the new state loop and loop with that
// I don't do F# so this is probably wrong syntax :-)
//
//match message with
//| Upgrade(newloop) -> return! newloop(state)
//
return! loop(state)
}
loop(...initial state...))
aref <! Upgrade(..codequotation..)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment