2 people like it.

Actors with control actor

Actors with control actor. No mutable state.

  1: 
  2: 
  3: 
  4: 
  5: 
  6: 
  7: 
  8: 
  9: 
 10: 
 11: 
 12: 
 13: 
 14: 
 15: 
 16: 
 17: 
 18: 
 19: 
 20: 
 21: 
 22: 
 23: 
 24: 
 25: 
 26: 
 27: 
 28: 
 29: 
 30: 
 31: 
 32: 
 33: 
 34: 
 35: 
 36: 
 37: 
 38: 
 39: 
 40: 
 41: 
 42: 
 43: 
 44: 
 45: 
 46: 
 47: 
 48: 
 49: 
 50: 
 51: 
 52: 
 53: 
 54: 
 55: 
 56: 
 57: 
 58: 
 59: 
 60: 
 61: 
 62: 
 63: 
 64: 
 65: 
 66: 
 67: 
 68: 
 69: 
 70: 
 71: 
 72: 
 73: 
 74: 
 75: 
 76: 
 77: 
 78: 
 79: 
 80: 
 81: 
 82: 
 83: 
 84: 
 85: 
 86: 
 87: 
 88: 
 89: 
 90: 
 91: 
 92: 
 93: 
 94: 
 95: 
 96: 
 97: 
 98: 
 99: 
