|
|
|
|
|
Description |
The core of Yogurt, consisting of the Mud monad and all functions manipulating this monad.
|
|
Synopsis |
|
|
|
|
Types
|
|
|
The Mud monad is a simple state monad.
|
|
|
State internal to the Mud monad.
|
|
|
|
The initial state of the Mud monad.
|
|
|
The abstract Hook type. Two hooks are considered equal if they were created (using mkHook) at the same time. Hook h1 < hook h2 if h1 will match earlier than h2.
| Instances | |
|
|
|
Used to distinguish between messages going in different directions.
| Constructors | Local | The message is headed towards the user's terminal.
| Remote | The message is headed towards the remote MUD server.
|
| Instances | |
|
|
|
A Pattern is a regular expression.
|
|
|
|
|
|
Interval in milliseconds.
|
|
|
A Result is a consequence of executing a Mud program.
| Constructors | |
|
|
Hooks
|
|
A hook watches a channel for messages matching a specific regular expression. When a hook fires, the triggering message is consumed and the hook's action is executed. When a message doesn't trigger any hooks, it is sent on to its destination. A hook's action may query for match-specific data; see section Match Information. At most one hook fires for each message, unless the hook's action explicitly sends the message through trigger again. If several hooks match, only the hook with the highest priority fires. If there is still a tie, the hook that was defined last (using mkHook) fires.
|
|
|
Calls mkPrioHook with priority 0.
|
|
|
Creates and installs a hook that watches messages headed to the specified destination and match the specified pattern.
|
|
|
Saves a changed hook, or reactivates it.
|
|
|
Disables a hook.
|
|
|
Yields all current hooks in preferred firing order.
|
|
Hook record fields
|
|
Use these in combination with setHook to update hooks.
|
|
|
Yields the hook's priority.
|
|
|
Yields the destination this hook watches.
|
|
|
Yields the pattern messages must have for this hook to fire.
|
|
|
Yields the Mud program to execute when the hook fires.
|
|
Match information
|
|
Functions for querying the currently firing hook. These functions should only be called from within a hook's body.
|
|
|
Yields the hook that is currently firing.
|
|
|
Yields the message that triggered the currently firing hook.
|
|
|
Yields the part of the triggering message that comes before the matched pattern.
|
|
|
Yields the regex group from the matched pattern. group 0 yields the complete match; higher indices correspond to the parenthesized groups.
|
|
|
Yields the part of the triggering message that comes after the matched pattern.
|
|
Variables
|
|
|
Creates a variable with an initial value.
|
|
|
Updates a variable to a new value.
|
|
|
Yields the variable's current value.
|
|
modifyVar :: Var a -> (a -> a) -> Mud () | Source |
|
Updates the variable using the update function.
|
|
Timers
|
|
|
mkTimer interval prog creates a timer that executes prog every interval milliseconds.
|
|
|
Disables the timer.
|
|
|
Checks whether a timer is active.
|
|
|
Yields all currently active timers.
|
|
Timer record fields
|
|
|
Yields the timer's action.
|
|
|
Yields the timer's interval.
|
|
Triggering hooks
|
|
|
Short for triggerJust (const True).
|
|
|
If the message triggers a hook that passes the specified test, it is fired. Otherwise, the message is passed on to the destination using io.
|
|
|
Immediately write a message to a destination, without triggering hooks.
|
|
|
Yields all accumulated results and removes them from the state. Used by Network.Yogurt.Engine in runMud.
|
|
IO
|
|
|
Executes the IO action soon. The computation's result is passed to the function, and the resulting Mud computation is executed.
|
|
|
Invokes withIO, discarding the IO's result.
|
|
Produced by Haddock version 2.3.0 |