r/functionalprogramming

Which Functional language is best for AI assisted development?

Which Functional language is best for AI assisted development?

What FP languages work best with AI agent driven development, and what tools/skills/mcps make the most difference in your workflow?

Everyone knows that an LLM will choose TS or Python if you don't prompt it towards another tool. But this doesn't bring much joy.

But something about a dynamic fp, or a strongly typed ML just brings more joy when it comes to reading the generated code.

However -- my experiments with FP and Claude code have been less than ideal. I found that Ocaml/Clojure will overall spend about 10x the tokens iterating on a solution until it is correct.

There are some really promising signs though -- the clojure-mcp-light parenthesis edit and nrepl utility make an objective improvement in terms of overall quality. I saw 2x the number of tests written, and overall what I think is a more concise and correct solution.

I love picking up new languages, and I am very interested in testing MCP's and skills which can actually objectively improve the quality of a solution, so really I want to have some recommendations on what languages to try next :)

u/dosomethinghard — 1 day ago
▲ 14 r/functionalprogramming+1 crossposts

Ocaml newbie - some trouble with HPLAR

Please allow me to introduce myself, I am a man of the typeless world, mainly Racket, Clojure, that sort of thing. I've been meaning to get into the typed language scene for programming language exploration, and I was a bit torn between the apparent purity of Haskell and practicality of Ocaml.

My experience level is zero, as in I've never written a single line.

In the end, what decided it for me was that I wanted to work through Harrison's "Handbook of Logic Programming and Automated Reasoning" which is supported by Ocaml code. I am also interested in some other programming paradigms (cclp), where Ocaml seems to be mentioned more than Haskell.

Anyways, I installed Ocaml according to the Cornell 3110 instructions, both for utop and VSCode, seems fine, gives me the 5.3.0 compiler environment.

My problem is that when I try to set up the supplied code for HPLAR, cd-ing into the provided directory and trying #use "init.ml" on the indicated file, all sorts of weirdnesses appear. In VSCode I can't even enter the #use line without a syntax error! Never mind, I tried from utop and from plain vanilla CLI, where I get this:

# #use "init.ml";;
Cannot find file nums.cma.
File "init.ml", line 10, characters 6-27:
10 | then (Topdirs.dir_directory "+camlp5";
           ^^^^^^^^^^^^^^^^^^^^^
Error: Unbound module Topdirs

The init.ml fike is as follows:

aaa#load "nums.cma";;                            (* For Ocaml 3.06     *)

if let v = String.sub Sys.ocaml_version 0 4 in v >= "3.10"
then (Topdirs.dir_directory "+camlp5";
      Topdirs.dir_load Format.std_formatter "camlp5o.cma")
else (Topdirs.dir_load Format.std_formatter "camlp4o.cma");;

type dummy_interactive = START_INTERACTIVE | END_INTERACTIVE;;
#use "initialization.ml";;
#use "Quotexpander.ml";;
#use "atp_interactive.ml";;

So I am left wondering if the problems are due to the older compiler version supported here, two major releases are enough time for things to change quite a bit.

I am keen to get up to speed and start on the book as soon as possible, and even though some may say - well, learn the operational basics first and then sort it out yourself (fair enough), if there is anyone who can provide some help to get this going a bit quicker, I would appreciate it very much! Many thanks.

reddit.com
u/Dazzling_Music_2411 — 3 days ago
▲ 57 r/functionalprogramming+3 crossposts

New release of racket-audio

New release of racket-audio

> [...] now also works with ffmpeg as backend and there's no special C-layer necessary anymore. The needed audio libraries are used directly.

https://racket.discourse.group/t/new-release-of-racket-audio/4209

> racket-audio is a small audio playback toolkit for Racket. It combines high-level asynchronous playback, optional metadata reading, file type sniffing, decoder backends, and libao based output

Available now from https://pkgs.racket-lang.org/package/racket-audio

(Thanks Hans!)

u/sdegabrielle — 5 days ago

Do you feel limited by coding in a less typed FP language compared with something like Haskell/Scala/Ocaml?

I really can't code in Go anymore. I love the simplicity, but I can't code without option/result, enums, ADT, ... But getting something better than Go, on this area, creates a hard decision to make in terms of how far should the type system goes. For example, Gleam is FP and typed, but the type system, of course is better than Go's, but it's no where near something like Haskell/Scala. Since I did not worked with Haskell before, and did just basic things on Scala, does it really matters?

On my current view, the biggest improvements in correctness come from using ADT, immutability, and errors as values. But there is also typeclasses, phantom types, linear types, GADT, .... to what degree where talking about syntax sugar or actual modeling features. I think I could live without all the syntax sugar, and write a little more code, or even some boilerplate, given the years coding in Go, but I would like to correctly express the constraints at the code.

I hope this question is understandable.

reddit.com
u/Ecstatic-Panic3728 — 12 days ago

A "collaborative" mechanical keyboard that does basically nothing — built with Lamdera

Every keystroke gets broadcast to everyone currently on the page, plays a Cherry MX Blue sample (different sound per key now), and ticks up a global character counter. There's a fade-trail of the most recent keys. That's the whole app.

The actual point was to try out Lamdera (Elm fullstack). Shared types between backend and frontend, end-to-end typed messages, no API layer to write. The glue-lessness is genuinely impressive — the "app" took some small parts of an afternoon, most of which was fiddling with the audio.

Someone in the Elm Slack called it a "beautifully coded terrible idea," which feels about right.

Demo: <https://greentype.lamdera.app> Source: <https://github.com/cekrem/greentype>

reddit.com
u/cekrem — 9 days ago