marvin-0.2.0: A framework for modular, portable chat bots.

Copyright(c) Justus Adam 2016
LicenseBSD3
Maintainerdev@justus.science
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Marvin.Types

Description

 

Synopsis

Documentation

type Message = Text Source #

The contents of a recieved message

data Script a Source #

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

data 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.

mkScriptId :: Text -> Either String ScriptId Source #

Attempt to create a script id from Text

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

getScriptId

Methods

getScriptId :: m ScriptId Source #

Retrieve the script id out of m, ususally a monad.

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

newtype TimeStamp Source #

A timestamp type. Supplied with most Event types

Constructors

TimeStamp 

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

getAdapter

Associated Types

type AdapterT m Source #

The concrete type of adapter accessible from m.

Instances

AccessAdapter (AdapterM a) Source # 

Associated Types

type AdapterT (AdapterM a :: * -> *) :: * Source #

AccessAdapter (ScriptDefinition a) Source # 

Associated Types

type AdapterT (ScriptDefinition a :: * -> *) :: * Source #

AccessAdapter (BotReacting a b) Source # 

Associated Types

type AdapterT (BotReacting a b :: * -> *) :: * Source #

newtype User' a Source #

Wrapping type for users. Only used to enable Get typeclass instances.

Constructors

User' 

Fields

Instances

Get (User' a, b, c) (User' a) Source # 

Methods

getLens :: Lens' (User' a, b, c) (User' a) Source #

Get (User' a, b, c, d) (User' a) Source # 

Methods

getLens :: Lens' (User' a, b, c, d) (User' a) Source #

Get (User' a, b, c, d, e) (User' a) Source # 

Methods

getLens :: Lens' (User' a, b, c, d, e) (User' a) Source #

newtype Channel' a Source #

Wrapping type for channels. Only used to enable Get typeclass instances.

Constructors

Channel' 

Fields

Instances

Get (a, Channel' b, c) (Channel' b) Source # 

Methods

getLens :: Lens' (a, Channel' b, c) (Channel' b) Source #

Get (a, Channel' b, c, d) (Channel' b) Source # 

Methods

getLens :: Lens' (a, Channel' b, c, d) (Channel' b) Source #

Get (a, Channel' b, c, d, e) (Channel' b) Source # 

Methods

getLens :: Lens' (a, Channel' b, c, d, e) (Channel' b) Source #

class Get a b where Source #

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

getLens

Methods

getLens :: Lens' a b Source #

Instances

Get (a, b, TimeStamp) TimeStamp Source # 
Get (a, Channel' b, c) (Channel' b) Source # 

Methods

getLens :: Lens' (a, Channel' b, c) (Channel' b) Source #

Get (User' a, b, c) (User' a) Source # 

Methods

getLens :: Lens' (User' a, b, c) (User' a) Source #

Get (a, b, Topic, d) Topic Source # 

Methods

getLens :: Lens' (a, b, Topic, d) Topic Source #

Get (a, b, c, TimeStamp) TimeStamp Source # 

Methods

getLens :: Lens' (a, b, c, TimeStamp) TimeStamp Source #

Get (a, Channel' b, c, d) (Channel' b) Source # 

Methods

getLens :: Lens' (a, Channel' b, c, d) (Channel' b) Source #

Get (User' a, b, c, d) (User' a) Source # 

Methods

getLens :: Lens' (User' a, b, c, d) (User' a) Source #

Get (a, b, c, Message, e) Message Source # 

Methods

getLens :: Lens' (a, b, c, Message, e) Message Source #

Get (a, b, Match, d, e) Match Source # 

Methods

getLens :: Lens' (a, b, Match, d, e) Match Source #

Get (a, b, c, d, TimeStamp) TimeStamp Source # 

Methods

getLens :: Lens' (a, b, c, d, TimeStamp) TimeStamp Source #

Get (a, Channel' b, c, d, e) (Channel' b) Source # 

Methods

getLens :: Lens' (a, Channel' b, c, d, e) (Channel' b) Source #

Get (User' a, b, c, d, e) (User' a) Source # 

Methods

getLens :: Lens' (User' a, b, c, d, e) (User' a) Source #

data Event a Source #

Representation for the types of events which can occur

type RunnerM = LoggingT IO Source #

Basic monad which most internal actions run in

data BotActionState a d Source #

Read only data available to a handler when the bot reacts to an event.

class HasScriptId s a | s -> a where Source #

Minimal complete definition

scriptId

Methods

scriptId :: Lens' s a Source #

class HasAdapter s a | s -> a where Source #

Minimal complete definition

adapter

Methods

adapter :: Lens' s a Source #

Instances

HasAdapter (Script a0) a0 Source # 

Methods

adapter :: Lens' (Script a0) a0 Source #

HasAdapter (BotActionState a0 d0) a0 Source # 

Methods

adapter :: Lens' (BotActionState a0 d0) a0 Source #

class HasPayload s a | s -> a where Source #

Minimal complete definition

payload

Methods

payload :: Lens' s a Source #

Instances

class HasActions s a | s -> a where Source #

Minimal complete definition

actions

Methods

actions :: Lens' s a Source #