Copyright | (c) Justus Adam 2016 |
---|---|
License | BSD3 |
Maintainer | dev@justus.science |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
- type Message = Text
- data Script a = Script (Handlers a) ScriptId Config a
- data ScriptId
- mkScriptId :: Text -> Either String ScriptId
- unwrapScriptId :: ScriptId -> Text
- applicationScriptId :: ScriptId
- class IsScript m where
- getScriptId :: IsScript m => m ScriptId
- class (IsScript m, MonadIO m) => HasConfigAccess m
- newtype TimeStamp = TimeStamp {}
- class AccessAdapter m where
- type AdapterT m
- newtype User' a = User' {
- unwrapUser' :: User a
- newtype Channel' a = Channel' {
- unwrapChannel' :: Channel a
- class Get a b where
- 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
- type RunnerM = LoggingT IO
Documentation
An abstract type describing a marvin script.
This is basically a collection of event handlers.
Internal structure is exposed for people wanting to extend this.
A type, basically a String, which identifies a script to the config and the logging facilities.
For conversion please use mkScriptId
and unwrapScriptId
. They will perform necessary checks.
unwrapScriptId :: ScriptId -> Text Source #
applicationScriptId :: ScriptId Source #
Script id sed for the bot itself
class IsScript m where Source #
Similar to AccessAdapter
, this class says there is a ScriptId
reachable from the type (usually a monad) m
.
getScriptId :: m ScriptId Source #
Retrieve the script id out of m
, ususally a monad.
IsScript (ScriptDefinition a) Source # | |
IsScript (BotReacting a b) Source # | |
getScriptId :: IsScript m => m ScriptId Source #
Retrieve the script id out of m
, ususally a monad.
class (IsScript m, MonadIO m) => HasConfigAccess m 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
.
getConfigInternal
A timestamp type. Supplied with most Event
types
class AccessAdapter m Source #
Similar to IsScript
, this class says that there is an adapter AdapterT
available from this type (usually a monad) m
.
The type of adapter depends on the monad itself.
This class can be thought of as MonadReader
specified to AdapterT
.
AccessAdapter (AdapterM a) Source # | |
AccessAdapter (ScriptDefinition a) Source # | |
AccessAdapter (BotReacting a b) Source # | |
Wrapping type for users. Only used to enable Get
typeclass instances.
User' | |
|
Wrapping type for channels. Only used to enable Get
typeclass instances.
Class which says that there is a way to get to b
from this type a
.
This typeclass is used to allow handlers with different types of payload to share common
accessor functions such as getUser
and getMessage
.
The instances specify for each type of payload which pieces of data can be extracted and how.
Get (a, b, TimeStamp) TimeStamp Source # | |
Get (a, Channel' b, c) (Channel' b) Source # | |
Get (User' a, b, c) (User' a) Source # | |
Get (a, b, Topic, d) Topic Source # | |
Get (a, b, c, TimeStamp) TimeStamp Source # | |
Get (a, Channel' b, c, d) (Channel' b) Source # | |
Get (User' a, b, c, d) (User' a) Source # | |
Get (a, b, c, Message, e) Message Source # | |
Get (a, b, Match, d, e) Match Source # | |
Get (a, b, c, d, TimeStamp) TimeStamp Source # | |
Get (a, Channel' b, c, d, e) (Channel' b) Source # | |
Get (User' a, b, c, d, e) (User' a) Source # | |
Representation for the types of events which can occur
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 |