1 hour ago · 12 min read2308 words · Tech · hide · 0 comments

Magix is a neat tool that lets us run Haskell programs as scripts1. We put a shebang on top mentioning Magix, list the Haskell packages we need, and ./script.hs just works. This post is about running such a script fast(er) on GitHub Actions. This post was originally published on abhinavsarkar.net. ContentsThe SetupThe ProblemThe IdeaThe BundleThe GitHub Actions WorkflowThe PayoffThe Conclusion The Setup# As our example, we’ll take the static site generator (SSG) I wrote some time ago: BlogShake. It is written as a single Haskell file. It uses Shake to build the website, Pandoc to render posts, and Mustache for templates. The script starts with these Magix directives2: #!/usr/bin/env magix #!magix haskell #!haskellPackages mustache pandoc shake feed yaml #!ghcFlags -threaded -O2 Running the script is as simple as: ./blog.hs Magix compiles the script into an executable and runs it. Nothing else to install, no cabal, or nix-shell required. Nix and Cabal can also run scripts by providing…

No comments yet. Log in to reply on the Fediverse. Comments will appear here.