Nice to see another language with Haskell / Miranda type syntax, but the vibe-coded implementation sure shows: e.g. src/Compiler/Infer.sky isUpperStart:
isUpperStart : String -> Bool
isUpperStart name =
case String.slice 0 1 name of
"A" ->
True
"B" ->
True
"C" ->
True
... for 23 more cases.
And the corresponding go code in the bootstrap compiler is even worse.
I started my career cleaning up systems written by solo devs in the pre internet era. I’ve seen a lot of starts_with_UCase() implementations like that.
I see now I’m going to end my career cleaning up systems written by chronically online vibe coders, making all the same mistakes, with none of the excuses.
Thanks for the feedback and taking the time to look at the repo.
Yes I must admit this is part of the trade-offs, as I want to iterate fast until a point where the compiler is stable enough to build most common realworld applications, and I will then clean up the "noise" where Claude Code creates/emits.
I'd love hand building everything myself, but given how productive CC & general AI tool can be, it's an ugly trade-off I would take, for now.
These kind of issues, hopefully will be addressed by v0.9-v1.0, please feel free to check on the repo and see where it goes, thanks!
Does this language use ASCII or Unicode strings? I think this implementation is technically correct for the strict subset of ascii characters, but as soon as you add more, it stops working. EG I'm pretty sure Á or Ó are capitals, and are included in Windows-1252 which is apparently extremely common in non-unicode strings, and there are a huge amount of unicode characters that are uppercase, in which case this function isn't even slightly correct
it first started with ASCII, and quickly I realised it has to support unicode. I have since updated it, but some of the compiler string interpolation & friends aren't optimised for unicode yet.
I will fix those by v0.8, and please feel free to visit the repo to check on its progress. And thanks for taking the time!
Haskell/Miranda use `::` instead of `:` for type signatures unlike Elm & basically the rest of the family which prioritize types being less keypresses than list cons.
Sorry, I meant "Haskell / Miranda style syntax" -- e.g. curried functions, concise syntax with little boilerplate, etc. The word type is too overloaded ;-)
An example where this is useful is to help inline otherwise recursive functions, by writing the function to take some useful parameters first, then return a recursive function which takes the remaining parameters. This allows the function to be partially in-lined, resulting in better performance due to the specialization on the first parameters. For example, foldr:
foldr f z = go
where
go [] = z
go (x : xs) = f x (go xs)
when called with (+) and 0 can be inlined to
go xs = case xs of
[] -> 0
(x : xs) = x + go xs
which doesn't have to create a closure to pass around the function and zero value, and can subsequently inline (+), etc.
Don't know if my language is considered Lil' enough for this, but it's a pure, lazy functional language based upon Miranda (progenitor language to Haskell) that compiles to x86-64 asm. ~6700 SLOC for the (self-hosted!) compiler, and ~3300 SLOC additional for the extensive library of functional data structures and functions.
I really loved Miranda back when I learned about it. I still have the book. I think it never took off because it was quite expensive for universities to use. Im sure David Turner regrets his price model today. Now he has made Miranda available here https://www.cs.kent.ac.uk/people/staff/dat/miranda/
Yes, the open-source release he did is what introduced me to Miranda. I rewrote a lot of my previous Haskell solutions to Advent of Code puzzles with it, and liked it so much I decided to try to improve on it ;-)
That's what led to Admiran. I originally wrote Admiran in Miranda, then bootstrapped from that to self-hosting when it was stable enough to do so. The original Miranda combinator compiler / interpreter took 20 minutes to compile all of Admiran, while the self-hosted version now takes 20 seconds.
One of the grad students of David Turner has taken up maintenance on the original Miranda source; the repository is now at https://codeberg.org/DATurner/miranda
Either newt was already in the list, or it got added. We talked a bit about using our languages for AoC 2024 -- looks like you've been keeping busy working on it!
Yeah it has been fun. Lots of directions I can take it:
Since I have an LSP, I've got faster turn around and can add editor functionality that requires poking at the compile state. That's my current thread.
I have a C backend on hold, while I think about how I want to represent data without boxing everything and about whether I want to do reference counting or GC. (Reference counting unlocks "counting immutable beans" if I decide to give that a go, but I'd also like to try implementing GC someday.)
I should do some browser interop stuff and write something other than a compiler in my language.
And there are language enhancements: implementing "Do unchained" from Lean, automatic handling of lazy and/or async modalities, deriving implementations of classes, ...
The logo for Smalltalk-80, and later Squeak, came from the Robert Tinney cover of the Byte issue which introduced Smalltalk. The story behind it is documented here:
The author includes some easter-eggs (printing random facts about Zen and various C constructs) which trigger randomly -- check out the file src/zen/zen_facts.c in the repository...
yep, https://github.com/lukechampine/slouch. Fair warning, it's some of the messiest code I've ever written (or at least, posted online). Hoping to clean it up a bit once the bytecode stuff is production-ready.
Yes, there are some cool solutions using laziness that aren't immediately obvious. For example, in 2015 and 2024 there were problems involving circuits of gates that were elegantly solved using the Löb function:
AoC has been a highlight of the season for me since the beginning in 2015. I experimented with many languages over the years, zeroing in on Haskell, then Miranda as my language of choice. Finally, I decided to write my own language to do AoC, and created Admiran (based upon Miranda and other lazy, pure, functional languages) with its own self-hosted compiler and library of functional data structures that are useful in AoC puzzles: