News for hackers. Stuff that matters.
Re:If AI writes your code, why use Python? by hiAndrewQuinn on Tuesday May 12, 2026 @03:43AM (#48105382)
Haskell would be my vote, and Rust too, actually, both because of their very strong type systems. The type system lets you very quickly figure out what something is before you figure out what something does, and it turns out that separating those two concerns as hard as those two languages do often results in doing the whole one-two punch faster.
Re:If AI writes your code, why use Python? by lukan on Tuesday May 12, 2026 @06:03AM (#48106193)
Haskell does not qualify for a large training set, though. (Nor for readability in my opinion)

I think I have never seen haskell software made wih LLM's but well, aside from university, I have not seen Haskell code at all. (Also Haskell purists I would associate with people who avoid LLM's)

I would rather go with Rust given these choices.

But I have good results with typescript (or javascript for simpler things). Really large set of examples. Tools optimized for it, agents debugging in the browser works allmost out of the box. And well, a elaborate typesystem.

Re:If AI writes your code, why use Python? by klodolph on Tuesday May 12, 2026 @09:07AM (#48107716)
I used Claude to generate Haskell and it works really well. Claude struggles sometimes with respecting abstraction boundaries, but Haskell enforces parts of those boundaries in its type system better than a lot of other languages (if a module can’t do IO, for example).

Works well, in my experience. Sometimes the agent does weird stuff that you have to rewrite, but I get the sense that this happens in any language.

Maybe Haskell’s training set is not large enough, but it seems to work despite the smaller training set.

Re:If AI writes your code, why use Python? by co_dh on Tuesday May 12, 2026 @10:57AM (#48109277)
I used Claude that created a terminal based table viewer from rust first, to lean , and finally to Haskell. https://github.com/co-dh/tv-hask/tree/main

I give up rust because it’s not functional enough. There aren’t many things Claude can prove about a table viewer, and Haskell fits very well, and have enough libraries. Claude is pretty good at Haskell. I barely write Haskell before but I do know monad.

Re:If AI writes your code, why use Python? by mightybyte on Tuesday May 12, 2026 @03:43PM (#48113400)
How much code do you think is necessary for LLMs to be good enough?
Re:If AI writes your code, why use Python? by jorvi on Tuesday May 12, 2026 @08:14AM (#48107154)
Bit of a nit, it isn't the strong typing that makes Rust great for LLMs, it's the very strict compiler.

Plenty of languages have strong (enough) typing but their compilers happily let you or the LLM footgun yourself.

Re:If AI writes your code, why use Python? by hiAndrewQuinn on Tuesday May 12, 2026 @11:49AM (#48110015)
Oh, that's fair.
Re:If AI writes your code, why use Python? by pmarreck on Tuesday May 12, 2026 @02:51PM (#48112625)
Same reason Zig is great for LLM's
Re:If AI writes your code, why use Python? by Yokohiii on Tuesday May 12, 2026 @09:54AM (#48108354)
Wouldn't a LLM just produce a massive type gibberish long term?
Re:If AI writes your code, why use Python? by freedomben on Tuesday May 12, 2026 @10:01AM (#48108458)
I've "written" a lot of rust via LLMs, and the rust tooling and features give a lot of useful guard rails to LLMs that produce pretty good code overall, certainly compared to the python I've seen it crank out. Clippy and fmt alone often cause the LLM to hit a snag and realize it's mistake and take a better approach. It's quite a powerful combo IME
Re:If AI writes your code, why use Python? by gf000 on Tuesday May 12, 2026 @10:03AM (#48108481)
There are many languages with similarly strong type systems - Scala, Kotlin, OCaml, etc (and nowadays, even Java). A GC may also be an advantage in that the LLMs may get it right in less tries.
Re:If AI writes your code, why use Python? by hedora on Tuesday May 12, 2026 @10:12AM (#48108596)
I’d add perl (similar runtime semantics as python, but at least sigils give you some hint of developer intent. If you see &@%$$ck() in perl, you know you’re in for a ride).

I’d also add, C, C++, Rust, Java, Swift, Typescript, Ruby, Lisp, Make, Awk and Sed.

The only thing I’d rate a tie is Javascript.

Re:If AI writes your code, why use Python? by bonesss on Tuesday May 12, 2026 @11:13AM (#48109528)
In the window of Haskell-like and highly readable, I’d throw OCaml and F# out as strong candidates.

In practice your code can be cleaner than Python, deeply flexible naming capabilities including full sentences with backticking, efficient and powerful discriminated unions and types enable near-English domains, the type system keeps you honest and provides exhaustiveness guarantees, domain modules of applied functions are obvious and locally coherent domain grammars, and there is potent DSL support to create mini-grammars for legibility and expressiveness.

I used to write python by hand to reason then type it up in C#. F# is just as easy with a pen, but far more powerful and with a powerful type system and aggressive compiler. OCaml and F# are also highly token efficient languages, beating Python across the board for agentic work.

Re:If AI writes your code, why use Python? by pmarreck on Tuesday May 12, 2026 @02:50PM (#48112611)
If you're going to go Haskell, why not go all the way to Lean 4 and get mathematical provability along with reasonable speed and type-safety?