fsprojects-archive / zzarchive-Cricket

[ARCHIVED] An actor framework for F#
The Unlicense
152 stars 35 forks source link

Issue Stats Issue Stats

Cricket NuGet Status

Cricket is an actor library. The actor programming model is inherently concurrent, an actor is a primitive that wraps a computation, the computation is ran by sending messages to the actor. The actor can then respond to the receipt of the message by executing one or more of the following actions (possibly concurrently),

Currently there are a couple of actor libraries on the .NET platform

Cricket in no way aims to be a clone of either of these however it does draw on the ideas in all of the above frameworks as well as Erlang and OTP. Cricket aims to be as simple and safe to use as possible hopefully making it very difficult for you to shoot or self in the foot.

Building

Simple Example

#r "Cricket.dll"
open Cricket

ActorHost.Start()

type Say =
    | Hello
    | HelloWorld
    | Name of string

let greeter = 
    actor {
        name "greeter"
        body (
            let rec loop() = messageHandler {
                let! msg = Message.receive()

                match msg with
                | Hello ->  printfn "Hello"
                | HelloWorld -> printfn "Hello World"
                | Name name -> printfn "Hello, %s" name
                return! loop()

            }
            loop())
    } |> Actor.spawn

greeter <-- Name("from F# Actor") 

Maintainer(s)

The default maintainer account for projects under "fsprojects" is @fsprojectsgit - F# Community Project Incubation Space (repo management)