| Copyright | (c) Justus Adam 2016 |
|---|---|
| License | BSD3 |
| Maintainer | dev@justus.science |
| Stability | experimental |
| Portability | POSIX |
| Safe Haskell | None |
| Language | Haskell2010 |
Marvin.Types
Description
- type Message = Text
- data Script 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
- data BotActionState a d
- class HasScriptId s a | s -> a where
- class HasAdapter s a | s -> a where
- class HasPayload s a | s -> a where
- class HasActions s a | s -> a where
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.
Instances
| HasAdapter (Script a0) a0 Source # | |
| HasScriptId (Script a0) ScriptId Source # | |
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.
Minimal complete definition
Instances
| 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.
Minimal complete definition
getConfigInternal
Instances
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.
Minimal complete definition
Instances
| AccessAdapter (AdapterM a) Source # | |
| AccessAdapter (ScriptDefinition a) Source # | |
| AccessAdapter (BotReacting a b) Source # | |
Wrapping type for users. Only used to enable Get typeclass instances.
Constructors
| User' | |
Fields
| |
Wrapping type for channels. Only used to enable Get typeclass instances.
Constructors
| Channel' | |
Fields
| |
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.
Minimal complete definition
Instances
| 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
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 |
data BotActionState a d Source #
Read only data available to a handler when the bot reacts to an event.
Instances
| HasPayload (BotActionState a0 d0) d0 Source # | |
| HasAdapter (BotActionState a0 d0) a0 Source # | |
| HasScriptId (BotActionState a0 d0) ScriptId Source # | |
| MonadReader (BotActionState a d) (BotReacting a d) Source # | |
class HasScriptId s a | s -> a where Source #
Minimal complete definition
Instances
| HasScriptId (Script a0) ScriptId Source # | |
| HasScriptId (BotActionState a0 d0) ScriptId Source # | |
class HasAdapter s a | s -> a where Source #
Minimal complete definition
Instances
| HasAdapter (Script a0) a0 Source # | |
| HasAdapter (BotActionState a0 d0) a0 Source # | |
class HasPayload s a | s -> a where Source #
Minimal complete definition
Instances
| HasPayload (BotActionState a0 d0) d0 Source # | |