calamity-0.1.14.3: A library for writing discord bots
Safe HaskellNone
LanguageHaskell2010

Calamity.Commands.Parser

Description

Something that can parse user input

Synopsis

Documentation

class Typeable a => Parser (a :: Type) r where Source #

Minimal complete definition

parse

Associated Types

type ParserResult a Source #

type ParserResult a = a Source #

Methods

parserName :: Text Source #

default parserName :: Text Source #

parse :: Sem (ParserEffs r) (ParserResult a) Source #

Instances

Instances details
Parser () r Source # 
Instance details

Defined in Calamity.Commands.Parser

Associated Types

type ParserResult () Source #

Methods

parserName :: Text Source #

parse :: Sem (ParserEffs r) (ParserResult ()) Source #

Parser Text r Source # 
Instance details

Defined in Calamity.Commands.Parser

Associated Types

type ParserResult Text Source #

Methods

parserName :: Text0 Source #

parse :: Sem (ParserEffs r) (ParserResult Text) Source #

Parser Text r Source # 
Instance details

Defined in Calamity.Commands.Parser

Associated Types

type ParserResult Text Source #

Methods

parserName :: Text Source #

parse :: Sem (ParserEffs r) (ParserResult Text) Source #

Member (CacheEff :: (Type -> Type) -> Type -> Type) r => Parser Guild r Source #

Parser for guilds, this only looks in the cache. Use Snowflake Guild and use upgrade if you want to allow fetching from http.

Instance details

Defined in Calamity.Commands.Parser

Associated Types

type ParserResult Guild Source #

Methods

parserName :: Text Source #

parse :: Sem (ParserEffs r) (ParserResult Guild) Source #

Parser Member r Source #

Parser for members in the guild the command was invoked in, this only looks in the cache. Use Snowflake Member and use upgrade if you want to allow fetching from http.

Instance details

Defined in Calamity.Commands.Parser

Associated Types

type ParserResult Member Source #

Methods

parserName :: Text Source #

parse :: Sem (ParserEffs r) (ParserResult Member) Source #

Member (CacheEff :: (Type -> Type) -> Type -> Type) r => Parser User r Source #

Parser for users, this only looks in the cache. Use Snowflake User and use upgrade if you want to allow fetching from http.

Instance details

Defined in Calamity.Commands.Parser

Associated Types

type ParserResult User Source #

Methods

parserName :: Text Source #

parse :: Sem (ParserEffs r) (ParserResult User) Source #

Parser RawEmoji r Source # 
Instance details

Defined in Calamity.Commands.Parser

Associated Types

type ParserResult RawEmoji Source #

Methods

parserName :: Text Source #

parse :: Sem (ParserEffs r) (ParserResult RawEmoji) Source #

Parser Emoji r Source #

Parser for emojis in the guild the command was invoked in, this only looks in the cache. Use Snowflake Emoji and use upgrade if you want to allow fetching from http.

Instance details

Defined in Calamity.Commands.Parser

Associated Types

type ParserResult Emoji Source #

Methods

parserName :: Text Source #

parse :: Sem (ParserEffs r) (ParserResult Emoji) Source #

Parser GuildChannel r Source #

Parser for channels in the guild the command was invoked in, this only looks in the cache. Use Snowflake Channel and use upgrade if you want to allow fetching from http.

Instance details

Defined in Calamity.Commands.Parser

Associated Types

type ParserResult GuildChannel Source #

Methods

parserName :: Text Source #

parse :: Sem (ParserEffs r) (ParserResult GuildChannel) Source #

Parser a r => Parser [a] r Source # 
Instance details

Defined in Calamity.Commands.Parser

Associated Types

type ParserResult [a] Source #

Methods

parserName :: Text Source #

parse :: Sem (ParserEffs r) (ParserResult [a]) Source #

Parser a r => Parser (Maybe a) r Source # 
Instance details

Defined in Calamity.Commands.Parser

Associated Types

type ParserResult (Maybe a) Source #

Methods

parserName :: Text Source #

parse :: Sem (ParserEffs r) (ParserResult (Maybe a)) Source #

(Parser a r, Typeable a) => Parser (NonEmpty a) r Source # 
Instance details

Defined in Calamity.Commands.Parser

Associated Types

type ParserResult (NonEmpty a) Source #

Methods

parserName :: Text Source #

