gore-and-ash-actor-1.2.2.0: Gore&Ash engine extension that implements actor style of programming

Copyright(c) Anton Gushcha, 2015-2016
LicenseBSD3
Maintainerncrashed@gmail.com
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Game.GoreAndAsh.Actor.Message

Description

 

Synopsis

Documentation

class Typeable objectId => ActorMessage objectId where Source #

The typeclass separates message API's of different type of actors

In general you don't want to have one global type to handle all possible types of messages, it will break modularity. Thats why you creates (with newtype) separate types of ids for each actor and statically binds message type (usually algebraic type) to the id.

The class implies that your id is some integer type, but it could be not. Just provide way to stable convertion of you id to integer and vice-versa.

Minimal complete definition

fromCounter, toCounter

Associated Types

type ActorMessageType objectId :: * Source #

Binded message type, mailbox with id type of objectId would accept only this message type

Methods

fromCounter :: Int -> objectId Source #

Convertion from global counter. Don't use it in client code as it could break type safety.

toCounter :: objectId -> Int Source #

Convertion to global counter. Don't use it in client code as it could break type safety.

actorFingerprint :: forall proxy a. ActorMessage a => proxy a -> HashableTypeRep Source #

Returns hashable fingerprint of actor that is stable across applications (unique by type name)