Safe Haskell | None |
---|---|
Language | Haskell2010 |
Something that can parse user input
Synopsis
- class Typeable a => Parser (a :: Type) r where
- type ParserResult a
- parserName :: Text
- parse :: Sem (ParserEffs r) (ParserResult a)
- data Named (s :: Symbol) (a :: Type)
- data KleeneStarConcat (a :: Type)
- data KleenePlusConcat (a :: Type)
- type ParserEffs r = State ParserState ': (Error (Text, Text) ': (Reader Context ': r))
- runCommandParser :: Context -> Text -> Sem (ParserEffs r) a -> Sem r (Either (Text, Text) a)
Documentation
class Typeable a => Parser (a :: Type) r where Source #
type ParserResult a Source #
type ParserResult a = a
parserName :: Text Source #
default parserName :: Text Source #
parse :: Sem (ParserEffs r) (ParserResult a) Source #
Instances
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
(KnownSymbol s, Parser a r) => Parser (Named s a) r Source # | |
Defined in Calamity.Commands.Parser type ParserResult (Named s a) Source # parserName :: Text Source # parse :: Sem (ParserEffs r) (ParserResult (Named s a)) Source # | |
type ParserResult (Named s a) Source # | |
Defined in Calamity.Commands.Parser |
data KleeneStarConcat (a :: Type) Source #
A parser that consumes zero or more of a
then concatenates them together.
therefore consumes all remaining input.KleeneStarConcat
Text
Instances
(Monoid (ParserResult a), Parser a r) => Parser (KleeneStarConcat a) r Source # | |
Defined in Calamity.Commands.Parser type ParserResult (KleeneStarConcat a) Source # parserName :: Text Source # parse :: Sem (ParserEffs r) (ParserResult (KleeneStarConcat a)) Source # | |
Parser (KleeneStarConcat Text) r Source # | |
Defined in Calamity.Commands.Parser type ParserResult (KleeneStarConcat Text) Source # parserName :: Text Source # parse :: Sem (ParserEffs r) (ParserResult (KleeneStarConcat Text)) Source # | |
Parser (KleeneStarConcat Text) r Source # | |
Defined in Calamity.Commands.Parser type ParserResult (KleeneStarConcat Text) Source # parserName :: Text0 Source # parse :: Sem (ParserEffs r) (ParserResult (KleeneStarConcat Text)) Source # | |
type ParserResult (KleeneStarConcat a) Source # | |
Defined in Calamity.Commands.Parser | |
type ParserResult (KleeneStarConcat Text) Source # | |
Defined in Calamity.Commands.Parser | |
type ParserResult (KleeneStarConcat Text) Source # | |
Defined in Calamity.Commands.Parser |
data KleenePlusConcat (a :: Type) Source #
A parser that consumes one or more of a
then concatenates them together.
therefore consumes all remaining input.KleenePlusConcat
Text
Instances
(Semigroup (ParserResult a), Parser a r) => Parser (KleenePlusConcat a) r Source # | |
Defined in Calamity.Commands.Parser type ParserResult (KleenePlusConcat a) Source # parserName :: Text Source # parse :: Sem (ParserEffs r) (ParserResult (KleenePlusConcat a)) Source # | |
Parser (KleenePlusConcat Text) r Source # | |
Defined in Calamity.Commands.Parser type ParserResult (KleenePlusConcat Text) Source # parserName :: Text Source # parse :: Sem (ParserEffs r) (ParserResult (KleenePlusConcat Text)) Source # | |
Parser (KleenePlusConcat Text) r Source # | |
Defined in Calamity.Commands.Parser type ParserResult (KleenePlusConcat Text) Source # parserName :: Text0 Source # parse :: Sem (ParserEffs r) (ParserResult (KleenePlusConcat Text)) Source # | |
type ParserResult (KleenePlusConcat a) Source # | |
Defined in Calamity.Commands.Parser | |
type ParserResult (KleenePlusConcat Text) Source # | |
Defined in Calamity.Commands.Parser | |
type ParserResult (KleenePlusConcat Text) Source # | |
Defined in Calamity.Commands.Parser |