Live data from Hacker News

Sky – an Elm-inspired language that compiles to Go

github.com

81–90 of 99 posts

Re: Sky – an Elm-inspired language that compiles to Go

#81
post #63

Earlier quoted context omitted.

Go is simple. People like complexity. So the write abstractions to feel better about themselves.

Complexity does not equal language features. Sometimes simple is good, but sometimes simple just simply means more bugs in your code. As a prime example, Go unwillingness to add even the most simple enum kind of type. Having enums (ADTs) with exhaustive pattern matching is NOT complex in any sense or form. It just takes away so, so many bugs you would normally see in production code. One other low hanging fruit is th…

> Go unwillingness to add even the most simple enum kind of type.

Go has enums, under the iota keyword. But I imagine you are really thinking of sum types. Technically Go has those too, but must always have a nil case, which violates what one really wants out of sum types in practice.

Trouble is that nobody has figured out how to implement sum types without a nil/zero case. That is why you haven't seen a more well-rounded construct for the feature yet. This is not an unwillingness from the Go team, it is more of a lack of expertise. Granted, it is an unwillingness from those like yourself who do have the expertise. What stops you from contributing?

> It just takes away so, so many bugs you would normally see in production code.

What bugs do you imagine are making it to production? Each pattern matched case has a behaviour that needs to be tested anyway, so if you missed a case your tests are going to blow up. The construct is useful enough that you don't need to oversell it on imagined hypotheticals.

Re: Sky – an Elm-inspired language that compiles to Go

#82
post #59
post #16

I will add this to my list of Elm-inspired tools that call to mind Brian Eno's quip about the first Velvet Underground album: "I think everyone who bought one of those 30,000 copies started a band!" With Elm it feels like it's 1% of Elm users creating a language. https://quoteinvestigator.com/2016/03/01/velvet/

You should publish your "Elm-inspired tool" list- I bet it's pretty large. Off the top of my head: iced, react redux, bubble tea (Go lib), Roc lang. I'm sure there are lots more. I'm still waiting for someone to write an "Elm retrospective" and examine its rise and stagnation

I left this comment a while back https://news.ycombinator.com/item?id=45752905 when someone asked what was up with Elm at the current moment. I left a bunch off.

- Evan entered hermit mode to create Acadia, a language for an Elm-like experience querying the database. He's given conference talks about it but none have been recorded. https://acadia.engineering/ This seems to have the same goals as Lamdera.

- Evan hinted that 0.19.2 is coming and has asked for help profiling it https://discourse.elm-lang.org/t/help-me-profile-elm-0-19-2-....

In the meantime the ecosystem is getting crazy evolved. Turns out not changing the language under your feet for a few years leads to lots of development with what's currently there. Frameworks like elm-pages allowed for command line utils in Elm like elm-codegen. Elm-review lets you write linting rules with autofixes unlike anything I've used in other languages. A few people are writing forks and non-forks that target more than the browser or self-host the compiler. Every backend language I've used with decent types has a package to generate Elm types (and their decoders, and a nice way to interact with the JSON API, and deal with glue code generally).

Literal forks of Elm compiler

- Gren (general purpose lang targeting browser, CLI, servers) https://gren-lang.org/

- Zokka (fixes a few compiler bugs and allows for custom package repos) https://discourse.elm-lang.org/t/a-new-zokka-version-bringin...

- Guida (self-hosted compiler) https://guida-lang.org/

Forks that do not ever seek to change the syntax of the language and thus compile .elm files

- Lamdera ("non-fork" fullstack with evergreen migrations) https://dashboard.lamdera.app/docs/starting

- Eco (written in Elm targeting x86 binaries via MLIR and LLVM) https://github.com/eco-lang/eco-runtime

- Elm-run (targeting CLI and servers, self hosted) https://elm-run.dev/roadmap

Languages inspired by it whose creators are big Elm users:

- Roc (general purpose): https://www.roc-lang.org/faq

- Gleam (targets Erlang VM and browser) https://gleam.run/cheatsheets/gleam-for-elm-users/

- Cara https://cara-lang.com/

Things that use the Elm architecture in other languages (linking to pages that mention the connection where possible):

- Foldkit (Typescript) https://discourse.elm-lang.org/t/foldkit-the-elm-architectur...

- Iced (Rust): https://book.iced.rs/

- Bubble Tea (Go): https://github.com/charmbracelet/bubbletea

- Lustre (Gleam): https://github.com/lustre-labs/lustre

- A list of TEA-in-Swift and React in Swift: https://gist.github.com/inamiy/bd257c60e670de8a144b1f97a07ba...

- Redux (Javascript/Typescript): https://redux-toolkit.js.org/rtk-query/comparison

If you read this far and are wondering which to check out, I cannot endorse Lamdera enough. Use the same types from your DB to your frontend and write zero glue code. Migrations required to update the running frontend/backend whenever you change anything. Really changes the way you write code.

