Nomyx-Language-0.7.3: Language to express rules for Nomic

Safe HaskellNone
LanguageHaskell98

Language.Nomyx.Events

Description

All the building blocks to allow rules to build events.

Synopsis

Documentation

onEvent :: (Typeable e, Show e) => Event e -> ((EventNumber, e) -> Nomex ()) -> Nomex EventNumber Source

register a callback on an event

onEvent_ :: (Typeable e, Show e) => Event e -> (e -> Nomex ()) -> Nomex EventNumber Source

register a callback on an event, disregard the event number

onEventOnce :: (Typeable e, Show e) => Event e -> (e -> Nomex ()) -> Nomex EventNumber Source

set an handler for an event that will be triggered only once

sendMessage :: (Typeable a, Show a) => Msg a -> a -> Nomex () Source

broadcast a message that can be catched by another rule

onMessage :: (Typeable m, Show m) => Msg m -> (m -> Nomex ()) -> Nomex EventNumber Source

subscribe on a message

onMessageOnce :: (Typeable m, Show m) => Msg m -> (m -> Nomex ()) -> Nomex EventNumber Source

schedule :: Schedule Freq -> (UTCTime -> Nomex ()) -> Nomex () Source

on the provided schedule, the supplied function will be called

schedule' :: [UTCTime] -> (UTCTime -> Nomex ()) -> Nomex () Source

getCurrentTime :: NomexNE UTCTime Source

get the current time as UTCTime

timeEvent :: UTCTime -> Event UTCTime Source

Build an event firing at a specific time

messageEvent :: Typeable a => Msg a -> Event a Source

Build a message event, that can be intercepted by another rule this is useful for message-passing style of communication

victoryEvent :: Event VictoryInfo Source

Build a event firing when the victory condition is changed

playerEvent :: Player -> Event PlayerInfo Source

Build a event firing when a player arrives or leaves

ruleEvent :: RuleEvent -> Event RuleInfo Source

Build a event firing when an action is made on a rule

liftEvent :: NomexNE a -> Event a Source

Build a event firing immediatly, yelding the value of the NomexNE