The Pura project's officially complete!

Now, look. I know what everyone’s thinking, what sort of developer writes a blog after a project is done? Where’s the whole project wiki, progress report, the late-night ARGHHHHHHH when you try to implement the monad transformer stack for your compiler’s type checker, the point of enlightenment and the final rite of passage of every Haskell developer out there to ask anyone who questions their code, “A monad is a monoid in the category of endofunctors, what’s the problem?”.

The only answer I have to that is, I didn’t think of it.

But anyway, now that I have thought of it, nobody can stop me from gushing all about it.

So Pura, is this language I made up (what language isn’t made up?) that currently compiles to JavaScript. I wrote the compiler in Haskell following Stephen Diehl’s Write You A Haskell loosely, while also reading some other books on the topic (long names, just go check my report here if you’d like to know the entire list).

It’s a cool little language, inspired by Haskell but now you don’t have to worry about indentation (except I really need to get back to it and implement some basic pattern matching because writing a bunch of if-then-else expressions is getting old very fast). Elm was also a big inspiration (Pura literally compiles to JavaScript, follows Elm’s TEA except because it is a solo project, it isn’t optimized at all, and re-renders the entire DOM whenever there’s a signal). The most important part to me, personally, is that I implemented the Hindley-Milner type inference system from basics and actually had… fun (after spending hours staring at buggy code where substitutions would not propagate, that is). Up next I’m thinking of maybe taking inspiration from Koka’s algebraic effects.

Fig. 1: How it feels to implement yet another compiler that compiles stuff to JavaScript. Did I mention I like Hollow Knight?

Now, to those of you who don’t know anything about compilers or Haskell, you may be thinking:

What.

And I understand. I really do, I felt the exact same way when I began writing Pura (except I forgot to write about WHAT I was doing), and now that I’ve finally realized “Hm, I should’ve probably written about this somewhere except the report in human-readable terms”, fear not. As I further develop Pura (which I will), I’ll be filling you out from the beginning of the project little by little, with both progress updates and explanations. I’ll also likely be reading Crafting Interpreters and implementing Lox, so I’ll add a little of that stuff as well.

Funny how “X is officially complete!” is the beginning of the whole thing here, but well, if anyone’s reading, bear with me.

And since this is my first blog post, well:

main : Unit
 let main = print "Hello World!" REQUIRES ConsoleWrite

Edit 2025/01/22 : Converted Haskell to Pura as suggested by a friend because, well, I did make a language.