| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Marvin.Internal.Types
Contents
- type Topic = Text
- type Message = Text
- data Event a
- = MessageEvent (User a) (Channel a) Message TimeStamp
- | CommandEvent (User a) (Channel a) Message TimeStamp
- | ChannelJoinEvent (User a) (Channel a) TimeStamp
- | ChannelLeaveEvent (User a) (Channel a) TimeStamp
- | TopicChangeEvent (User a) (Channel a) Topic TimeStamp
- newtype AdapterM a r = AdapterM {
- runAdapterAction :: ReaderT (Config, a) RunnerM r
- type EventHandler a = Event a -> IO ()
- type RunWithAdapter a = EventHandler a -> AdapterM a ()
- class IsAdapter a where
- newtype User' a = User' {
- unwrapUser' :: User a
- newtype Channel' a = Channel' {
- unwrapChannel' :: Channel a
- newtype TimeStamp = TimeStamp {}
- timestampFromNumber :: Value -> Parser TimeStamp
- newtype ScriptId = ScriptId {}
- newtype AdapterId a = AdapterId {}
- applicationScriptId :: ScriptId
- type RunnerM = LoggingT IO
- verifyIdString :: String -> (String -> a) -> String -> a
- class HasScriptId s a | s -> a where
- class (IsScript m, MonadIO m) => HasConfigAccess m where
- class IsScript m where
- class AccessAdapter m where
- type AdapterT m
Documentation
Representation for the types of events which can occur
Constructors
| MessageEvent (User a) (Channel a) Message TimeStamp | |
| CommandEvent (User a) (Channel a) Message TimeStamp | |
| ChannelJoinEvent (User a) (Channel a) TimeStamp | |
| ChannelLeaveEvent (User a) (Channel a) TimeStamp | |
| TopicChangeEvent (User a) (Channel a) Topic TimeStamp |
Constructors
| AdapterM | |
Fields
| |
Instances
| MonadBaseControl IO (AdapterM a) Source # | |
| MonadBase IO (AdapterM a) Source # | |
| Monad (AdapterM a) Source # | |
| Functor (AdapterM a) Source # | |
| Applicative (AdapterM a) Source # | |
| MonadIO (AdapterM a) Source # | |
| MonadLogger (AdapterM a) Source # | |
| MonadLoggerIO (AdapterM a) Source # | |
| AccessAdapter (AdapterM a) Source # | |
| type AdapterT (AdapterM a) Source # | |
| type StM (AdapterM a) r Source # | |
type EventHandler a = Event a -> IO () Source #
type RunWithAdapter a = EventHandler a -> AdapterM a () Source #
class IsAdapter a where Source #
Basic functionality required of any adapter
Minimal complete definition
adapterId, messageChannel, initAdapter, runWithAdapter, getUsername, getChannelName, resolveChannel
Methods
adapterId :: AdapterId a Source #
Used for scoping config and logging
messageChannel :: Channel a -> Text -> AdapterM a () Source #
Post a message to a channel given the internal channel identifier
initAdapter :: RunnerM a Source #
Initialize the adapter state
runWithAdapter :: RunWithAdapter a Source #
Initialize and run the bot
getUsername :: User a -> AdapterM a Text Source #
Resolve a username given the internal user identifier
getChannelName :: Channel a -> AdapterM a Text Source #
Resolve the human readable name for a channel given the internal channel identifier
resolveChannel :: Text -> AdapterM a (Maybe (Channel a)) Source #
Resolve to the internal channel identifier given a human readable name
Instances
| IsAdapter ShellAdapter Source # | |
| MkTelegram a => IsAdapter (TelegramAdapter a) Source # | |
| MkSlack a => IsAdapter (SlackAdapter a) Source # | |
Constructors
| User' | |
Fields
| |
Instances
| HasTopicChange (Handlers a0) (Vector ((User' a0, Channel' a0, Topic, TimeStamp) -> RunnerM ())) Source # | |
| HasResponds (Handlers a0) (Vector (Regex, (User' a0, Channel' a0, Match, Message, TimeStamp) -> RunnerM ())) Source # | |
| HasLeaves (Handlers a0) (Vector ((User' a0, Channel' a0, TimeStamp) -> RunnerM ())) Source # | |
| HasJoins (Handlers a0) (Vector ((User' a0, Channel' a0, TimeStamp) -> RunnerM ())) Source # | |
| HasHears (Handlers a0) (Vector (Regex, (User' a0, Channel' a0, Match, Message, TimeStamp) -> RunnerM ())) Source # | |
| HasTopicChangeIn (Handlers a0) (HashMap Text (Vector ((User' a0, Channel' a0, Topic, TimeStamp) -> RunnerM ()))) Source # | |
| HasLeavesFrom (Handlers a0) (HashMap Text (Vector ((User' a0, Channel' a0, TimeStamp) -> RunnerM ()))) Source # | |
| HasJoinsIn (Handlers a0) (HashMap Text (Vector ((User' a0, Channel' a0, TimeStamp) -> RunnerM ()))) Source # | |
| Get (User' a, b, c) (User' a) Source # | |
| Get (User' a, b, c, d) (User' a) Source # | |
| Get (User' a, b, c, d, e) (User' a) Source # | |
Constructors
| Channel' | |
Fields
| |
Instances
Constructors
| TimeStamp | |
Fields | |
Instances
A type, basically a String, which identifies a script to the config and the logging facilities.
Constructors
| ScriptId | |
Fields | |
A type, basically a String, which identifies an adapter to the config and the logging facilities.
Constructors
| AdapterId | |
Fields | |
class HasScriptId s a | s -> a where Source #
Minimal complete definition
Instances
| HasScriptId (Script a0) ScriptId Source # | |
| HasScriptId (BotActionState a0 d0) ScriptId Source # | |
class (IsScript m, MonadIO m) => HasConfigAccess m where Source #
Denotes a place from which we may access the configuration.
During script definition or when handling a request we can obtain the config with getConfigVal or requireConfigVal.
Minimal complete definition
Methods
getConfigInternal :: m Config Source #
INTERNAL USE WITH CARE
Obtain the entire config structure
Instances
class IsScript m where Source #
Minimal complete definition
Methods
getScriptId :: m ScriptId Source #
Instances
| IsScript (ScriptDefinition a) Source # | |
| IsScript (BotReacting a b) Source # | |
class AccessAdapter m where Source #
Minimal complete definition
Methods
getAdapter :: m (AdapterT m) Source #
Instances
| AccessAdapter (AdapterM a) Source # | |
| AccessAdapter (ScriptDefinition a) Source # | |
| AccessAdapter (BotReacting a b) Source # | |