Strictly Typed Functional Programming for Roblox
Jesse Warden
Posted on December 11, 2020
I managed to get Hypatia, an Elm and PureScript like typed Functional Programming language that compiles to Lua, running in Roblox. Roblox is a 3D game engine that has a ton of already built games and editor where games are built in Lua. My kids spend way too much time and our money in it. I couldn’t get Amulet, another similar language, too compile, but Hypatia “spoke to me” more. Advent of Code 2020 this year taught me dealing with no types and race conditions is painful. I really wanted to explore what other language options there are that compile to Lua.
The workflow is you write in Hypatia, compile, make the compiled Lua require statements to the Roblox version, and Rojo, a Rust built development tool, will sync your Lua directly into Roblox. You can then call the exposed functions directly from other Lua (i.e. Buttons, events, etc). I’m thinking of automating that require change with Python… or maybe Lua.
Compiling Hypatia required a couple of smart Haskell devs at work to help me compile. Cabal didn’t work but Stack worked no problem on my Mac M1. Hypatia might compile JavaScript too, not sure.
Anyway, still need to figure out side effects (still learning what the heck a f -> Unit is), and how to deal with coroutines and various other side effects since Hypatia doesn’t handle them like Elm does, but super excited to continue exploring this.
Posted on December 11, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.