lambdabot-core-5.3: Lambdabot core functionality

Safe HaskellNone
LanguageHaskell98

Lambdabot.Module

Synopsis

Documentation

data Module st Source #

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 listens 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 ModuleID st Source #

Instances
GCompare ModuleID Source # 
Instance details

Defined in Lambdabot.Module

Methods

gcompare :: ModuleID a -> ModuleID b -> GOrdering a b #

GEq ModuleID Source # 
Instance details

Defined in Lambdabot.Module

Methods

geq :: ModuleID a -> ModuleID b -> Maybe (a :~: b) #

data ModuleInfo st Source #

Info about a running module.

Constructors

ModuleInfo 

Fields

Instances
Monad m => MonadReader (ModuleInfo st) (ModuleT st m) Source # 
Instance details

Defined in Lambdabot.Module

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 #

data ModuleT st m a Source #

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) Source # 
Instance details

Defined in Lambdabot.Module

Methods

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

MonadBaseControl b m => MonadBaseControl b (ModuleT st m) Source # 
Instance details

Defined in Lambdabot.Module

Associated Types

type StM (ModuleT st m) a :: Type #

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) Source # 
Instance details

Defined in Lambdabot.Module

Methods

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

MonadTransControl (ModuleT st) Source # 
Instance details

Defined in Lambdabot.Module

Associated Types

type StT (ModuleT st) a :: Type #

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) Source # 
Instance details

Defined in Lambdabot.Module

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) Source # 
Instance details

Defined in Lambdabot.Module

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) Source # 
Instance details

Defined in Lambdabot.Module

Methods

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

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

MonadFail m => MonadFail (ModuleT st m) Source # 
Instance details

Defined in Lambdabot.Module

Methods

fail :: String -> ModuleT st m a #

Applicative m => Applicative (ModuleT st m) Source # 
Instance details

Defined in Lambdabot.Module

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) Source # 
Instance details

Defined in Lambdabot.Module

Methods

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

MonadException m => MonadException (ModuleT st m) Source # 
Instance details

Defined in Lambdabot.Module

Methods

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

MonadConfig m => MonadConfig (ModuleT st m) Source # 
Instance details

Defined in Lambdabot.Module

Methods

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

MonadLogging m => MonadLogging (ModuleT st m) Source # 
Instance details

Defined in Lambdabot.Module

MonadLB m => MonadLB (ModuleT st m) Source # 
Instance details

Defined in Lambdabot.Monad

Methods

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

MonadLB m => MonadLBState (ModuleT st m) Source # 
Instance details

Defined in Lambdabot.State

Associated Types

type LBState (ModuleT st m) :: Type Source #

Methods

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

type StT (ModuleT st) a Source # 
Instance details

Defined in Lambdabot.Module

type StT (ModuleT st) a = a
type LBState (ModuleT st m) Source # 
Instance details

Defined in Lambdabot.State

type LBState (ModuleT st m) = st
type StM (ModuleT st m) a Source # 
Instance details

Defined in Lambdabot.Module

type StM (ModuleT st m) a = ComposeSt (ModuleT st) m a

runModuleT :: ModuleT st m a -> ModuleInfo st -> m a Source #