Lambdabot - Haskell

Welcome to the Functional Programming Zulip Chat Archive. You can join the chat here.

TheMatten

@Asad Saeeduddin We don't have Lambdabot yet - we would need some server to power zulip bot itself

Asad Saeeduddin

@TheMatten Is it possible to run this server in a Docker container?

Asad Saeeduddin

I have a VPS I can run it on, provided it can be resource limited and isolated from the rest of the system

TheMatten

It think it shouldn't be a problem - though I would like to create our own bot based on hint if possible, because original Lambdabot is a little bit buggy and has limited imports

TheMatten

We should be able to limit resources through GHC flags - then there's Safe flag to limit unsafe features of language, plus we could provide some fake IO with limited functionality

TheMatten

And it would be nice to be able to import some restricted set of common packages, or at least have them available - like, most of Kmett's stuff

Asad Saeeduddin

I'm not sure I trust resource limiting at the application level that much. If I run it on my VPS I'd want to put it in a Docker container and enforce network/file/resource access using the standard containerization primitives

Asad Saeeduddin

that said if it's inside a container I don't really care whether it uses safe or unsafe features

Asad Saeeduddin

is a hint based bot persistent, or can it be started up to serve a request and then disposed?

TheMatten

We can do both - it could potentially limit amount of needed restarts if users try something fancy, and one never knows if there isn't something Docker could potentially miss
Not sure how hint handles it precisely - but looking at code it seems like it's InterepreterT is run by initializing new GHC session?: https://www.stackage.org/haddock/lts-14.25/hint-0.9.0.2/src/Control.Monad.Ghc.html#rawRunGhcT

TheMatten

So if we ran every request in separate InterpreterT, it should "clean up" after itself?

Sandy Maguire

i don't see the appeal to lambdabot

Sandy Maguire

ghci is only four letters long :)

Asad Saeeduddin

@Sandy Maguire I wanted to try out some free theorems, idk how you do that in ghci

Asad Saeeduddin

The article I was looking at online said you can do it in lambdabot

Asad Saeeduddin

Lambdabot has a feature where you can give it a type and it will tell you the free thorems of that type

Sandy Maguire

they're not too much work to run the maze on

TheMatten

Okay guys, I have (maybe crazy) idea how to do this basically for free:

API for running code inside docker containers. Contribute to prasmussen/glot-run development by creating an account on GitHub.
Outgoing Webhooks allow you to build or set up Zulip integrations which are notified when certain types of messages are sent in Zulip. When one of those events is triggered, we'll send a HTTP POST payload to the webhook's configured URL. Webhooks can be used to power a wide range of Zulip integrations. For example, the Zulip Botserver is built on top of this API. | Zulip supports outgoing webhooks both in a clean native Zulip format, as well as a format that's compatible with Slack's outgoing webhook API, which can help with porting an existing Slack integration to work with Zulip.
TheMatten

And I mean, it should be simple to generalize this to any of the supported languages

Code runner. Contribute to prasmussen/glot-code-runner development by creating an account on GitHub.
Ryan

Worth noting that Google Cloud Run lets you run cloud functions from arbitrary Docker images with a generous free tier and built-in runtime restrictions

Ryan

I think that could cover pretty much everything, the webhook could be directed towards the cloud run endpoint