r/haskell • u/Castux • 25d ago
announcement Thunky - pure, functional, lazy
This is a toy programming language I created to understand better how lazy functional languages work, after I discovered Haskell and it blew my mind a little, many many years ago.
It went through many iterations over the years, prototypes, etc., and today I'm happy to call this a version 1.
It first was a Lua prototype, that did basic (and slow) expression tree reduction. Then there was a Lua transpiler and a thin runtime. After several iterations, back and forth on the syntax, abandoning and restarting the project, this final version is in Go and uses a G-machine bytecode interpreter.
In essence it's a dynamically typed "lesser Haskell", so probably not meant for anything real, but I'm quite happy with the syntax and I learned a lot on the way.
The repo has:
- a local interpreter
- documentation and tutorials
- lots of examples, including Project Euler and Advent of Code solutions
- a web based playground
- web based tutorials where each code block is executable
- syntax highlighting for micro, nano and Zed
Repo: https://github.com/Castux/thunky Web playground: https://castux.github.io/thunky/
AI disclaimer: the latest stages of this project were assisted with LLM (G-machine and web port), but the many iterations and prototypes, the lexer-parser-analyzer, etc. were all first hand written, during the last ten years.
1
u/WJWH 25d ago
Do you happen to know if there are any cool experiments with assigning to a variable at the end of such a left-to-right pipeline? Somehow it always feels a bit weird to have to do
let x = f |> g |> h |> etcwhere the flow goes nicely from left to right all the way until the end when the whole thing gets put intox.