DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 963,503 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
Cover image for Strictly Typed Functional Programming for Roblox
Jesse Warden
Jesse Warden

Posted on • Originally published at jessewarden.com

Strictly Typed Functional Programming for Roblox

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.

Top comments (1)

Collapse
 
cipharius profile image
Valts Liepiņő

Hah, did not expect to see roblox on dev! That's where I began learning programming ~11 years ago.

Hypatia seems neat, nice find! I've joked about coding roblox game in Haskell like language, but now it actually is possible.

🌚 Browsing with dark mode makes you a better developer.

It's a scientific fact.