| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
CalamityCommands.Check
Description
Command invokation preconditions
Documentation
A check for a command.
Every check for a command must return Nothing for the command to be run.
Constructors
| MkCheck | |
Instances
| Generic (Check m c) Source # | |
| type Rep (Check m c) Source # | |
Defined in CalamityCommands.Check type Rep (Check m c) = D1 ('MetaData "Check" "CalamityCommands.Check" "calamity-commands-0.2.0.0-inplace" 'False) (C1 ('MetaCons "MkCheck" 'PrefixI 'True) (S1 ('MetaSel ('Just "name") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "callback") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (c -> m (Maybe Text))))) | |
buildCheck :: (Monad m, Member (Final m) r) => Text -> (c -> Sem r (Maybe Text)) -> Sem r (Check m c) Source #
Given the name of a check and a callback in the Sem monad, build a check
by transforming the Polysemy action into an m action.
buildCheckPure :: Monad m => Text -> (c -> Maybe Text) -> Check m c Source #
Given the name of a check and a pure callback function, build a check.
runCheck :: (Monad m, Member (Embed m) r) => c -> Check m c -> Sem r (Either CommandError ()) Source #
Given an invokation context c, run a check and transform the result into an
.Either CommandError ()