logoalt Hacker News

pianopatricktoday at 6:41 AM8 repliesview on HN

The thought crosses my mind that Haskell may be uniquely suited for AI coding using a very small context window (cheap). Haskell encourages small functions and no global state. So you may be able to capture all the relevant context for editing a Haskell function within a few hundred or few thousand tokens. That would be better than some other languages. Plus the strong typing could help AI agents catch errors.

I have not played around with it to see how that plays out with agentic coding. But it does seem like an interesting idea.


Replies

the-grumptoday at 7:04 AM

As someone who loves Haskell more than any other language, some challenges are

- the tooling is decades behind, say, Rust or Go

- finding the right library in looks very different in Haskell--you frequently start with the signature on Hoogle. Agents can learn this but it's not the same as "web search"

- creating the right solution also looks different. It's usually borne out of thinking about the types and coming up with the correct algebra. Again models can probably learn to create the right types and orient the solution around that, but it's not automatic

- same today as yesterday, laziness is a blessing and a curse. The runtime can do unpredictable things when you suddenly evaluate a deep thunk

- GHC directives effectively mean there are multiple "Haskells"

Some of those are a result of the "avoid success at all costs" mantra. You can't shake that off in a day. It will take a concerted effort to make it more amenable for seamless adoption.

Haskell continues to be my favorite language to write and read, but Rust is the more practical language with a rich type system. If you're looking for something approaching Haskell's expressiveness but with fewer of these issues, check out PureScript.

show 6 replies
isattytoday at 7:49 AM

As an intermediate Haskell programmer, I’ve found that using AI to debug or learn Haskell is a better use of time than generating a lot of code with it.

Even without AI most of my Haskell time is spent thinking.

Also, I hand writing Haskell is one of my small after work pleasures.

show 1 reply
internet_pointstoday at 8:10 AM

There are lots of people successfully using agents with Haskell, for example

* https://github.com/digitallyinduced/ihp/ is mainly written with Claude now

* https://jappie.me/haskell-vibes.html is gushing over agent-written Haskell

* https://discourse.haskell.org/t/anti-llm-sentiment-considere... huge thread about the divisiveness of LLM's from some person who loves using them with Haskell

I can see how agent coding is a nice fit for Haskell, since LLM's tend to be best at tasks where you can easily verify the output – and GHC lets you easily verify much more of your domain than say Python (sure you can test some of what dynamic typing doesn't catch, but LLM-written tests do not always do what you think they should[0]). At the same time, the LLMs tend to not code golf unless asked to, and they don't care if they have to wait for dependencies to compile, so that takes away the two major Haskell time sinks.

[0] https://haskellforall.com/2026/05/type-out-the-code#:~:text=...

jappgartoday at 11:06 AM

"no global state" sure but sprawling monad constraints mean you're jumping around more than other languages.

The terseness of Haskell just hides the inherent complexity of the problem. The AI (or human) still needs to uncover that complexity in order to do non-trivial things.

thesztoday at 1:06 PM

I think you may find helpful this [1] almost 20 years old [2] agent.

  [1] https://github.com/augustss/djinn
  [2] http://lambda-the-ultimate.org/node/1178
The context window it requires for AI coding can be as short as half a dozen of tokens.
idle_zealottoday at 7:01 AM

I suspect that the compact nature of the syntax would require more tokens spent "thinking" to get decent results. It might be more efficient for simple code though. Either way worth testing. Surely someone must've set up a "how well LLMs handle Xlang" benchmark suite.

show 2 replies
uHugetoday at 7:13 AM

Yup, it was mostly pleasure AI coding a company codebase in Scala. I'm considering it for next projects for this reason although my understanding and intuition for Scala code is much weaker than for Python.

angledtoday at 10:28 AM

I was a little disappointed with the results I was seeing in F#. I thought the .NET + GPT-5.* pull through would be sufficient but it never seemed to work out. Maybe I just wasn’t approaching it correctly.

show 1 reply