lambdabot-core-5.1.0.1: Lambdabot core functionality

Safe HaskellNone
LanguageHaskell98

Lambdabot.Plugin

Synopsis

Documentation

data Module st #

The Module type class.

Constructors

Module 

Fields

  • moduleSerialize :: !(Maybe (Serial st))

    If the module wants its state to be saved, this function should return a Serial.

    The default implementation returns Nothing.

  • moduleDefState :: !(LB st)

    If the module maintains state, this method specifies the default state (for example in case the state can't be read from a state).

    The default implementation returns an error and assumes the state is never accessed.

  • moduleSticky :: !Bool

    Is the module sticky? Sticky modules (as well as static ones) can't be unloaded. By default, modules are not sticky.

  • moduleCmds :: !(ModuleT st LB [Command (ModuleT st LB)])

    The commands the module listenes to.

  • moduleInit :: !(ModuleT st LB ())

    Initialize the module. The default implementation does nothing.

  • moduleExit :: !(ModuleT st LB ())

    Finalize the module. The default implementation does nothing.

  • contextual :: !(String -> Cmd (ModuleT st LB) ())

    Process contextual input. A plugin that implements contextual is able to respond to text not part of a normal command.

data ModuleT st m a #

This transformer encodes the additional information a module might need to access its name or its state.

Instances

MonadBase b m => MonadBase b (ModuleT st m) # 

Methods

liftBase :: b α -> ModuleT st m α #

MonadBaseControl b m => MonadBaseControl b (ModuleT st m) # 

Associated Types

type StM (ModuleT st m :: * -> *) a :: * #

Methods

liftBaseWith :: (RunInBase (ModuleT st m) b -> b a) -> ModuleT st m a #

restoreM :: StM (ModuleT st m) a -> ModuleT st m a #

MonadTrans (ModuleT st) # 

Methods

lift :: Monad m => m a -> ModuleT st m a #

MonadTransControl (ModuleT st) # 

Associated Types

type StT (ModuleT st :: (* -> *) -> * -> *) a :: * #

Methods

liftWith :: Monad m => (Run (ModuleT st) -> m a) -> ModuleT st m a #

restoreT :: Monad m => m (StT (ModuleT st) a) -> ModuleT st m a #

Monad m => MonadReader (ModuleInfo st) (ModuleT st m) # 

Methods

ask :: ModuleT st m (ModuleInfo st) #

local :: (ModuleInfo st -> ModuleInfo st) -> ModuleT st m a -> ModuleT st m a #

reader :: (ModuleInfo st -> a) -> ModuleT st m a #

Monad m => Monad (ModuleT st m) # 

Methods

(>>=) :: ModuleT st m a -> (a -> ModuleT st m b) -> ModuleT st m b #

(>>) :: ModuleT st m a -> ModuleT st m b -> ModuleT st m b #

return :: a -> ModuleT st m a #

fail :: String -> ModuleT st m a #

Functor m => Functor (ModuleT st m) # 

Methods

fmap :: (a -> b) -> ModuleT st m a -> ModuleT st m b #

(<$) :: a -> ModuleT st m b -> ModuleT st m a #

Applicative m => Applicative (ModuleT st m) # 

Methods

pure :: a -> ModuleT st m a #

(<*>) :: ModuleT st m (a -> b) -> ModuleT st m a -> ModuleT st m b #

liftA2 :: (a -> b -> c) -> ModuleT st m a -> ModuleT st m b -> ModuleT st m c #

(*>) :: ModuleT st m a -> ModuleT st m b -> ModuleT st m b #

(<*) :: ModuleT st m a -> ModuleT st m b -> ModuleT st m a #

MonadIO m => MonadIO (ModuleT st m) # 

Methods

liftIO :: IO a -> ModuleT st m a #

MonadException m => MonadException (ModuleT st m) # 

Methods

controlIO :: (RunIO (ModuleT st m) -> IO (ModuleT st m a)) -> ModuleT st m a #

MonadConfig m => MonadConfig (ModuleT st m) # 

Methods

getConfig :: Config a -> ModuleT st m a #

MonadLogging m => MonadLogging (ModuleT st m) # 

Methods

getCurrentLogger :: ModuleT st m [String] #

logM :: String -> Priority -> String -> ModuleT st m () #

MonadLB m => MonadLB (ModuleT st m) # 

Methods

lb :: LB a -> ModuleT st m a #

MonadLB m => MonadLBState (ModuleT st m) # 

Associated Types

type LBState (ModuleT st m :: * -> *) :: * #

Methods

withMS :: (LBState (ModuleT st m) -> (LBState (ModuleT st m) -> ModuleT st m ()) -> ModuleT st m a) -> ModuleT st m a #

type StT (ModuleT st) a # 
type StT (ModuleT st) a = a
type LBState (ModuleT st m) # 
type LBState (ModuleT st m) = st
type StM (ModuleT st m) a # 
type StM (ModuleT st m) a = ComposeSt (ModuleT st) m a

data LB a #

The IRC Monad. The reader transformer holds information about the connection to the IRC server.

instances Monad, Functor, MonadIO, MonadState, MonadError

Instances

Monad LB # 

Methods

(>>=) :: LB a -> (a -> LB b) -> LB b #

(>>) :: LB a -> LB b -> LB b #

return :: a -> LB a #

fail :: String -> LB a #

Functor LB # 

Methods

fmap :: (a -> b) -> LB a -> LB b #

(<$) :: a -> LB b -> LB a #

Applicative LB # 

Methods

pure :: a -> LB a #

(<*>) :: LB (a -> b) -> LB a -> LB b #

liftA2 :: (a -> b -> c) -> LB a -> LB b -> LB c #

(*>) :: LB a -> LB b -> LB b #

(<*) :: LB a -> LB b -> LB a #

MonadIO LB # 

Methods

liftIO :: IO a -> LB a #

MonadException LB # 

Methods

controlIO :: (RunIO LB -> IO (LB a)) -> LB a #

MonadConfig LB # 

Methods

getConfig :: Config a -> LB a #

MonadLogging LB # 

Methods

getCurrentLogger :: LB [String] #

logM :: String -> Priority -> String -> LB () #

MonadLB LB # 

Methods

lb :: LB a -> LB a #

MonadBase IO LB # 

Methods

liftBase :: IO α -> LB α #

MonadBaseControl IO LB # 

Associated Types

type StM (LB :: * -> *) a :: * #

Methods

liftBaseWith :: (RunInBase LB IO -> IO a) -> LB a #

restoreM :: StM LB a -> LB a #

MonadState IRCRWState LB # 

Methods

get :: LB IRCRWState #

put :: IRCRWState -> LB () #

state :: (IRCRWState -> (a, IRCRWState)) -> LB a #

type StM LB a # 

class (MonadIO m, MonadBaseControl IO m, MonadConfig m, MonadLogging m, Applicative m) => MonadLB m where #

Minimal complete definition

lb

Methods

lb :: LB a -> m a #

Instances

MonadLB LB # 

Methods

lb :: LB a -> LB a #

MonadLB m => MonadLB (Cmd m) # 

Methods

lb :: LB a -> Cmd m a #

MonadLB m => MonadLB (ModuleT st m) # 

Methods

lb :: LB a -> ModuleT st m a #

lim80 :: Monad m => m String -> Cmd m () #

ios80 :: MonadIO m => IO String -> Cmd m () #

convenience, similar to ios but also cut output to channel to 80 characters usage: process _ _ to _ s = ios80 to (plugs s)

data Nick #

The type of nicknames isolated from a message.

Constructors

Nick 

Fields

  • nTag :: !String

    The tag of the server this nick is on

  • nName :: !String

    The server-specific nickname of this nick

Instances

Eq Nick # 

Methods

(==) :: Nick -> Nick -> Bool #

(/=) :: Nick -> Nick -> Bool #

Ord Nick # 

Methods

compare :: Nick -> Nick -> Ordering #

(<) :: Nick -> Nick -> Bool #

(<=) :: Nick -> Nick -> Bool #

(>) :: Nick -> Nick -> Bool #

(>=) :: Nick -> Nick -> Bool #

max :: Nick -> Nick -> Nick #

min :: Nick -> Nick -> Nick #

ircPrivmsg #

Arguments

:: Nick

The channel/user.

-> String

The message.

-> LB () 

Send a message to a channel/user, applying all output filters

data Serial s #

Constructors

Serial 

stdSerial :: (Show s, Read s) => Serial s #

Default `instance' for a Serial

mapSerial :: (Ord k, Show k, Show v, Read k, Read v) => Serial (Map k v) #

Serializes a Map type if both the key and the value are instances of Read and Show. The serialization is done by converting the map to and from lists. Results are saved line-wise, for better editing and revison control.

readM :: (Monad m, Read a) => String -> m a #

readM behaves like read, but catches failure in a monad. this allocates a 20-30 M on startup...

readOnly :: (ByteString -> b) -> Serial b #