Yogurt-0.2: A MUD client librarySource codeContentsIndex
Network.Yogurt.Utils
Contents
Re-exports
Hook and timer derivatives
Sending messages
Logging
Miscellaneous
Description
Convenience functions on top of Yogurt.Mud.
Synopsis
module Network.Yogurt.Mud
mkTrigger :: Pattern -> Mud a -> Mud Hook
mkTriggerOnce :: Pattern -> Mud a -> Mud Hook
mkAlias :: String -> String -> Mud Hook
mkArgAlias :: String -> ([String] -> String) -> Mud Hook
mkCommand :: String -> Mud a -> Mud Hook
mkTimerOnce :: Interval -> Mud a -> Mud Timer
receive :: String -> Mud ()
sendln :: String -> Mud ()
echo :: String -> Mud ()
echoln :: String -> Mud ()
echorln :: String -> Mud ()
bell :: Mud ()
type Logger = (Hook, Hook)
startLogging :: String -> Mud Logger
stopLogging :: Logger -> Mud ()
matchMore :: Mud ()
matchMoreOn :: String -> Mud ()
matchMoreOn' :: String -> Mud ()
system :: String -> Mud ()
Re-exports
module Network.Yogurt.Mud
Hook and timer derivatives
mkTrigger :: Pattern -> Mud a -> Mud HookSource
Creates a hook that watches messages headed to the terminal. When fired, the message is passed on to the terminal and the action is executed.
mkTriggerOnce :: Pattern -> Mud a -> Mud HookSource
Like mkTrigger, but fires at most once.
mkAlias :: String -> String -> Mud HookSource
mkAlias command subst creates a hook that watches messages headed to the remote MUD. If the message is or starts with the word command, the command is replaced by subst before being sent to the MUD.
mkArgAlias :: String -> ([String] -> String) -> Mud HookSource
Like mkAlias, mkArgAlias command subst creates a hook that watches messages headed to the remote MUD. But here the whole message is substituted instead of just the first command word, and the substitution depends on the command's arguments.
mkCommand :: String -> Mud a -> Mud HookSource
Like mkAlias, but instead of substituting the command, a program is executed.
mkTimerOnce :: Interval -> Mud a -> Mud TimerSource
Creates a timer that fires only once.
Sending messages
receive :: String -> Mud ()Source
Sends a message to the terminal, triggering hooks.
sendln :: String -> Mud ()Source
Sends a message appended with a newline character to the MUD, triggering hooks.
echo :: String -> Mud ()Source
Sends a message to the terminal, without triggering hooks.
echoln :: String -> Mud ()Source
Sends a message appended with a newline character to the terminal, without triggering hooks.
echorln :: String -> Mud ()Source
Sends a message appended with a newline character to the MUD, without triggering hooks.
bell :: Mud ()Source
Sends a bell character to the terminal.
Logging
type Logger = (Hook, Hook)Source
startLogging :: String -> Mud LoggerSource
startLogging name causes all messages to be logged in a file called name-yyyymmdd-hhmm.log. The used hooks have priority 100.
stopLogging :: Logger -> Mud ()Source
Stops the logger.
Miscellaneous
matchMore :: Mud ()Source
When called from a hook body, gives hooks that haven't been considered yet a chance to match on the currently triggering message. Useful if you want to build a hook that only has a side-effect and doesn't want to directly affect the other active hooks.
matchMoreOn :: String -> Mud ()Source
Like matchMore, but allows specification of the message that is passed on.
matchMoreOn' :: String -> Mud ()Source
Like matchMoreOn, but also makes the currently firing hook eligible for firing again.
system :: String -> Mud ()Source
Executes a shell command.
Produced by Haddock version 2.3.0