| ▲ | ecshafer a day ago |
| I was thinking of Haskell recently, why isn't it more popular with AI? Haskell is very terse and token efficient, it has many expressive safety features. Rust is getting additional adoption because of its strictness, so hey why not have this in Rust over Javascript if it takes the same time to write? An ideal language for agentic AI I would think is extremely strict, where the AI can iterate over the tooling for correctness. It would probably be less verbose and more terse to allow the AI to be more efficient with tokens. |
|
| ▲ | drewr a day ago | parent | next [-] |
| It's my default for all the reasons you mention. In fact if I have to ship in a different language, I'll often do a Haskell version first to steer towards isolating IO, enforcing referential transparency, and generally picking up other functional patterns that are a good idea no matter what. Then I'll port the Haskell version to whatever the solution demands. |
| |
| ▲ | mncharity a day ago | parent | next [-] | | > do a Haskell version first [...] port As lower-hanging fruit, to get some style steering, but not the strictness/correctness assist in implementation, there's also doing code sketches in hs - writing without testing - and then asking for whatever code as inspired by / in the spirit of / based on the reference sketch. | |
| ▲ | jimbokun a day ago | parent | prev [-] | | With LLMs that’s not a terrible approach. They are generally very good at translating between programming languages. | | |
| ▲ | amelius 8 hours ago | parent [-] | | Yes, this is why I believe LLMs will (finally) allow us all to make the move to purely functional languages. |
|
|
|
| ▲ | calebkaiser a day ago | parent | prev | next [-] |
| I do AI research and mostly work with Lean these days. I love Haskell, though I wouldn't consider myself a particularly strong Haskell programmer (just never spent a ton of time working in it). I think you're spiritually correct that there are lots of reasons to use extremely strict languages with AI, but the reality is a little messier than you'd expect. Token efficiency is specifically the place where strict languages get a little trickier. With dynamic languages where the model has a ton of training data, like Python, the agents are really good at writing code that just works. You still have challenges there, but they're just different than the challenges you hit with a language like Haskell/Lean/Agda etc. With Lean, for example, the amount of things the agent decides it needs to prove for a relatively trivial operation can lead to an absurd amount of code. And the way it decides to prove them can be borderline labyrinthian. It sort of plays perfectly towards current agent weaknesses, where agents can run off and reinvent a lot of machinery and build unnecessarily complex abstractions. And those iterations have a cost. Even if the final artifact is more terse, the path to getting there can involve a huge amount of backtracking and rewriting and off-by-one syntactic corrections. Ultimately, a lot of this comes down to developer experience. Getting useful error messages for the agent, having fast compile times so that the agent can iterate quickly, providing useful utilities for debugging, etc. There was a popular blog post specifically about Haskell that generally makes this point--the Haskell language is, in a vacuum, ideal in a lot of ways for AI, but the Haskell developer experience and ecosystem made it hard for this team to build with it via agents: https://avi.press/posts/2026-07-10-after-7-years-in-producti... Note: I am not advocating against using these kinds of language. Obviously, I still work in Lean and a little in Agda and some related languages/projects, so I think this direction is right. Probably biased in that I love them with or without LLMs, but I do think they're also more ideal for AI development. There are still just challenges in getting agents productive in them, and most of the challenges are not about the type systems but the actual ergonomics and dev experience. |
| |
| ▲ | lallysingh a day ago | parent | next [-] | | I'm wondering the inverse, actually. That LLMs can make regular haskell programming (e.g. typing in code, not english that LLMs convert to code) powerful enough to prefer. Can we have LLMs do enough of the grunt work on building type machinery, dealing with compiler errors, looking up exact types and conversion systems, to make the APIs presented to us preferable? So, I could write what I want in haskell, and it's faster for me than to have an LLM do it. The haskell would be high-level enough and precise enough to describe what I want the program to do with less iterations than I'd have with an LLM writing code, finding its own bugs, fixing them, then having me ask it what it did, tell it what to do differently, etc. Direct control is very powerful. LLMs take that away from us, in exchange for a great speedup. But perhaps we can use LLMs to give it back to us by making our actual programming languages more powerful. | | |
| ▲ | calebkaiser a day ago | parent [-] | | Yeah, I think this is roughly where things are headed. Or at least, it's part of what I'm working on these days, though I'd characterize myself as "generally kind of bad at things," so maybe that's anti-signal. But I think this is actually in the design of many languages already, especially in languages like Lean, where you can prove that the presentable API is correct. Here's one rough example that is related to this direction: A common convention in Lean is to write essentially two versions of a function, with a theorem proving their equality or correspondence. So you can write a more demonstrative version that is more easily understood, which you can treat sort of as a spec that all other implementations must satisfy. And then you can set the agent loose to do whatever nastiness it wants to do to improve performance. Here's a fun write up from someone doing just this with zip file compression: https://kim-em.github.io/blog/2026-7-24-why-lean-is-faster-t... |
| |
| ▲ | sublinear a day ago | parent | prev | next [-] | | > I think you're spiritually correct that there are lots of reasons to use extremely strict languages with AI > With dynamic languages where the model has a ton of training data, like Python, the agents are really good at writing code that just works. I'm confused how the former supports the latter here. Surely, you mean that LLMs are not the right kind of "AI". Languages like Haskell expose how fundamentally porous LLMs are with information. I wouldn't even say it's the dynamic nature of Python that leads to good results, but the consistency. Javascript is the obvious counterexample. There's far more javascript out there to train on than any other programming language, yet LLMs are terrible at writing it too. | |
| ▲ | 3836293648 a day ago | parent | prev [-] | | Just reading chain of thought traces for Agda (I'm using Qwen 3.8-Flash-Next) and it's struggling so hard with just the syntax, long before it can struggle with semantics or type errors. Admittedly I'm not much better, Agda has some crazy scoping rules at times and its operators are a mess, so much worse than Haskell, but at least I don't have to re-learn from scratch after every compaction. | | |
| ▲ | icrbow 11 hours ago | parent | next [-] | | Opus 5.5 has no problem with Haskell in any domain whatsoever, including mixing it up with FFI and eDSLs. You call it, it does it. | |
| ▲ | mietek 13 hours ago | parent | prev | next [-] | | No, Agda's mixfix operators and general syntactic malleability is state-of-the-art in programming language design. Try learning how to write it yourself, before relying on LLM to write it for you. | | |
| ▲ | 3836293648 12 hours ago | parent [-] | | It's a cool hack. It's also a catastrophe for actual usage. State-of-the-art doesn't mean good, it just means new, shiny and complex. Not being able to do syntax highlighting without a full typechecking pass is a usability nightmare. Anyway, that's not the part I the human struggle with, it's remembering what level of infix each new custom operator has. Why λ() isn't equivalent with λ{}, if `a b , c` is `(a b) , c` or `a (b , c)` with this version of comma (Though now I've given up on the others and just use Σ a (λ _ -> b) for all kinds of tuples just to make it consistent). Why implicits won't unify as I expect them to. Why with just doesn't work in a reasonable fashion at all ever beyond the most basic two cases (no nesting and only nest in the final case). Literally copy pasting from the docs doesn't parse. Cool trick, but in practice it was a mistake and Haskell's take on custom operators was far enough. | | |
| ▲ | mietek 11 hours ago | parent [-] | | Here are some resources to help you get started. An Agda course taught in Padova since 2024:
https://agdapad.quasicoherent.io/~Padova2026/ "Programming Language Foundations in Agda", a course taught at multiple universities since 2018:
https://plfa.github.io Conor Titania McBride's lectures on Agda, including videos:
https://github.com/pigworker/CS410-18 Thorsten Altenkirch's lectures on computer-aided formal reasoning using Agda:
https://www.cs.nott.ac.uk/~psztxa/g53cfr | | |
| ▲ | 3836293648 3 hours ago | parent [-] | | Or maybe consider being less patronising and realise that Agda is a mess, regardless of how cool some aspects of it is. I am returning to the language, not new. | | |
| ▲ | mietek 3 hours ago | parent [-] | | There's certainly many things that could be improved about Agda, but they mostly have to do with its semantics. Here's a great blog post about some of them: https://jesper.sikanda.be/posts/why-not-a-core-language.html Operator fixity is a non-issue; if you don't like how the fixities have been set up, you can change them at will, even in the middle of an `import` statement. Nobody is making you use custom infix operators, either; you can write Agda that looks mostly like a Lisp if you wish. Improving `with` is ongoing work; there was a presentation on it at the recent Agda implementors' meeting. There's real people with real feelings building Agda, and not very many of them either. Consider that before publicly denigrating their work, with such shallow criticism to boot. | | |
|
|
|
| |
| ▲ | calebkaiser a day ago | parent | prev [-] | | Yeah I know this pain. I actually have had some success by giving the agent a style guide for Lean that is strictly not conventional. The nice syntactic shortcuts and different modes that make Lean more ergonomic for humans, in my experience, actually make it easier for an agent to trip itself up. |
|
|
|
| ▲ | solomonb a day ago | parent | prev | next [-] |
| I write Haskell every day, both for work and in my free time. Without commenting on the general quality of LLM generated code, my experience is that Haskell is at least as good as any other language for LLM code gen. |
| |
| ▲ | kodoman 18 hours ago | parent [-] | | I have not generated haskell code yet and did some haskell a while ago (before LLMs) and liked it a lot but I would imagine you are prompting the LLM like an engineer so to say and making sure you know the data types and everything before hand and probably tending to write type signatures and asking the LLM to complete it. I would imagine if you vibe code and ask it to write things without thinking that sort of thing though it might produce very bad code, but not sure, would like to know you experience on that matter. | | |
| ▲ | solomonb 13 hours ago | parent [-] | | I don't know how to answer this. I find that the quality of claude's output in any language is highly dependent on your skill at prompting it and what context you can provide. Sometimes I might give it type signatures and heavily micromanage it but other times not. I almost always ask claude to develop a plan and architecture which I review before having it produce code. Here is an example where I literally just told claude I wanted generic instances for these type classes and we had a brief back and forth about the approach then it one shotted this entire module:
https://github.com/solomon-b/monoidal-functors/blob/main/src... I would say this code is indistinguishable from generics code written by a human. However, this type of code has a tendency to only be writable one way. | | |
| ▲ | kodoman 9 hours ago | parent [-] | | > Here is an example where I literally just told claude I wanted generic instances for these type classes and we had a brief back and forth about the approach then it one shotted this entire module Yes this is basically what I thought you where doing (what seems to me the correct thing). I have found it's very good at implementing interfaces or in your case type classes and completing generic functions. Though I am not sure if you wrote the type class definitions in this file or not, but sounds like either way you explained what you wanted. Also this sort of Haskell code is well above what I did in Haskell so I can only take your word for it that this is good code and I am sure it is. Though I always use plans like you, and found them to always be good. I have experimented with just asking it to implement features with minimal direct and it does end up being very bad. Particularly in creating data structures/ data types or interfaces and classes. My guess was only that when you try and get the agent to decide stuff like data types and type classes and how to structure the program it does a poor job and worse then if you did it in other languages. | | |
| ▲ | solomonb 3 hours ago | parent | next [-] | | I did not write the type class declarations in this file but they are generic representation for type classes I did write. I picked an extreme example. Sadly I don't have a great example of more "business" style code in a public repo to show you right now, but I have had a lot of success using LLMs to write CRUDy haskell APIs and such as well. I think LLM output quality is wildly dependent on how we prompt them. And I don't just mean giving a really specific design for it to implement or whatever. I have no real proof but suspect that every little thing about how we communicate to an LLM will impact the quality of the output. Like even just our choice of language in how we describe a problem. I have a friend who is not remotely a programmer who tried to vibe code a big python project with Claude. He came up with really detailed designs and worked through them over and over with Claude. He hit some major roadblocks and asked me to look over the code. I was really shocked at the quality of the code out. There was tons and tons of dead code, unnecessary repeated expensive computations, no real sense of an architecture, etc. I didn't even re-write it by hand, I just asked claude things like "decompose all the functions to a reasonable size", "use modules to organize the code", "remove dead code", "write pure functions", "parse dont validate", etc. It eliminated thousands of lines of crap, became way easier to read, and improved the speed of the program by orders of magnitude. | |
| ▲ | nyssos 8 hours ago | parent | prev [-] | | > My guess was only that when you try and get the agent to decide stuff like data types and type classes and how to structure the program it does a poor job and worse then if you did it in other languages. It's about the same as for other languages, in my experience. LLMs are terrible at Haskell type design, but they're terrible at Rust type design too, terrible at deciding when and how to use Python classes, terrible at deciding when metaprogramming is appropriate, terrible at deciding what is well factored and what is not - great scripters, terrible lead engineers. The root causes seem to be things like bad domain modeling, judgement about which things matter and which things don't, prioritization, and so on, all of which produce bad designs in any language that will let you. The only really Haskell-specific defect I've noticed is an aversion to polymorphism and especially to HKTs. | | |
| ▲ | kodoman 7 hours ago | parent | next [-] | | Yes agree it's not a good architect (and thankful as it puts a ceiling of crappy vibe coded apps and what vibe coders can do). But in languages like go-lang and python it's easier for you to just hand off something you want made to an llm and come back and possibly maintain and fix it in the future or modify it. I have found go-lang fantastic for this, and although I would not do this for an important thing, for writing little tools that are a little beyond what would usually be a script and you want to maintain, it's great. I did this for a tool to insert data from stripe into a db for my service and it was a one shot thing. | |
| ▲ | solomonb 3 hours ago | parent | prev [-] | | > LLMs are terrible at Haskell type design, but they're terrible at Rust type design too, terrible at deciding when and how to use Python classes, terrible at deciding when metaprogramming is appropriate, terrible at deciding what is well factored and what is not - great scripters, terrible lead engineers. I find there are shibboleths you can say which get the LLM into a space where it can do better but generally I agree with you. I also find that if the LLM is working in an existing code base with a really opinionated and consistently applied design that it will largely stay consistent with the codebase. Quality will drift as the ratio of human to LLM code changes so you periodically have to do a big cleanup to keep it from going too far. |
|
|
|
|
|
|
| ▲ | lcprk a day ago | parent | prev | next [-] |
| It's not more popular because Dan Luu actually measured this [1] and those languages aren't better in practice. A priori, it does seem strange. But the relative Haskell vs Python tokens in the internet go a long way to explaining it, as another commenter has said. [1] https://danluu.com/pl-tokens/ |
| |
| ▲ | internet_points 13 hours ago | parent [-] | | My main takeaway from that post was that, apart from "don't use assembly", none of the experiments showed strong evidence either way, and the things that took time were when the agent got stuck doing silly things like invoking cargo with the wrong arguments. Ie. there's a lot of measurement noise, and not any strong signal, and "LLMs are good at generating $PL" isn't well-founded as an argument for picking $PL. So we're back to the old arguments for picking a language, like "I find it readable/enjoyable" |
|
|
| ▲ | kccqzy a day ago | parent | prev | next [-] |
| The popularity or the lack thereof has nothing to do with AI. AI writes good Haskell code, certainly not worse than much more popular languages like Python. But I just don’t think terseness matters much; most of the cost is spent on reasoning tokens, not the sheer volume of code output. |
| |
| ▲ | flossly a day ago | parent [-] | | One "did not compile, fix error, try again" loop takes so many tokens, that a well-trained-on lang like JS/Py/Bash/C easily outperforms a strict one. The benefits of strict are still the same: once the code grows bigger you have alll kinds of guarantees built into the software, that JS/Py/Bash/C needs lots of test achieve the same. Since writing code is cheap, it like to go more on the tests and the strong typing, simply because it is so cheap. Why write Ruby/Py/JS when you can write Haskell/Kotlin/Rust? There's simply no reason not to be doing TDD these days. |
|
|
| ▲ | cowlevel 15 hours ago | parent | prev | next [-] |
| LLMs predict next tokens following their training data. Following "so i wrote this little program in", "Haskell" is not a likely prediction. |
| |
| ▲ | N_Lens 8 hours ago | parent [-] | | At this stage, people who parrot “next token prediction” appear the most predictable of all! |
|
|
| ▲ | Hendrikto 9 hours ago | parent | prev | next [-] |
| Haskell just feels too much like the academic experiment it is. And you really get the feeling that this is what most of the community and leadership want it to be. |
|
| ▲ | klntsky a day ago | parent | prev | next [-] |
| Haskell does not have a good low level library wrappers story, unlike Rust. Nobody prepared it for adoption nearly as much as Rust evangelists did for their language. Years of hard work they invested into maintaining bindings as hobby projects paid off. |
| |
| ▲ | internet_points 13 hours ago | parent | next [-] | | Hm, I found writing FFI code from Haskell quite easy. I've been meaning to try the new
https://well-typed.com/blog/2026/10/hs-bindgen-official-rele...
which looks even nicer, but haven't found a missing library yet to try it on :) | |
| ▲ | kccqzy a day ago | parent | prev | next [-] | | People care a lot more about Rust-C++ interop because people expect to replace C++ with Rust. People don’t care as much about Haskell-C++ interop, so in the end people just rely on C ABI because it’s the lowest common denominator. If your low level library has a C interface, Haskell works very fine. Some people even prefer the OpenSSL C library over Haskell-native TLS. | | |
| ▲ | klntsky a day ago | parent [-] | | Businesses care. I worked with Haskell in production (a fairly normal B2B SaaS). Some things you would expect to have in the ecosystem had to be maintained domestically. My former company was generous enough to publish most of these[0] as open source projects. But what's really telling is that oftentimes vendoring a commonly used OSS library was unavoidable. [0] Here's a potentially incomplete list: https://chatgpt.com/s/t_6af76fd8f2a081918fa37f8c30bdb3ba |
| |
| ▲ | icrbow 11 hours ago | parent | prev [-] | | It totally can wrap c and c++ and whatnot. The hard part is done only once, then it is incremental maintenance that's mechanical. Some are even scripted. Huge API surfaces like Vulkan and AWS were bound and used that way. |
|
|
| ▲ | danpalmer 21 hours ago | parent | prev | next [-] |
| > Haskell is very terse and token efficient I'm not certain this is the case. I find AI better at producing code in languages where there are fewer abstractions. It's great at writing Go, because everything is there on the page in text/tokens, and I find it less good at writing (good) Swift, because there are lots more abstractions for it to reason about, which are not written in text/tokens on the page. This is part of why I think LLMs producing dense and unpleasant to read text is linked to their ability, it's no coincidence that people have this criticism of all of the independently developed frontier models. We can train around this, the frontier models are getting better at it, but it's a good reminder that LLMs are just text calculators at some level, and do much better when the concepts are in text rather than abstractions in our minds. |
|
| ▲ | GZGavinZhao a day ago | parent | prev | next [-] |
| Is it really better than Lean though? I started learning programming in Haskell but gradually transitioned into Lean, both because it has almost everything Haskell has (minus laziness), great meta-programming support, and most importantly allows me to drop down into proofs / formal verification if needed. |
| |
| ▲ | cosmic_quanta 12 hours ago | parent | next [-] | | What's the runtime performance of a lean program? I've ever used it. Haskell has had 36 years to get a really good runtime system (including software transactional memory, pure concurrency bliss) and an amazing optimizing compiler | | |
| ▲ | nyssos 8 hours ago | parent [-] | | Good enough to be usable, still several times slower than Haskell. |
| |
| ▲ | icrbow 11 hours ago | parent | prev [-] | | Better than Lean for what? It certainly has more ready to use packages in a bunch of domains. |
|
|
| ▲ | alethic 12 hours ago | parent | prev | next [-] |
| Because Lean 4 exists, which is a strictly (heh) better Haskell. In seriousness, Lean is indeed a better Haskell (strict-by-default, performant data structures, BEAUTIFUL do-notation, full dependent types, etc), and you indeed do see a lot of slopped-out projects in it. However, certainly fewer than Rust, to be sure. I think the bitter truth of the matter is that additional static guarantees beyond what specifically Rust gives you -- type safety, interfaces, and linearity -- are simply not worth all that much in practical software applications. |
|
| ▲ | segmondy a day ago | parent | prev | next [-] |
| It's as popular as you make it. Nothing is stopping you from using it. People generate code for what they are familiar with or have desire for. There are people who have wanted to give rust a try and AI opens that possibility up. There are certainly less people that want to try Haskell. Furthermore, Rust has more training data so LLMs generally will provide better Rust code than Haskell code. Because of LLM, I'm back into obscure languages that I didn't have the mental capacity to carry day by day. Prolog, Lisp and Forth, and like you said, they are very terse and token efficient. However, I must point out that terse was only relevant prior to the entire thinking era, a model could use 100k tokens to think only to give you 100 tokens of final output. |
| |
| ▲ | pimeys a day ago | parent [-] | | I've been generating probably 500k lines of Rust with all the SOTA models (and now DeepSeek). Every model does an absolutely horrible job generating good Rust code. You have to babysit it and you need to question everything the model spat out. I mean, free functions and no general nice trait/struct/enum based architecture, random `Mutex`/`RwLock` everywhere, all your big futures inside a `tokio::select!` etc. Yes it's great when you do your first Rust project. After a year it's a nightmare if you don't keep a clear control how the code is generated and organized. |
|
|
| ▲ | srcreigh a day ago | parent | prev | next [-] |
| The ideal language is the one the agent knows how to use. I used prolog for a project and GPT 6.1 Sol repeatedly made dumb mistakes as if it doesn’t understand the symbolic resolution capabilities. For vibe coded Haskell id not be surprised to see it just not use strict types, hucking strings around |
| |
| ▲ | seizethecheese a day ago | parent | next [-] | | We happen to have data on GPT 6.1 Sol and programming languages used, so I looked into this. Looks like the claim is true that Sol sucks at the long tail of languages (vs. battle opponents). https://micjm.com/blog/gpt-6.1-sol-long-tail-languages/ | | | |
| ▲ | a day ago | parent | prev | next [-] | | [deleted] | |
| ▲ | pimeys 15 hours ago | parent | prev | next [-] | | Pretty much like with Rust it passes Value or String more often than using a struct for JSON data... | |
| ▲ | icrbow 11 hours ago | parent | prev [-] | | You can totally demand doing most of the domain modelling in types before messing around with implementation details. Plan.hs > plan.md |
|
|
| ▲ | faangguyindia 21 hours ago | parent | prev | next [-] |
| If you are developing on mac and deploying to linux, Haskell is pain. I had to switch to Rust for this reason otherwise Haskell was decent for my project |
| |
|
| ▲ | dcss_gardener a day ago | parent | prev | next [-] |
| The ideal language for the AI has very short feedback loops with highly localized errors and minimal up front reasoning about types that itself provides a surface for flailing and errors. I'm not familiar enough with haskell to say for sure but I don't think this describes the language very well. The ideal language for the engineer driving the agent has maximum comprehensibility, since review and understanding are the real bottlenecks now. I'm also pretty sure this doesn't describe haskell. It incompletely describes rust I think. It does describe ocaml. And also gleam and maybe scala. And moonbit, developed by someone who is a proven expert in exactly this domain and explicitly targeting this problem space. |
| |
| ▲ | jose_zap a day ago | parent [-] | | Yet, "short feedback loops with highly localized errors" is exactly what Haskell is. You can start Haskell in interpreter mode (ghci) and you get instant feedback. Errors are always localized. Although my experience with claude in the last few months shows that it rarely hits a compilation error at all. |
|
|
| ▲ | neutronicus 7 hours ago | parent | prev | next [-] |
| There was one post about a startup moving from Haskell to a Python because compile times had become a bottleneck for their Agents. |
|
| ▲ | thatsabadlook 10 hours ago | parent | prev | next [-] |
| That's when you know a company wants to irreversibly go full vibe code. Turn their entire stack into LLM generated haskell. No one will ever read it again the end. |
|
| ▲ | win311fwg a day ago | parent | prev | next [-] |
| > Rust is getting additional adoption because of its strictness That's doubtful. It's not strict in any way that matters, especially when LLMs are writing it. You still have to rely on tests for everything. The languages that are strict are still largely ignored. It is seeing adoption because of a well executed advertising campaign combined with "C++ without the dependency hell" being a real value proposition. |
|
| ▲ | _doctor_love a day ago | parent | prev | next [-] |
| The most interesting idea in this space I have heard is to have LLMs generate formally verified assembly. And then from that assembly generate higher levels projections in languages like Haskell to help the human understanding. |
| |
| ▲ | klntsky a day ago | parent [-] | | It's not going to work. Formally verified assembly needs a low level spec which is comparable in length to the assembly code, so not really comprehensible. "higher level projections" - wtf is this even about? |
|
|
| ▲ | redeeming a day ago | parent | prev [-] |
| [dead] |