100: 
101: 
102: 
103: 
104: 
105: 
106: 
107: 
108: 
109: 
110: 
111: 
112: 
113: 
114: 
115: 
116: 
117: 
118: 
119: 
120: 
121: 
122: 
123: 
124: 
125: 
126: 
127: 
128: 
129: 
130: 
131: 
132: 
133: 
134: 
135: 
136: 
137: 
138: 
139: 
140: 
141: 
142: 
143: 
144: 
145: 
146: 
147: 
148: 
149: 
150: 
151: 
152: 
153: 
154: 
155: 
156: 
157: 
158: 
159: 
160: 
161: 
162: 
163: 
164: 
165: 
166: 
167: 
168: 
169: 
170: 
171: 
172: 
173: 
174: 
175: 
176: 
177: 
178: 
179: 
180: 
181: 
182: 
183: 
184: 
185: 
186: 
187: 
188: 
189: 
190: 
191: 
192: 
193: 
194: 
195: 
196: 
197: 
198: 
199: 
200: 
201: 
202: 
203: 
    open System
    open System.Threading
    open System.IO
    open Microsoft.FSharp.Control.WebExtensions

    type Agent<'T> = MailboxProcessor<'T>

    type SingleAgent<'T> =
    | Set of 'T
    | Get of AsyncReplyChannel<List<'T>>

    type Identifier = 
    | RoomId of Guid // Room is a container (e.g. a game)
    | UserId of Guid // User (e.g. a player)
    
    type ControlMethods<'T> =
    | Create of Identifier * Agent<'T>
    | Read of Identifier * AsyncReplyChannel<Option<Agent<'T>>>
    | Delete of Identifier
    | ReadAllIds of AsyncReplyChannel<List<Identifier>>
    | ReadAllOf of (Identifier -> bool)*AsyncReplyChannel<List<Identifier * Agent<'T>>>
    
    let internal notifyError = new Event<_>()
    let public OnError (watch:Action<_>) =
        notifyError.Publish |> Observable.add(fun e -> watch.Invoke(e))

    // Error queue agent
    let internal supervisor = 
        Agent<System.Exception>.Start(fun inbox ->
            async { while true do 
                    let! err = inbox.Receive()
                    notifyError.Trigger(err)
                    printfn "an error occurred in an agent: %A" err })

    // Agent for storing other agents
    let internal control = new Agent<ControlMethods<SingleAgent<obj>>>(fun msg ->
        let rec msgPassing all =
            async { 
                let! c = msg.Receive()
                match c with
                | Create(id,agent) ->
                    return! msgPassing((id,agent)::all)
                | Read(id,reply) ->
                    let response = 
                        all 
                        |> List.filter (fun i -> (fst i) = id) 
                    match response with
                    | [] -> reply.Reply(None)
                    | h::t -> reply.Reply(Some(snd h))
                    return! msgPassing(all)
                | Delete(id) -> 
                    let removed = 
                        all 
                        |> List.filter (fun i -> (fst i) <> id) 
                    return! msgPassing(removed)
                | ReadAllIds(reply) -> 
                    let agents = all |> List.map fst
                    reply.Reply(agents)
                    return! msgPassing(all)
                | ReadAllOf(myfilter, reply) -> 
                    let agents = 
                        all
                        |> List.filter(fun i -> myfilter(fst i)) 
                    reply.Reply(agents)
                    return! msgPassing(all)
            }
        msgPassing [])
    control.Error.Add(fun error -> supervisor.Post error)
    control.Start()

    /// Create a new actor (like room or user)
    let public CreateNewItem id initialState = 
        let agent = new Agent<_>(fun msg ->
            let rec msgPassing all =
                async { 
                    let! r = msg.Receive()
                    match r with
                    | Set(i) ->
                        //printf "%s" r
                        //let r = f(c)
                        return! msgPassing(i::all)
                    | Get(reply) ->
                        reply.Reply(all)
                        return! msgPassing(all)
                }
            msgPassing [])
        (id, agent) |> Create |> control.Post
        agent.Error.Add(fun error -> supervisor.Post error)
        agent.Post(Set(initialState))
        agent.Start()
        id

    /// Fetch agent form the control agent
    let internal fetchAgent id = control.PostAndReply(fun a -> Read(id, a))

    /// Insert item state
    let public AddAction id msg =
        match fetchAgent id with
        | Some(agent) -> 
            agent.Post(Set(msg))
            true
        | _ -> false

    /// Get item state
    let public ShowItemState id =
        let result = 
            match fetchAgent id with
            | Some(agent) -> agent.PostAndReply(fun msg -> Get(msg))
            | _ -> []
        result |> List.toSeq

    /// This just removes the reference
    let public Delete id =
        Delete(id) |> control.Post

    /// Return all states
    let public ReturnAllOf(i) =
        let rec fetch (r:list<Identifier*Agent<_>>) (acc:list<Identifier*seq<_>>) =
            match r with
            | [] -> acc
            | iagent::t -> 
                let agent = snd iagent
                let one = (fst iagent), agent.PostAndReply(fun msg -> Get(msg)) |> List.toSeq
                fetch t (one :: acc) 

        let result = control.PostAndReply(fun a -> ReadAllOf(i, a)) 
        fetch result []
        |> List.toSeq

    /// Return all states
    let public ReturnAll() = ReturnAllOf(fun _ -> true)

    // --------------------------------------------------------------------------------

    ///Some helper functions for domain "game"
    let internal isRoom = function | RoomId(_) -> true | _ -> false
    let internal isUser = function | UserId(_) -> true | _ -> false

    let public ReturnAllGames() =
        control.PostAndReply(fun a -> ReadAllIds(a)) 
        |> List.filter(isRoom)
        |> List.toSeq

    let public ReturnUserData() = ReturnAllOf(isUser)
    let public ReturnGameData() = ReturnAllOf(isRoom)

    let NewUser info = 
        let id = Guid.NewGuid() |> UserId
        CreateNewItem id info

    type Actions =
    | PlayerJoin of Identifier
    | VisitorJoin of Identifier
    | PlayerMakeMove of Identifier*obj
    | SendMsgToAll of Identifier*string
    | Leave of Identifier

    type UserActions =
    | PlayedGame of Identifier*int//opponent, result
    | RegisterAsUser of string*int*int*obj //id, name, games, scores, ...

    let NewGameRoom player = 
        let a = player |> Actions.PlayerJoin
        let id = Guid.NewGuid() |> RoomId
        CreateNewItem id a 

    // --------------------------------------------------------------------------------

(*
    //Add a player
    let player1 = ("tuomas", 0, 0, obj()) |> UserActions.RegisterAsUser |> NewUser

    //Create new game
    let game1 = player1 |> NewGameRoom

    //Add another player    
    let player2 = ("toka", 0, 0, obj()) |> UserActions.RegisterAsUser |> NewUser

    //AddAction will add any object to any actor.
    //There is no limit for objects, but it is easier to follow if 
    //objects are custom types like Actions or UserActions here

    //Adding info to player1:
    UserActions.PlayedGame(player2, 1) |> AddAction player1 

    //Adding info to game1:
    Actions.SendMsgToAll(player1, "hello") |> AddAction game1 
    Actions.PlayerMakeMove(player1, (8, 3)) |> AddAction game1 
    player2 |> Actions.PlayerJoin |> AddAction game1 

    //Show item history/state:
    ShowItemState game1
    ShowItemState player1


    let anotherGame = 
        let newPlayer = ("simppa", 0, 0, obj()) |> UserActions.RegisterAsUser |> NewUser
        let game2 = newPlayer |> NewGameRoom
        Actions.SendMsgToAll(newPlayer, "hello") |> AddAction game2 
    ReturnAll()

    Delete game1
*)
namespace System
namespace System.Threading
namespace System.IO
namespace Microsoft
namespace Microsoft.FSharp
namespace Microsoft.FSharp.Control
module WebExtensions

