Live data from Hacker News

Functional programming accelerates agentic feature development

cyrusradfar.com

31–34 of 34 posts

Re: Functional programming accelerates agentic feature development

#31
post #20

I really like the “functional core, imperative shell” approach, I try to use it whenever I can. I wish more non-FP languages had a way to mark a function as pure (and have this statically enforced).

Agreed. "Prefer pure functions, push side effects to the boundary (functional core, imperative)" is at the top of my CLAUDE.md these days.

Re: Functional programming accelerates agentic feature development

#32

Earlier quoted context omitted.

Agents are useful because they don't inherit context from their parent context. They're basically "compaction" at a small scale. They succeed because context pollution create greater indeterminancy. The fact that you can spin up many of them is not primary benefit of them.

Hmm? How does this relate to functional programming helping agents code better?

> The agent can better reason about the code and side effects. Etc. Agents are very good at following and validating constraints and hill climbing

You're treating an agent like its something other than an LLM with limited context. I'm just trying to surface a incorrect assumption.

You're just talking about LLMs. Whether they're a child of a primary LLM is irrelevent to your conception.

It'd be interesting if you posited that LLMs doing functional style could handle more context without service degradation.

Re: Functional programming accelerates agentic feature development

#33
post #21

I've been having good luck with fairly autonomous LLM coding with the following rules: * TypeScript everywhere with extreme enforcement of the type system. * No "as" casts, no "any" declarations, all code must understand the shape of its data * All boundaries validated using a typed validation library. Many use zod, I prefer tjs. I also have strictly typed pg and express wrappers. * No files longer than 300 lines * A…

How do you enforce the use of validation library with eslint?

Can't fully enforce that one, but I require only my specific HTTP router / SQL library to be used, and disallow the import of express / pg libraries via eslint. I also disable the use of JSON.parse via eslint. Combined with strong language in the CLAUDE.md, I haven't seen it get around my guard rails.

Re: Functional programming accelerates agentic feature development

#34

Earlier quoted context omitted.

OP Here: it’s not discussed in this post but in another right after I discuss the modeling I was doing on tech debt and finding the game to improve agent outcomes was reducing context. functional programming accomplishes that. I can’t claim it’s the only way, but it’s one that’s well understood in the community

>finding the game to improve agent outcomes was reducing context I think modularization will further reduce context. I am planning to play with your SUPER and SPIRALS idea and use modularization on top via Vertical Slice Architecture or modular monolith where each module is isolated and has a contract.

Feel free to ping me (contact on my site) if I can support.
Post reply on HN