parse :: Sem (ParserEffs r) (ParserResult (NonEmpty a)) Source #

Typeable (Snowflake a) => Parser (Snowflake a) r Source # 
Instance details

Defined in Calamity.Commands.Parser

Associated Types

type ParserResult (Snowflake a) Source #

Methods

parserName :: Text Source #

parse :: Sem (ParserEffs r) (ParserResult (Snowflake a)) Source #

Parser (Snowflake Channel) r Source # 
Instance details

Defined in Calamity.Commands.Parser

Associated Types

type ParserResult (Snowflake Channel) Source #

Methods

parserName :: Text Source #

parse :: Sem (ParserEffs r) (ParserResult (Snowflake Channel)) Source #

Parser (Snowflake Member) r Source # 
Instance details

Defined in Calamity.Commands.Parser

Associated Types

type ParserResult (Snowflake Member) Source #

Methods

parserName :: Text Source #

parse :: Sem (ParserEffs r) (ParserResult (Snowflake Member)) Source #

Parser (Snowflake User) r Source # 
Instance details

Defined in Calamity.Commands.Parser

Associated Types

type ParserResult (Snowflake User) Source #

Methods

parserName :: Text Source #

parse :: Sem (ParserEffs r) (ParserResult (Snowflake User)) Source #

Parser (Snowflake Role) r Source # 
Instance details

Defined in Calamity.Commands.Parser

Associated Types

type ParserResult (Snowflake Role) Source #

Methods

parserName :: Text Source #

parse :: Sem (ParserEffs r) (ParserResult (Snowflake Role)) Source #

Parser (Snowflake Emoji) r Source # 
Instance details

Defined in Calamity.Commands.Parser

Associated Types

type ParserResult (Snowflake Emoji) Source #

Methods

parserName :: Text Source #

parse :: Sem (ParserEffs r) (ParserResult (Snowflake Emoji)) Source #

(Monoid (ParserResult a), Parser a r) => Parser (KleenePlusConcat a) r Source # 
Instance details

Defined in Calamity.Commands.Parser

Associated Types

type ParserResult (KleenePlusConcat a) Source #

Methods

parserName :: Text Source #

parse :: Sem (ParserEffs r) (ParserResult (KleenePlusConcat a)) Source #

Parser (KleenePlusConcat Text) r Source # 
Instance details

Defined in Calamity.Commands.Parser

Associated Types

type ParserResult (KleenePlusConcat Text) Source #

Methods

parserName :: Text0 Source #

parse :: Sem (ParserEffs r) (ParserResult (KleenePlusConcat Text)) Source #

Parser (KleenePlusConcat Text) r Source # 
Instance details

Defined in Calamity.Commands.Parser

Associated Types

type ParserResult (KleenePlusConcat Text) Source #

Methods

parserName :: Text Source #

parse :: Sem (ParserEffs r) (ParserResult (KleenePlusConcat Text)) Source #

(Monoid (ParserResult a), Parser a r) => Parser (KleeneStarConcat a) r Source # 
Instance details

Defined in Calamity.Commands.Parser

Associated Types

type ParserResult (KleeneStarConcat a) Source #

Methods

parserName :: Text Source #

parse :: Sem (ParserEffs r) (ParserResult (KleeneStarConcat a)) Source #

Parser (KleeneStarConcat Text) r Source # 
Instance details

Defined in Calamity.Commands.Parser

Associated Types

type ParserResult (KleeneStarConcat Text) Source #

Methods

parserName :: Text0 Source #

parse :: Sem (ParserEffs r) (ParserResult (KleeneStarConcat Text)) Source #

Parser (KleeneStarConcat Text) r Source # 
Instance details

Defined in Calamity.Commands.Parser

Associated Types

type ParserResult (KleeneStarConcat Text) Source #

Methods

parserName :: Text Source #

parse :: Sem (ParserEffs r) (ParserResult (KleeneStarConcat Text)) Source #

(Parser a r, Parser b r) => Parser (Either a b) r Source # 
Instance details

Defined in Calamity.Commands.Parser

Associated Types

type ParserResult (Either a b) Source #

Methods

parserName :: Text Source #

parse :: Sem (ParserEffs r) (ParserResult (Either a b)) Source #

(Parser a r, Parser b r) => Parser (a, b) r Source # 
Instance details