from Microsoft.FSharp.Control
type Agent<'T> = MailboxProcessor<'T>

Full name: Script.Agent<_>
Multiple items
type MailboxProcessor<'Msg> =
  interface IDisposable
  new : body:(MailboxProcessor<'Msg> -> Async<unit>) * ?cancellationToken:CancellationToken -> MailboxProcessor<'Msg>
  member Post : message:'Msg -> unit
  member PostAndAsyncReply : buildMessage:(AsyncReplyChannel<'Reply> -> 'Msg) * ?timeout:int -> Async<'Reply>
  member PostAndReply : buildMessage:(AsyncReplyChannel<'Reply> -> 'Msg) * ?timeout:int -> 'Reply
  member PostAndTryAsyncReply : buildMessage:(AsyncReplyChannel<'Reply> -> 'Msg) * ?timeout:int -> Async<'Reply option>
  member Receive : ?timeout:int -> Async<'Msg>
  member Scan : scanner:('Msg -> Async<'T> option) * ?timeout:int -> Async<'T>
  member Start : unit -> unit
  member TryPostAndReply : buildMessage:(AsyncReplyChannel<'Reply> -> 'Msg) * ?timeout:int -> 'Reply option
  ...

Full name: Microsoft.FSharp.Control.MailboxProcessor<_>

--------------------
new : body:(MailboxProcessor<'Msg> -> Async<unit>) * ?cancellationToken:CancellationToken -> MailboxProcessor<'Msg>
type SingleAgent<'T> =
  | Set of 'T
  | Get of AsyncReplyChannel<List<'T>>

Full name: Script.SingleAgent<_>
Multiple items
union case SingleAgent.Set: 'T -> SingleAgent<'T>

--------------------
module Set

from Microsoft.FSharp.Collections

--------------------
type Set<'T (requires comparison)> =
  interface IComparable
  interface IEnumerable
  interface IEnumerable<'T>
  interface ICollection<'T>
  new : elements:seq<'T> -> Set<'T>
  member Add : value:'T -> Set<'T>
  member Contains : value:'T -> bool
  override Equals : obj -> bool
  member IsProperSubsetOf : otherSet:Set<'T> -> bool
  member IsProperSupersetOf : otherSet:Set<'T> -> bool
  ...

Full name: Microsoft.FSharp.Collections.Set<_>

--------------------
new : elements:seq<'T> -> Set<'T>
union case SingleAgent.Get: AsyncReplyChannel<List<'T>> -> SingleAgent<'T>
type AsyncReplyChannel<'Reply>
member Reply : value:'Reply -> unit

Full name: Microsoft.FSharp.Control.AsyncReplyChannel<_>
Multiple items
module List

from Microsoft.FSharp.Collections

--------------------
type List<'T> =
  | ( [] )
  | ( :: ) of Head: 'T * Tail: 'T list
  interface IEnumerable
  interface IEnumerable<'T>
  member Head : 'T
  member IsEmpty : bool
  member Item : index:int -> 'T with get
  member Length : int
  member Tail : 'T list
  static member Cons : head:'T * tail:'T list -> 'T list
  static member Empty : 'T list

Full name: Microsoft.FSharp.Collections.List<_>
type Identifier =
  | RoomId of Guid
  | UserId of Guid

Full name: Script.Identifier
union case Identifier.RoomId: Guid -> Identifier
Multiple items
type Guid =
  struct
    new : b:byte[] -> Guid + 4 overloads
    member CompareTo : value:obj -> int + 1 overload
    member Equals : o:obj -> bool + 1 overload
    member GetHashCode : unit -> int
    member ToByteArray : unit -> byte[]
    member ToString : unit -> string + 2 overloads
    static val Empty : Guid
    static member NewGuid : unit -> Guid
    static member Parse : input:string -> Guid
    static member ParseExact : input:string * format:string -> Guid
    ...
  end

Full name: System.Guid

--------------------
Guid()
Guid(b: byte []) : unit
Guid(g: string) : unit
Guid(a: int, b: int16, c: int16, d: byte []) : unit
Guid(a: uint32, b: uint16, c: uint16, d: byte, e: byte, f: byte, g: byte, h: byte, i: byte, j: byte, k: byte) : unit
Guid(a: int, b: int16, c: int16, d: byte, e: byte, f: byte, g: byte, h: byte, i: byte, j: byte, k: byte) : unit
union case Identifier.UserId: Guid -> Identifier
type ControlMethods<'T> =
  | Create of Identifier * Agent<'T>
  | Read of Identifier * AsyncReplyChannel<Option<Agent<'T>>>
  | Delete of Identifier
  | ReadAllIds of AsyncReplyChannel<List<Identifier>>
  | ReadAllOf of (Identifier -> bool) * AsyncReplyChannel<List<Identifier * Agent<'T>>>

Full name: Script.ControlMethods<_>
union case ControlMethods.Create: Identifier * Agent<'T> -> ControlMethods<'T>
union case ControlMethods.Read: Identifier * AsyncReplyChannel<Option<Agent<'T>>> -> ControlMethods<'T>
module Option

from Microsoft.FSharp.Core
union case ControlMethods.Delete: Identifier -> ControlMethods<'T>
union case ControlMethods.ReadAllIds: AsyncReplyChannel<List<Identifier>> -> ControlMethods<'T>
union case ControlMethods.ReadAllOf: (Identifier -> bool) * AsyncReplyChannel<List<Identifier * Agent<'T>>> -> ControlMethods<'T>
type bool = Boolean

Full name: Microsoft.FSharp.Core.bool
val internal notifyError : Event<Exception>

Full name: Script.notifyError
Multiple items
module Event

from Microsoft.FSharp.Control

--------------------
type Event<'T> =
  new : unit -> Event<'T>
  member Trigger : arg:'T -> unit
  member Publish : IEvent<'T>

Full name: Microsoft.FSharp.Control.Event<_>

--------------------
type Event<'Delegate,'Args (requires delegate and 'Delegate :> Delegate)> =
  new : unit -> Event<'Delegate,'Args>
  member Trigger : sender:obj * args:'Args -> unit
  member Publish : IEvent<'Delegate,'Args>

Full name: Microsoft.FSharp.Control.Event<_,_>

--------------------
new : unit -> Event<'T>

--------------------
new : unit -> Event<'Delegate,'Args>
val OnError : watch:Action<Exception> -> unit

Full name: Script.OnError
val watch : Action<Exception>
Multiple items
type Action =
  delegate of unit -> unit

Full name: System.Action

--------------------
type Action<'T> =
  delegate of 'T -> unit

Full name: System.Action<_>

--------------------
type Action<'T1,'T2> =
  delegate of 'T1 * 'T2 -> unit

Full name: System.Action<_,_>

--------------------
type Action<'T1,'T2,'T3> =
  delegate of 'T1 * 'T2 * 'T3 -> unit

Full name: System.Action<_,_,_>

--------------------
type Action<'T1,'T2,'T3,'T4> =
  delegate of 'T1 * 'T2 * 'T3 * 'T4 -> unit

Full name: System.Action<_,_,_,_>

--------------------
type Action<'T1,'T2,'T3,'T4,'T5> =
  delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 -> unit

Full name: System.Action<_,_,_,_,_>

--------------------
type Action<'T1,'T2,'T3,'T4,'T5,'T6> =
  delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 -> unit

Full name: System.Action<_,_,_,_,_,_>

--------------------
type Action<'T1,'T2,'T3,'T4,'T5,'T6,'T7> =
  delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 -> unit

Full name: System.Action<_,_,_,_,_,_,_>

--------------------
type Action<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8> =
  delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 -> unit

Full name: System.Action<_,_,_,_,_,_,_,_>

--------------------
type Action<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9> =
  delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 -> unit

Full name: System.Action<_,_,_,_,_,_,_,_,_>

--------------------
type Action<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10> =
  delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 -> unit

Full name: System.Action<_,_,_,_,_,_,_,_,_,_>

--------------------
type Action<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10,'T11> =
  delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 -> unit

Full name: System.Action<_,_,_,_,_,_,_,_,_,_,_>

--------------------
type Action<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10,'T11,'T12> =
  delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 -> unit

Full name: System.Action<_,_,_,_,_,_,_,_,_,_,_,_>

--------------------
type Action<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10,'T11,'T12,'T13> =
  delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 -> unit

Full name: System.Action<_,_,_,_,_,_,_,_,_,_,_,_,_>

--------------------
type Action<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10,'T11,'T12,'T13,'T14> =
  delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 -> unit

Full name: System.Action<_,_,_,_,_,_,_,_,_,_,_,_,_,_>

--------------------
type Action<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10,'T11,'T12,'T13,'T14,'T15> =
  delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 * 'T15 -> unit

Full name: System.Action<_,_,_,_,_,_,_,_,_,_,_,_,_,_,_>

--------------------
type Action<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10,'T11,'T12,'T13,'T14,'T15,'T16> =
  delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 * 'T15 * 'T16 -> unit

Full name: System.Action<_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_>
property Event.Publish: IEvent<Exception>
module Observable

from Microsoft.FSharp.Control
val add : callback:('T -> unit) -> source:IObservable<'T> -> unit

Full name: Microsoft.FSharp.Control.Observable.add
val e : Exception
Action.Invoke(obj: Exception) : unit
val internal supervisor : MailboxProcessor<Exception>

Full name: Script.supervisor
Multiple items
type Exception =
  new : unit -> Exception + 2 overloads
  member Data : IDictionary
  member GetBaseException : unit -> Exception
  member GetObjectData : info:SerializationInfo * context:StreamingContext -> unit
  member GetType : unit -> Type
  member HelpLink : string with get, set
  member InnerException : Exception
  member Message : string
  member Source : string with get, set
  member StackTrace : string
  ...

Full name: System.Exception

--------------------
Exception() : unit
Exception(message: string) : unit
Exception(message: string, innerException: exn) : unit
val inbox : MailboxProcessor<Exception>
val async : AsyncBuilder

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.async
val err : Exception
member MailboxProcessor.Receive : ?timeout:int -> Async<'Msg>
member Event.Trigger : arg:'T -> unit
val printfn : format:Printf.TextWriterFormat<'T> -> 'T

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.printfn
val internal control : Agent<ControlMethods<SingleAgent<obj>>>

Full name: Script.control
type obj = Object

Full name: Microsoft.FSharp.Core.obj
val msg : MailboxProcessor<ControlMethods<SingleAgent<obj>>>
val msgPassing : ((Identifier * Agent<SingleAgent<obj>>) list -> Async<'a>)
val all : (Identifier * Agent<SingleAgent<obj>>) list
val c : ControlMethods<SingleAgent<obj>>
val id : Identifier
val agent : Agent<SingleAgent<obj>>
val reply : AsyncReplyChannel<Option<Agent<SingleAgent<obj>>>>
val response : (Identifier * Agent<SingleAgent<obj>>) list
val filter : predicate:('T -> bool) -> list:'T list -> 'T list

Full name: Microsoft.FSharp.Collections.List.filter
val i : Identifier * Agent<SingleAgent<obj>>
val fst : tuple:('T1 * 'T2) -> 'T1

Full name: Microsoft.FSharp.Core.Operators.fst
member AsyncReplyChannel.Reply : value:'Reply -> unit
union case Option.None: Option<'T>
val h : Identifier * Agent<SingleAgent<obj>>
val t : (Identifier * Agent<SingleAgent<obj>>) list
union case Option.Some: Value: 'T -> Option<'T>
val snd : tuple:('T1 * 'T2) -> 'T2

Full name: Microsoft.FSharp.Core.Operators.snd
val removed : (Identifier * Agent<SingleAgent<obj>>) list
val reply : AsyncReplyChannel<List<Identifier>>
val agents : Identifier list
val map : mapping:('T -> 'U) -> list:'T list -> 'U list

Full name: Microsoft.FSharp.Collections.List.map
val myfilter : (Identifier -> bool)
val reply : AsyncReplyChannel<List<Identifier * Agent<SingleAgent<obj>>>>
val agents : (Identifier * Agent<SingleAgent<obj>>) list
event MailboxProcessor.Error: IEvent<Handler<Exception>,Exception>
member IObservable.Add : callback:('T -> unit) -> unit
val error : Exception
member MailboxProcessor.Post : message:'Msg -> unit
member MailboxProcessor.Start : unit -> unit
val CreateNewItem : id:Identifier -> initialState:obj -> Identifier

Full name: Script.CreateNewItem


 Create a new actor (like room or user)
val initialState : obj
val msg : MailboxProcessor<SingleAgent<obj>>
val msgPassing : (obj list -> Async<'a>)
val all : obj list
val r : SingleAgent<obj>
val i : obj
val reply : AsyncReplyChannel<List<obj>>
val internal fetchAgent : id:Identifier -> Option<Agent<SingleAgent<obj>>>

Full name: Script.fetchAgent


 Fetch agent form the control agent
member MailboxProcessor.PostAndReply : buildMessage:(AsyncReplyChannel<'Reply> -> 'Msg) * ?timeout:int -> 'Reply
val a : AsyncReplyChannel<Option<Agent<SingleAgent<obj>>>>
val AddAction : id:Identifier -> msg:obj -> bool

Full name: Script.AddAction


 Insert item state
val msg : obj
val ShowItemState : id:Identifier -> seq<obj>

Full name: Script.ShowItemState


 Get item state
val result : List<obj>
val msg : AsyncReplyChannel<List<obj>>
val toSeq : list:'T list -> seq<'T>

Full name: Microsoft.FSharp.Collections.List.toSeq
val Delete : id:Identifier -> unit

Full name: Script.Delete


 This just removes the reference
val ReturnAllOf : i:(Identifier -> bool) -> seq<Identifier * seq<obj>>

Full name: Script.ReturnAllOf


 Return all states
val i : (Identifier -> bool)
val fetch : ((Identifier * Agent<SingleAgent<'a>>) list -> (Identifier * seq<'a>) list -> (Identifier * seq<'a>) list)
val r : (Identifier * Agent<SingleAgent<'a>>) list
type 'T list = List<'T>

Full name: Microsoft.FSharp.Collections.list<_>
val acc : (Identifier * seq<'a>) list
Multiple items
val seq : sequence:seq<'T> -> seq<'T>

Full name: Microsoft.FSharp.Core.Operators.seq

--------------------
type seq<'T> = Collections.Generic.IEnumerable<'T>

Full name: Microsoft.FSharp.Collections.seq<_>
val iagent : Identifier * Agent<SingleAgent<'a>>
val t : (Identifier * Agent<SingleAgent<'a>>) list
val agent : Agent<SingleAgent<'a>>
val one : Identifier * seq<'a>
val msg : AsyncReplyChannel<List<'a>>
val result : List<Identifier * Agent<SingleAgent<obj>>>
val a : AsyncReplyChannel<List<Identifier * Agent<SingleAgent<obj>>>>
val ReturnAll : unit -> seq<Identifier * seq<obj>>

Full name: Script.ReturnAll


 Return all states
val internal isRoom : _arg1:Identifier -> bool

Full name: Script.isRoom


Some helper functions for domain "game"
val internal isUser : _arg1:Identifier -> bool

Full name: Script.isUser
val ReturnAllGames : unit -> seq<Identifier>

Full name: Script.ReturnAllGames
val a : AsyncReplyChannel<List<Identifier>>
val ReturnUserData : unit -> seq<Identifier * seq<obj>>

Full name: Script.ReturnUserData
val ReturnGameData : unit -> seq<Identifier * seq<obj>>

Full name: Script.ReturnGameData
val NewUser : info:'a -> Identifier

Full name: Script.NewUser
val info : 'a
Guid.NewGuid() : Guid
type Actions =
  | PlayerJoin of Identifier
  | VisitorJoin of Identifier
  | PlayerMakeMove of Identifier * obj
  | SendMsgToAll of Identifier * string
  | Leave of Identifier

Full name: Script.Actions
union case Actions.PlayerJoin: Identifier -> Actions
union case Actions.VisitorJoin: Identifier -> Actions
union case Actions.PlayerMakeMove: Identifier * obj -> Actions
union case Actions.SendMsgToAll: Identifier * string -> Actions
Multiple items
val string : value:'T -> string

Full name: Microsoft.FSharp.Core.Operators.string

--------------------
type string = String

Full name: Microsoft.FSharp.Core.string
union case Actions.Leave: Identifier -> Actions
type UserActions =
  | PlayedGame of Identifier * int
  | RegisterAsUser of string * int * int * obj

Full name: Script.UserActions
union case UserActions.PlayedGame: Identifier * int -> UserActions
Multiple items
val int : value:'T -> int (requires member op_Explicit)

Full name: Microsoft.FSharp.Core.Operators.int

--------------------
type int = int32

Full name: Microsoft.FSharp.Core.int

--------------------
type int<'Measure> = int

Full name: Microsoft.FSharp.Core.int<_>
union case UserActions.RegisterAsUser: string * int * int * obj -> UserActions
val NewGameRoom : player:Identifier -> Identifier

Full name: Script.NewGameRoom
val player : Identifier
val a : Actions
Raw view Test code New version

More information

Link:http://fssnip.net/kI
Posted:10 years ago
Author:Tuomas Hietanen
Tags: actors , agent , mailboxprocessor