haskell/play-haskell

Running external code snippets via the playground

Closed this issue · 2 comments

Apologies if this is a silly question, but I'm interested in being able to run Haskell code snippets on my own pages, and I'm wondering if I can use this project. For example, on a page like https://haskell-docs.netlify.app/packages/megaparsec/ it would be great if I could add a "run code" button, that would either link to the playground with the code pasted in, or even directly run it on the site.

Do you have any thoughts on how I might achieve that?

Have you looked at the API section in the README? On your webpage you should be able to send a POST request to the playground instance directly, e.g. via XHR. This way your server doesn't have to do anything, and spam control tracks your users' IP address instead of your server's, which makes that work too.

Does that work for you or do you need something different?

Sounds great, somehow I missed that!