| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Telegram.Bot.Simple.Eff
Synopsis
- newtype BotM a = BotM {
- _runBotM :: ReaderT BotContext ClientM a
- data BotContext = BotContext {}
- liftClientM :: ClientM a -> BotM a
- runBotM :: BotContext -> BotM a -> ClientM a
- newtype Eff action model = Eff {}
- class GetAction return action where
- getNextAction :: BotM return -> BotM (Maybe action)
- runEff :: Eff action model -> (model, [BotM (Maybe action)])
- eff :: GetAction a b => BotM a -> Eff b ()
- withEffect :: GetAction a action => BotM a -> model -> Eff action model
- (<#) :: GetAction a action => model -> BotM a -> Eff action model
- setBotMUpdate :: Maybe Update -> BotM a -> BotM a
- setEffUpdate :: Maybe Update -> Eff action model -> Eff action model
Documentation
Bot handler context.
The context may include an Update the bot is handling at the moment.
Constructors
| BotM | |
Fields
| |
Instances
| Monad BotM Source # | |
| Functor BotM Source # | |
| Applicative BotM Source # | |
| MonadIO BotM Source # | |
Defined in Telegram.Bot.Simple.Eff | |
| MonadReader BotContext BotM Source # | |
Defined in Telegram.Bot.Simple.Eff Methods ask :: BotM BotContext # local :: (BotContext -> BotContext) -> BotM a -> BotM a # reader :: (BotContext -> a) -> BotM a # | |
data BotContext Source #
Constructors
| BotContext | |
Fields | |
Instances
| MonadReader BotContext BotM Source # | |
Defined in Telegram.Bot.Simple.Eff Methods ask :: BotM BotContext # local :: (BotContext -> BotContext) -> BotM a -> BotM a # reader :: (BotContext -> a) -> BotM a # | |
liftClientM :: ClientM a -> BotM a Source #
runBotM :: BotContext -> BotM a -> ClientM a Source #
class GetAction return action where Source #
The idea behind following type class is
to allow you defining the type ret you want to return from BotM action.
You can create your own return-types via new instances.
Here action is a botAction
type, that will be used further in botHandler function.
If you don't want to return action use Nothing instead.
See Telegram.Bot.Simple.Instances for more commonly useful instances.
- GetAction a a - for simple making finite automata of
BotM actions. (For example you can log every update
and then return new action to answer at messagesend stickeretc)
- GetAction () a - to use pure () instead of dealing with Nothing.
- GetAction Text a - to add some sugar over the replyText function.
OverloadedStrings breaks type inference,
so we advise to use replyText "message"
instead of pure @_ @Text "message".
Instances
| GetAction () a Source # | |
Defined in Telegram.Bot.Simple.Instances | |
| GetAction a a Source # | |
Defined in Telegram.Bot.Simple.Instances | |
| GetAction Text a Source # | |
Defined in Telegram.Bot.Simple.Instances | |