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

Safe HaskellNone

Language.Nomyx.Events

Description

All the building blocks to allow rules to build events.

Synopsis

Documentation

data Event a whereSource

events names

Instances

data EventData a whereSource

data associated with each events

type Msg a = Event (Message a)Source

onEvent :: (Typeable e, Show e, Eq e) => Event e -> ((EventNumber, EventData e) -> Nomex ()) -> Nomex EventNumberSource

register a callback on an event

onEvent_ :: forall e. (Typeable e, Show e, Eq e) => Event e -> (EventData e -> Nomex ()) -> Nomex EventNumberSource

register a callback on an event, disregard the event number

onEventOnce :: (Typeable e, Show e, Eq e) => Event e -> (EventData e -> Nomex ()) -> Nomex EventNumberSource

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

delAllEvents :: (Typeable e, Show e, Eq e) => Event e -> Nomex ()Source

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 -> (MsgData m -> Nomex ()) -> Nomex EventNumberSource

subscribe on a message

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

on the provided schedule, the supplied function will be called

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