FP architecture patterns and "agentic programming"

Hi, I’m wondering if the folks here have any thoughts on how some of the FP ecosystem might change with agentic programming, or perhaps change agentic programming. (we can just call it vibecoding, right?) I am barely even a beginner OCaml guy, so I would love to get input from people who tackle some of these subjects at an advanced level. I was in a place of extreme AI skepticism but then a client bought me the expensive Codex plan right around when the models got good last November, and now I regret to say I’m actually a bit enthusiastic about it. I’m interested in formal verification, effects, and DSLs. I don’t have a lot of real experience in how they work, but wanted to maybe bring this experience to people who did.

I watched an interesting interview with Simon Peyton Jones where he said that he thought that AI would shift the landscape significantly to FP and I’m quite inclined to agree with this. I’ve been hitting the slop mines pretty hard in the last 8 months or so, and have built non-trivial slop piles in TypeScript, Go, and OCaml. I think the experience in OCaml is so much better. Even with limited training data, the code that is outputted is of such a higher quality due to the compiler features of OCaml. I tried doing a project in Go again a couple weeks ago, and I was so frustrated by the experience (which I once considered to be the gold standard for vibecoding languages) that I just took a day and refactored the entire project back into OCaml. Seriously, it’s that different. I’m saying this not to blow smoke but because I thought folks here might just want to know. I’m using exclusively open weight models, by the way, and they’re absolutely not optimized for OCaml.

Beyond this, I touched some topics in another thread but I figured that it might deserve its own topic here with Jane Street’s recent announcement. I made this observation last week on this forum - I think AI coding is going to increase the utility of formal verification significantly. As Yaron observed - The cost and accessibility of formal verification is decreasing dramatically due to the cheap slop cannon, while the utility and importance of formal verification is increasing dramatically, also due to the cheap slop cannon. I would be super interested to hear the perspectives about the intersection of real world formal verification and software that, uhh, does stuff (sorry!).

Effects seems super useful and incredibly timely as well. Now, I barely understand effects, but to the extent that I do, it seems like it enables the “Formally verifiable core, typechecked and managed side effects” architecture pattern that really seems like it’s probably going to be the future of code. I really like the Pi.dev coding agent. It doesn’t follow this pattern, per se, but the developer Mario has a game dev background, and was able to build an extremely solid and performative core which enables really effective agentic plugin development on top. I think this is kind of the conundrum, not just with side effects but also with security - OpenClaw gives agents free reign but is obviously a security nightmare for anything of importance. The big question is “how do we find a balance between security and utility”, and “how do we find a balance between stability and function”.

The last pattern I’ve been looking at is DSLs. I have not had much exposure to compilers, I’ve read a little Knuth (I haven’t even talked about literate programming!) and sort of learned how they function but I’ve not hand coded one. However, despite my own ignorance, I’ve had some success vibecoding DSLs for tasks which would otherwise absolutely not require a DSL. I’ve made a DSL to track my homemade root beer recipes, and it really seems to Just Work. The agent can make new “views”, produce new workflows, and answer questions about my recipes and doesn’t really mess up at all. I’m sure that beneath the hood is some of the worst code you’ve ever seen - I don’t really have an eye to read lexer / parser code and identify bad patterns.

This brings me to submit my last point to smarter people than myself: I am still in the “Read the code” camp and I’m not convinced this is going to change. Now, I’m not reading a lot of code. But I’m letting the agent go as fast as I can while reading as much code as I can. I’m a little skeptical of this “council of agents” pattern or the gastown “agent swarm” architecture - I think this is imposing human hierarchies on agents, which is silly because all the agents are actually the same. Now, I use subagents and cheaper models for tasks in order to save tokens, but the only thing different about these agents is the instructions they’re given. So I use a lot of multiple pass type prompts. Plan, execute, review, debug, comment in the style of literate programming, etc. But setting up a dozen agents to swarm seems inefficient to me.

So I see IDEs changing dramatically. Even if the agents get better at planning, executing, analyzing architectural drift, I think we want access to the code, and we want tools that help us read the code and identifying anti patterns very quickly. So all the static analysis tools which help us analyze big codebases we know nothing about have suddenly become hugely important. I find myself having a back and forth with the agent for a few prompts before i have it do a spec - it helps give context and meaning before it starts executing. I think literate programming is another form of this. I honestly am thinking of going to buy a laser printer so I can print out my vibeslop and go through it with pen and paper.

Anyways, sorry for the wordslop. I would much rather learn about this stuff from people who work on it, who know what they’re doing, and who have lived experience rather than asking agents stuff.

I don’t really have any specific guidance, but I did put together an ocaml-deepseek library that lets you build custom agentic harnesses directly in OCaml without any reliance on external infrastructure. Tailoring workflows to specifically what works for individual needs is one of the lures of agentic workflows, so this’ll hopefully be of use to other people.

This is much better than what I was doing, thank you

I found this project extremely useful: GitHub - samoht/merlint · GitHub

I also have a, biggish for me, go cli project, 25000 lines, excl tests. Go has really good, fast, tooling, I run linting, deadcode, cyclometric complexity etc as actual tests so the LLM is forced to look at the issues everytime it runs “go test ./…” This project actually started out some years ago in Julia (which I still love and use, within constraints). I attempted a fancy typescript/react web reimagining of the project at the dawn of claude code but abandoned everything except the data model on which I worked quite hard. Not sure I would blame claude.

Since I love my ocaml/fmlib project, running a number of years now, I considered rewriting the go cli/tui but decided against it. Why? Just to burn tokens? I don’t really like go, but also don’t have to write it.

However I have recently “written” an extremely simple ocaml agent harness, which is compatible with the pi sessions schema/tree structure. Its also just a cli. Designed to be used by an agent. I use opus (fable was great for a minute) in claude code to dispatch Kimi (for ocaml) or GLM (for go) subagents using tmux.

What I love most of all, now, are those wonderful .mli files.

My projects are focused on managing bioacoustics data. I need a specialised agent harness because i sometimes push local and Chinese models to their image limits in an effort to decrease my (voluntary) workload, and will be needing to push their raw audio capabilities as it becomes possible, if it does. I can see a need for a specialised read tool.

I think ocaml has a great future, and I love writing it and reading it and learning it.

Happy building.

David