Re: Sky – an Elm-inspired language that compiles to Go

#83
post #82
post #59

Earlier quoted context omitted.

You should publish your "Elm-inspired tool" list- I bet it's pretty large. Off the top of my head: iced, react redux, bubble tea (Go lib), Roc lang. I'm sure there are lots more. I'm still waiting for someone to write an "Elm retrospective" and examine its rise and stagnation

I left this comment a while back https://news.ycombinator.com/item?id=45752905 when someone asked what was up with Elm at the current moment. I left a bunch off. - Evan entered hermit mode to create Acadia, a language for an Elm-like experience querying the database. He's given conference talks about it but none have been recorded. https://acadia.engineering/ This seems to have the same goals as Lamdera. - Evan hinte…

You're missing Derw from that list: https://www.derw-lang.com/. Predates all the others, and is from a former core team member (me). I'm also the author of server-side Elm experiment known as [take-home](https://github.com/eeue56/take-home) from 11 years ago. I can see a lot of patterns in Sky's codebase which seem trained on Derw's codebase.

Also authored the first Elm-in-Elm compiler for a limited subset for json-to-elm, then leading to a pure Elm virtual-dom implementation used for elm-html-test!

Re: Sky – an Elm-inspired language that compiles to Go

#84

First - awesome job. Congrats. Self hosting is an accomplishment! But I'm curious to get your thoughts on the process in hindsight. I understand why it's valuable: to cast a wide net in catching bugs and give a good signal that your language is generally "ready". I'm working on a similar language, but worried about going down the self-hosting path, as I think it'd slow me down rather than speed me up. How did it work…

Derw, a human written Elm fork by me, is largely self-hosted. I took that decision with inspiration from Go: 1) it gave me a large codebase which could be used to assess language features on and 2) it gave me motivation to improve generalized performance rather than focusing on the niche use cases (web-rendering).

Re: Sky – an Elm-inspired language that compiles to Go

#85
post #83
post #82

Earlier quoted context omitted.

I left this comment a while back https://news.ycombinator.com/item?id=45752905 when someone asked what was up with Elm at the current moment. I left a bunch off. - Evan entered hermit mode to create Acadia, a language for an Elm-like experience querying the database. He's given conference talks about it but none have been recorded. https://acadia.engineering/ This seems to have the same goals as Lamdera. - Evan hinte…

You're missing Derw from that list: https://www.derw-lang.com/ . Predates all the others, and is from a former core team member (me). I'm also the author of server-side Elm experiment known as [take-home]( https://github.com/eeue56/take-home ) from 11 years ago. I can see a lot of patterns in Sky's codebase which seem trained on Derw's codebase. Also authored the first Elm-in-Elm compiler for a limited subset for jso…

I KNEW I forgot one. I'm really sorry. This list was off the dome and I was hoping to hit a Cunningham's law situation (which I did) without making anyone feel left out (which I failed).

Re: Sky – an Elm-inspired language that compiles to Go

#86
post #85
post #83

Earlier quoted context omitted.

You're missing Derw from that list: https://www.derw-lang.com/ . Predates all the others, and is from a former core team member (me). I'm also the author of server-side Elm experiment known as [take-home]( https://github.com/eeue56/take-home ) from 11 years ago. I can see a lot of patterns in Sky's codebase which seem trained on Derw's codebase. Also authored the first Elm-in-Elm compiler for a limited subset for jso…

I KNEW I forgot one. I'm really sorry. This list was off the dome and I was hoping to hit a Cunningham's law situation (which I did) without making anyone feel left out (which I failed).

No worries at all! I didn't take offense, it's very easy to forget one or two projects when quite frankly, Elm has managed to spawn or inspire so many!

Re: Sky – an Elm-inspired language that compiles to Go

#88
post #31

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.

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!

Re: Sky – an Elm-inspired language that compiles to Go

#89
post #31

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.

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 functio…

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!

Re: Sky – an Elm-inspired language that compiles to Go

#90
post #81

Earlier quoted context omitted.

Complexity does not equal language features. Sometimes simple is good, but sometimes simple just simply means more bugs in your code. As a prime example, Go unwillingness to add even the most simple enum kind of type. Having enums (ADTs) with exhaustive pattern matching is NOT complex in any sense or form. It just takes away so, so many bugs you would normally see in production code. One other low hanging fruit is th…

> Go unwillingness to add even the most simple enum kind of type. Go has enums, under the iota keyword. But I imagine you are really thinking of sum types. Technically Go has those too, but must always have a nil case, which violates what one really wants out of sum types in practice. Trouble is that nobody has figured out how to implement sum types without a nil/zero case. That is why you haven't seen a more well-ro…

For example if a have a type with 3 constuctors, and later one new dev adds one more case and forgets to handle it in every call site. No test will catch this 100%, but something like ocaml will just by compiling the program.

I know fo is not (i dont want it to be) like ocaml, bit any modern language should have some of the basic safety features baked in.

Post reply on HN