contacting Telegram bot api. Difference from all the other 9999 libraries that do the same? Mine will allow to write pure functional handlers. Handlers have signature next -> tgUpdate -> IO.
I wrote a minimal proof-of-concept echo bot, I can send it if somebody is interested, 23 LOC.
IO will be a monadic type, slightly repurposed to behave also as a Reader monad. And in the passed env, lies the actual function to send requests to bot api. So, in other words, IO is not bound to any bot instance when it's created — the env is only passed when IO is being ran.
Maybe Free monad would be a better fit here, but I'm yet to grasp it.
The problem is, how does database fit into all of this? Should the db live in env as well, or not?
Feel free to ask if you don't understand something, I feel as I have everything else about the lib figured out.
while we are kinda talking about functional, I'll remind that this is still open ^
I think the database should just be a part of the IO chain?
Обсуждают сегодня