Safe Haskell | None |
---|---|
Language | Haskell2010 |
Command context typeclass
Synopsis
- class CommandContext m c a | c -> m, c -> a where
- ctxPrefix :: c -> Text
- ctxCommand :: c -> Command m c a
- ctxUnparsedParams :: c -> Text
- data ConstructContext msg ctx m' a' m a where
- ConstructContext :: (Text, Command m' ctx a', Text) -> msg -> ConstructContext msg ctx m' a' m (Maybe ctx)
- constructContext :: forall msg ctx m' a' r. MemberWithError (ConstructContext msg ctx m' a') r => (Text, Command m' ctx a', Text) -> msg -> Sem r (Maybe ctx)
- data BasicContext m a = BasicContext {
- bcPrefix :: Text
- bcCommand :: Command m (BasicContext m a) a
- bcUnparsedParams :: Text
- useBasicContext :: Sem (ConstructContext msg (BasicContext m a') m a' ': r) a -> Sem r a
Documentation
class CommandContext m c a | c -> m, c -> a where Source #
ctxPrefix :: c -> Text Source #
The prefix that was used to invoke the command
ctxCommand :: c -> Command m c a Source #
The command that was invoked
ctxUnparsedParams :: c -> Text Source #
The message remaining after consuming the prefix
Instances
CommandContext m (BasicContext m a) a Source # | |
Defined in CalamityCommands.Context ctxPrefix :: BasicContext m a -> Text Source # ctxCommand :: BasicContext m a -> Command m (BasicContext m a) a Source # ctxUnparsedParams :: BasicContext m a -> Text Source # |
data ConstructContext msg ctx m' a' m a where Source #
An effect for constructing the context for a command
ConstructContext | Construct a context for a command invokation, returning Just |
|
constructContext :: forall msg ctx m' a' r. MemberWithError (ConstructContext msg ctx m' a') r => (Text, Command m' ctx a', Text) -> msg -> Sem r (Maybe ctx) Source #
data BasicContext m a Source #
A basic context that only knows the prefix used and the unparsed input
BasicContext | |
|
Instances
useBasicContext :: Sem (ConstructContext msg (BasicContext m a') m a' ': r) a -> Sem r a Source #
A default interpretation for ConstructContext
that constructs a BasicContext