telegram-bot-simple-0.5.2: Easy to use library for building Telegram bots.
Safe HaskellNone
LanguageHaskell2010

Telegram.Bot.Simple.Eff

Synopsis

Documentation

newtype BotM a Source #

Bot handler context.

The context may include an Update the bot is handling at the moment.

Constructors

BotM 

Fields

Instances

Instances details
Monad BotM Source # 
Instance details

Defined in Telegram.Bot.Simple.Eff

Methods

(>>=) :: BotM a -> (a -> BotM b) -> BotM b #

(>>) :: BotM a -> BotM b -> BotM b #

return :: a -> BotM a #

Functor BotM Source # 
Instance details

Defined in Telegram.Bot.Simple.Eff

Methods

fmap :: (a -> b) -> BotM a -> BotM b #

(<$) :: a -> BotM b -> BotM a #

Applicative BotM Source # 
Instance details

Defined in Telegram.Bot.Simple.Eff

Methods

pure :: a -> BotM a #

(<*>) :: BotM (a -> b) -> BotM a -> BotM b #

liftA2 :: (a -> b -> c) -> BotM a -> BotM b -> BotM c #

(*>) :: BotM a -> BotM b -> BotM b #

(<*) :: BotM a -> BotM b -> BotM a #

MonadIO BotM Source # 
Instance details

Defined in Telegram.Bot.Simple.Eff

Methods

liftIO :: IO a -> BotM a #

MonadReader BotContext BotM Source # 
Instance details

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 #

Instances

Instances details
MonadReader BotContext BotM Source # 
Instance details

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 #

newtype Eff action model Source #

Constructors

Eff 

Fields

Instances

Instances details
Bifunctor Eff Source # 
Instance details

Defined in Telegram.Bot.Simple.Eff

Methods

bimap :: (a -> b) -> (c -> d) -> Eff a c -> Eff b d #

first :: (a -> b) -> Eff a c -> Eff b c #

second :: (b -> c) -> Eff a b -> Eff a c #

Monad (Eff action) Source # 
Instance details

Defined in Telegram.Bot.Simple.Eff

Methods

(>>=) :: Eff action a -> (a -> Eff action b) -> Eff action b #

(>>) :: Eff action a -> Eff action b -> Eff action b #

return :: a -> Eff action a #

Functor (Eff action) Source # 
Instance details

Defined in Telegram.Bot.Simple.Eff

Methods

fmap :: (a -> b) -> Eff action a -> Eff action b #

(<$) :: a -> Eff action b -> Eff action a #

Applicative (Eff action) Source # 
Instance details

Defined in Telegram.Bot.Simple.Eff

Methods

pure :: a -> Eff action a #

(<*>) :: Eff action (a -> b) -> Eff action a -> Eff action b #

liftA2 :: (a -> b -> c) -> Eff action a -> Eff action b -> Eff action c #

(*>) :: Eff action a -> Eff action b -> Eff action b #

(<*) :: Eff action a -> Eff action b -> Eff action a #

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".

Methods

getNextAction :: BotM return -> BotM (Maybe action) Source #

Instances

Instances details
GetAction () a Source # 
Instance details

Defined in Telegram.Bot.Simple.Instances

Methods

getNextAction :: BotM () -> BotM (Maybe a) Source #

GetAction a a Source # 
Instance details

Defined in Telegram.Bot.Simple.Instances

Methods

getNextAction :: BotM a -> BotM (Maybe a) Source #

GetAction Text a Source # 
Instance details

Defined in Telegram.Bot.Simple.Instances

runEff :: Eff action model -> (model, [BotM (Maybe action)]) Source #

eff :: GetAction a b => BotM a -> Eff b () Source #

withEffect :: GetAction a action => BotM a -> model -> Eff action model Source #

(<#) :: GetAction a action => model -> BotM a -> Eff action model Source #

setBotMUpdate :: Maybe Update -> BotM a -> BotM a Source #

Set a specific Update in a BotM context.

setEffUpdate :: Maybe Update -> Eff action model -> Eff action model Source #

Set a specific Update in every effect of Eff context.