Defined in Calamity.Commands.Parser

Associated Types

type ParserResult (a, b) Source #

Methods

parserName :: Text Source #

parse :: Sem (ParserEffs r) (ParserResult (a, b)) Source #

(KnownSymbol s, Parser a r) => Parser (Named s a) r Source # 
Instance details

Defined in Calamity.Commands.Parser

Associated Types

type ParserResult (Named s a) Source #

Methods

parserName :: Text Source #

parse :: Sem (ParserEffs r) (ParserResult (Named s a)) Source #

data Named (s :: Symbol) (a :: Type) Source #

A named parameter, used to attach the name s to a type in the command's help output

Instances

Instances details
(KnownSymbol s, Parser a r) => Parser (Named s a) r Source # 
Instance details

Defined in Calamity.Commands.Parser

Associated Types

type ParserResult (Named s a) Source #

Methods

parserName :: Text Source #

parse :: Sem (ParserEffs r) (ParserResult (Named s a)) Source #

type ParserResult (Named s a) Source # 
Instance details

Defined in Calamity.Commands.Parser

data KleeneStarConcat (a :: Type) Source #

A parser that consumes zero or more of a then concatenates them together.

KleeneStarConcat Text Is therefore consumes all remaining input.

Instances

Instances details
(Monoid (ParserResult a), Parser a r) => Parser (KleeneStarConcat a) r Source # 
Instance details

Defined in Calamity.Commands.Parser

Associated Types

type ParserResult (KleeneStarConcat a) Source #

Methods

parserName :: Text Source #

parse :: Sem (ParserEffs r) (ParserResult (KleeneStarConcat a)) Source #

Parser (KleeneStarConcat Text) r Source # 
Instance details

Defined in Calamity.Commands.Parser

Associated Types

type ParserResult (KleeneStarConcat Text) Source #

Methods

parserName :: Text0 Source #

parse :: Sem (ParserEffs r) (ParserResult (KleeneStarConcat Text)) Source #

Parser (KleeneStarConcat Text) r Source # 
Instance details

Defined in Calamity.Commands.Parser

Associated Types

type ParserResult (KleeneStarConcat Text) Source #

Methods

parserName :: Text Source #

parse :: Sem (ParserEffs r) (ParserResult (KleeneStarConcat Text)) Source #

type ParserResult (KleeneStarConcat a) Source # 
Instance details

Defined in Calamity.Commands.Parser

type ParserResult (KleeneStarConcat Text) Source # 
Instance details

Defined in Calamity.Commands.Parser

type ParserResult (KleeneStarConcat Text) Source # 
Instance details

Defined in Calamity.Commands.Parser

data KleenePlusConcat (a :: Type) Source #

A parser that consumes one or more of a then concatenates them together.

KleenePlusConcat Text Is therefore consumes all remaining input.

Instances

Instances details
(Monoid (ParserResult a), Parser a r) => Parser (KleenePlusConcat a) r Source # 
Instance details

Defined in Calamity.Commands.Parser

Associated Types

type ParserResult (KleenePlusConcat a) Source #

Methods

parserName :: Text Source #

parse :: Sem (ParserEffs r) (ParserResult (KleenePlusConcat a)) Source #

Parser (KleenePlusConcat Text) r Source # 
Instance details

Defined in Calamity.Commands.Parser

Associated Types

type ParserResult (KleenePlusConcat Text) Source #

Methods

parserName :: Text0 Source #

parse :: Sem (ParserEffs r) (ParserResult (KleenePlusConcat Text)) Source #

Parser (KleenePlusConcat Text) r Source # 
Instance details

Defined in Calamity.Commands.Parser

Associated Types

type ParserResult (KleenePlusConcat Text) Source #

Methods

parserName :: Text Source #

parse :: Sem (ParserEffs r) (ParserResult (KleenePlusConcat Text)) Source #

type ParserResult (KleenePlusConcat a) Source # 
Instance details

Defined in Calamity.Commands.Parser

type ParserResult (KleenePlusConcat Text) Source # 
Instance details

Defined in Calamity.Commands.Parser

type ParserResult (KleenePlusConcat Text) Source # 
Instance details

Defined in Calamity.Commands.Parser

runCommandParser :: Context -> Text -> Sem (ParserEffs r) a -> Sem r (Either (Text, Text) a) Source #