r/functionalprogramming Jan 16 '26

Conferences Trends in Functional Programming (TFP) 2026

Thumbnail trendsfp.github.io
38 Upvotes

r/functionalprogramming Jun 01 '26

FP Richard Bird Distinguished Dissertation Award - Call for Nominations

Thumbnail people.cs.nott.ac.uk
11 Upvotes

I'm pleased to announce that JFP is establishing the Richard Bird Distinguished Dissertation Award, to recognise an outstanding PhD dissertation in functional programming.  Please share!


r/functionalprogramming 1d ago

SML My first attempt at parsing and evaluating s-exps

8 Upvotes

Hi all,

I've been a software developer for about 10 years and I've been curious about FP for half of this time. Eventually, I picked up SML as my language of choice (OCaml is mostly some random line nose for me, and in Haskell/PureScript type classes are so pervasive, they make the language almost impenetrable for beginners).

So my goal has been to:

- lex the source code,
- parse it using parser combinators,
- (do some AST manipulations),
- evaluate it.

This is the repository where I keep my source code, and a README file. The gist of this file is:

- it's not Scheme,
- this is a WIP
- compiler: MLton + MLB basis files
- using SuccessorML as much as possible.

I try to keep the code clean, concerns separated as much as possible, meaningful signatures & structs, clear types).

ALL constructive criticism is very much welcome. I'm not an SML pro, so bear with me.

PS I posted it in r/sml too, but oh well - under a different username (logged in with my old Google acc), I'm not impersonating anyone (image the drama).


r/functionalprogramming 2d ago

Haskell Type Safe Servant Auth Roles

Thumbnail blog.cofree.coffee
8 Upvotes

r/functionalprogramming 3d ago

FP Abstracting over Execution with Higher Kinded Types, and how to remain Purely Functional (oldie but goodie - belatedly uploaded)

Thumbnail fpilluminated.org
12 Upvotes

r/functionalprogramming 5d ago

FP What does Zig actually buy you over C when writing NIFs for a functional runtime like the BEAM?

5 Upvotes

New BEAM There, Done That with Garrison Hinson-Hasty (Systems Programming with Zig) and Isaac Yonemoto (Zigler), on what changes — and what doesn't — when you replace C with Zig at the boundary between a functional runtime and native code.

The interesting tension: the BEAM's entire value proposition is functional — immutable terms, isolated processes, fault tolerance through supervision. The moment you write a NIF, you step outside all of that. A segfault in native code bypasses every guarantee OTP provides and takes the whole node down.

Zig narrows the surface area but doesn't eliminate it. Spatial memory safety (buffer overflows, null dereference) is caught in safe release mode. Temporal memory safety (use-after-free) still isn't, which means the boundary remains genuinely dangerous, just less so.

The one detail that surprised me: Zigler uses the BEAM's own allocator by default, because Zig's explicit allocator model makes it easy to inject. Native memory is therefore visible to the VM's instrumentation — unlike C or Rust NIFs that call their own allocators and are invisible to the functional runtime they're embedded in.

For anyone who thinks about FFI design across language paradigms: how should a functional runtime expose a safe interface to native code? The BEAM's current answer (NIFs with dirty scheduler modes) and what Zigler adds on top seem worth discussing here. https://youtu.be/iLcZRpBEmgE


r/functionalprogramming 6d ago

FP Abstracting effects with continuations

13 Upvotes

https://crowdhailer.me/2026-07-15/abstracting-effects-with-continuations/

I've spent a while writing this post trying to work out if I want to talk about function coloring. In the end I chose to as neutrally as possible describe what continuations are.


r/functionalprogramming 11d ago

Intro to FP The Bowling Game - From Imperative to Functional Programming - Part 1

Thumbnail fpilluminated.org
18 Upvotes

One of the top five most popular and highly recommended programming katas over the past 20 years has been the Bowling Game Kata, in which TDD is used to write a program that computes the score of a Ten Pin Bowling Game.

In this deck we are going to explore how such a program may look when coded using different programming paradigms.


r/functionalprogramming 19d ago

Elixir Elixir is getting set-theoretic types - how do you type a language where pattern matching can freely return integer | boolean with no upfront declaration?

14 Upvotes

New BEAM There, Done That with Guillaume Dubois (Dashbit, PhD from IRIF Paris under Castagna) and Annette Bieniusa (RPTU Germany, building a parallel etalizer for Erlang) on what's shipping in Elixir 1.20 and why it took 30 years.

The FP angle: set-theoretic types - unions, intersections, negations - map naturally onto how BEAM pattern matching already works semantically. The gradual dynamic escape hatch is embedded into the type lattice structurally, not as a nominal exception. Message passing is still untyped for now.

The episode raises one question I'd put to this community: the BEAM's reliability model is supervision trees and let it crash, not static correctness. Both guests argue types and OTP solve different failure classes and aren't in tension. Does that framing hold, or does adding types change something fundamental about how you design for failure? https://youtu.be/X_CPDt3PeDE?si=j7Gneb1pFyFtgUGI


r/functionalprogramming 20d ago

Conferences Code BEAM Europe 2026: Keynotes, Full Tech Lineup, and Community Spaces

Enable HLS to view with audio, or disable this notification

4 Upvotes

Hi everyone,

Code BEAM Europe 2026 is happening this October 21-22 in Haarlem, NL, and online! The schedule is locked in, and we are excited to finally share the full lineup and core tracks with the community.

Here is a look at what we have lined up for this year:

Keynote Speakers

We are thrilled to have two incredible visionaries taking the main stage to kick things off:

  • Brooklyn Zelenka: Distributed systems researcher, founder of Fission, and author of Elixir libraries like Witchcraft. She will be sharing her deep expertise in local-first access control and open distributed standards.
  • Sam Aaron: The creator of Sonic Pi! An internationally renowned live coding performer and Computer Science PhD, Sam will bring his unique blend of science, code, and live music to the BEAM community.

Core Themes & Subjects

The regular sessions are packed with core team members, maintainers, and production engineers covering the cutting edge of the ecosystem. You can expect deep dives into the rise of Gleam and frontend architectures with Lustre, alongside advanced Erlang and OTP core updates directly from the team at Ericsson. We will also explore real-world Elixir battle stories—from taming LiveView at scale to prototyping BlueSky's DataPlane—while tackling the intersection of AI, security, and modern developer experience. Finally, we'll take the BEAM out of the server room with talks on embedded systems, AtomVM, hardware design, and safe native interop via Rustler and C nodes.

Check all speakers and their talks at: https://codebeameurope.com/#speakers

Beyond the Stage: The Informal Space

Some of the best moments happen off the main stage. This year, we are introducing a community-driven sandbox running alongside the main tracks for everything that doesn't perfectly fit a standard talk format. Expect live demos, hacking sessions, panel debates, lightning talks, and games. If you have an idea for an activity you want to coordinate, let us know and help shape the space!

Submit your ideas here!

Join Us in Haarlem

Whether you are looking to level up your skills, hack on new projects, or just grab a coffee and talk shop with fellow BEAMers, we would love to see you there.

Early Bird tickets are currently LIVE.

This is the absolute best time to secure your spot at the lowest possible price point.

Grab them here: https://codebeameurope.com/#register

And Also! For the full details, check our website: https://codebeameurope.com/

See you in October!

- The Code BEAM Europe Team


r/functionalprogramming 21d ago

Question Beginner in functional programming

30 Upvotes

Hi everyone, I wanted to ask how you would start from scratch in functional programming to understand it in detail. I'm a guy who comes from the imperative paradigm and I want to delve deeper and investigate about functional programming.

I'm learning Gleam and some Erlang to understand Beam, and I'm not sure if it's a good place to start. I feel like I'm lacking some theory. Any recommendations would be appreciated.


r/functionalprogramming 22d ago

Question Algebraic Shape Composition in a tiny functional language

Thumbnail
10 Upvotes

r/functionalprogramming 22d ago

Data Structures Persistent Iterators: Bridging Persistent Data Structures and Iterator-Based Programming (PLDI 2026)

Thumbnail
github.com
11 Upvotes

r/functionalprogramming 26d ago

FP Katharos: a functional programming and concurrency library for Python where errors, effects, and channel hand-offs are all composable values

10 Upvotes

I have been building Katharos, a functional programming library for Python that recently grew a message-passing concurrency layer. I wanted to share it and get some feedback.

The whole library is built around one idea: model errors, effects, and concurrent communication as composable, type-safe values rather than as control flow that jumps around your program. The interesting part (to me, at least) is that the concurrency layer follows the exact same idea, so receiving from a channel gives you a Result. "The channel is closed" becomes a value you handle, not an exception you remember to catch.

The functional core

Optional values without scattered None checks, using do-notation that short-circuits on Nothing:

```python from katharos.types import Maybe from katharos.syntax_sugar import do, DoBlock

@do(Maybe) def lookup_discount(user_id: int) -> DoBlock[Maybe, float]: user = yield find_user(user_id) account = yield find_account(user) return account.discount # Just(0.15) or Nothing() ```

Errors as values, chained with |, so a failure short-circuits the rest automatically:

```python from katharos.types import Result

def process(raw: str) -> Result[Exception, int]: return parse_int(raw) | validate_positive ```

And Result.catch turns a function that raises into one that returns a Result, while keeping the original traceback so you can still find the line that failed:

```python from katharos.types import Result

@Result.catch(ValueError) def parse_int(s: str) -> int: return int(s)

parse_int("42") # Success(42) parse_int("??") # Failure(ValueError("invalid literal for int() with base 10: '??'")) ```

There is also ImmutableList, NonEmptyList, IO, Lazy, numeric monoids, and the usual algebraic abstractions (Functor, Applicative, Monad, Semigroup, Monoid) if you want to build your own types.

The new part: CSP concurrency

This is what I have been working on lately. Katharos now has Go-style CSP (Communicating Sequential Processes): launch work concurrently with go, talk over typed channels, and receive values as a Result.

```python from katharos.concurrency.csp import csp

ch = csp.Channel[int](capacity=1)

csp.go(ch.send, 42) # run work concurrently, like Go's go f(x)

ch.recv() # Success(42)

ch.close() ch.recv() # Failure(ChannelClosedError(...)): closure is a value, not a raise ```

Used as a context manager, go becomes a structured-concurrency scope that joins everything spawned inside it before the block exits, so concurrent work cannot leak out of the block:

```python with csp.go: # scope waits for all work launched inside csp.go(worker, 1) csp.go(worker, 2)

both workers have finished here

```

There is also a select for waiting on whichever of several channels is ready first, with non-blocking polls and timeouts:

```python from katharos.concurrency.csp import csp, recv, select

choice = select(recv(results), recv(cancel), timeout=1.0) if choice.is_timeout: ... else: print(choice.index, choice.value.unwrap()) ```

The concurrency model sits on a swappable backend (standard threads by default), so the same code could run on a green-thread backend later. An actor model is planned next, built on the same backend abstraction and the same Result-valued style.

Why I think the "channel returns a Result" thing is nice

In most channel APIs, a closed channel or a timeout shows up as a sentinel, a second return value, or an exception. In Katharos it is just a typed value: Success(v), Failure(ChannelClosedError), or Failure(ChannelTimeoutError). You pattern-match it the same way you handle any other Result, and the type tells you it can happen. The error-handling discipline you use in the rest of your code carries straight over to concurrency.

Links

I would love feedback on the API, the concurrency design, or whether the Result-everywhere approach feels natural or noisy to you in practice. Thanks for reading.


r/functionalprogramming 28d ago

Elm A batch job, in The Elm Architecture

Thumbnail
cekrem.github.io
18 Upvotes

r/functionalprogramming 29d ago

FP Introducing Gossamer

8 Upvotes

Blog post with inspirations

Github Repo

Docs & Language Site

For years I wanted a language that felt like Rust/F#/Kotlin and ran like Go or Python. This is my attempt (building off an ancient interpreted only version). Built with Rust.

use std::strings

enum Shape {
    Circle(f64),
    Rect { w: f64, h: f64 },
    Triangle(f64, f64),
}

fn area(s: &Shape) -> f64 {
    match s {
        Shape::Circle(r)        => 3.14159 * r * r,
        Shape::Rect { w, h }   => w * h,
        Shape::Triangle(b, h)  => 0.5 * b * h,
    }
}

fn describe(s: &Shape) -> String {
    format!("{:.2}", area(s))
}

let shapes = [Shape::Circle(3.0), Shape::Rect { w: 4.0, h: 5.0 }, Shape::Triangle(6.0, 2.0)]

for s in shapes {
    s |> describe |> |d| format!("area = {d}") |> println!("{}", _)
}

r/functionalprogramming Jun 21 '26

λ Calculus Where to learn about incremental lambda calculas?

10 Upvotes

I've been looking into programming models that combine implicit parallelism and reactivity. Also, I'm not good at understanding research paper and navigating references

ChatGPT suggested I look into Incremental Lambda Calculus (ILC) and hinted that it could eventually lead to systems where programmers write far fewer explicit proofs, annotations, or dependency declarations because much of that reasoning could be derived automatically by the compiler/runtime.

I don't know enough about theorem proving or proof assistants to judge how realistic that is, but the idea of writing less boilerplate while still getting strong correctness guarantees sounds very appealing.

So far I've come across:

  • Incremental Lambda Calculus
  • Self-Adjusting Computation
  • Differential Dataflow
  • Interaction Nets / HVM

Are there other research projects, papers, languages, or execution models that push these ideas even further?

Also recommend a better subreddit for such questions if you can


r/functionalprogramming Jun 16 '26

Conferences Code BEAM Europe tickets are now available

10 Upvotes

Hi everyone! 

We're excited to announce that Code BEAM Europe 2026 is officially on the horizon!

Grab your Early Bird Ticket Here!

Whether you're deeply involved with Elixir, Erlang, Gleam, or just exploring the wider BEAM ecosystem, we’d love for you to join us. We’re meeting in person at the beautiful PHIL Philharmonic in Haarlem, the Netherlands, as well as online, on October 21–22 (with hands-on training sessions on October 20).

 What to expect:

  • Keynotes: We're thrilled to host Brooklyn Zelenka (Founder of Fission, BEAM Vancouver) and Sam Aaron (Creator of Sonic Pi).
  • Content: 2 tracks each day packed with cutting-edge talks from 30 speakers across the global community.
  • Informal Space: A community-led area dedicated to demos, hacking sessions, games, panel discussions, and lightning talks. Connect and share ideas with 300+ fellow attendees!

 All Important Links:

Will we see you in Haarlem or on the virtual streams? Let us know in the thread if you're planning to come or if you have any questions about the event!

Cheers, The Code BEAM Team

(PS: If your company is interested in sponsoring and supporting the ecosystem, feel free to reach out to us!)


r/functionalprogramming Jun 15 '26

Intro to FP Explaining Functional Programming to Non-Programmers (It's Just Excel) · cekrem.github.io

Thumbnail
cekrem.github.io
32 Upvotes

r/functionalprogramming Jun 08 '26

Conferences Code BEAM Europe 2026 Early Bird tickets dropping soon

10 Upvotes

Hi Everyone!

We're launching Code BEAM Europe 2026 on 21-22 October in Haarlem, NL (and virtually). It is a 2-day technical conference for engineers and developers working with Erlang, Elixir, Gleam, and the BEAM ecosystem. Speakers will be announced soon. You will be able to check it on our website: https://codebeameurope.com

The Early Bird ticket sales start on 16 June at 12:00 PM. If you plan to attend, the best way to get the lowest price is to join our waiting list now - https://codebeameurope.com/#newsletter

By joining the list, you'll get two main benefits:

  • You get an email notice 24h before the sales open, and also at the sales grand opening.
  • You get early access to a small number of Super Early Bird tickets. These tickets are limited, so they will be given to those who buy them first.

We can't wait to meet you! 


r/functionalprogramming Jun 08 '26

Elm Native Elm (the real kind this time) · cekrem.github.io

Thumbnail
cekrem.github.io
28 Upvotes

r/functionalprogramming Jun 07 '26

Question converting imperative JS fetching into functional style

6 Upvotes

hello , im a programmer that likes to dabble into webdev from time to time .. recently i got into functional programming (haskell , scala , etc) and i realized that using fetch() in javascript returns a Promise<> which has methods like .then() and .catch() that kinda makes it act like a monad . heres a snippet from the mdn

function fetchCurrentData() {
  return fetch("current-data.json").then((response) => {
    if (response.headers.get("content-type") !== "application/json") {
      throw new TypeError();
    }
    const j = response.json();
    return j;
  });
}

now i wonder if my code that is written imperatively can be converted into this style , and how would error handling work ? should i use async ? can someone help guide me thru this ?

public async callApi(path: string) {
    try {
        const res = await fetch(this.url + path);
        if (!res.ok)
            throw new Error(`status: ${res.status}`);

        const json = await res.json();
        return json;
    } catch (error: any) {
        console.error(error.message);
    }
}

r/functionalprogramming Jun 04 '26

FP Scala Was an Experiment That Changed Programming - Martin Odersky | The Marco Show

Thumbnail
youtu.be
26 Upvotes

r/functionalprogramming Jun 04 '26

FP Announcing Mutation Testing in Haskell

Thumbnail cs-syd.eu
5 Upvotes

r/functionalprogramming May 29 '26

Python Bringing rigorous Type Classes (Functor, Applicative, Monad) to Python: Introducing Katharos

25 Upvotes

If you come from Haskell or Rust and have to write Python for ML/AI work, you know the pain: if x is None everywhere, exceptions that silently swallow errors, no ? operator, no HKTs, no sealed types. I got tired of it and built a library to close that gap.

Katharos is a zero-dependency Python library that gives you Maybe, Either/Result, IO, the list monad, Semigroup, Monoid, Functor, Applicative, and Monad — all fully typed and passing pyright strict mode.

https://github.com/kamalfarahani/katharos


The Engineering Challenge

The hard part is that Python has no HKTs and no sealed keyword (as of 3.13). There's no way to say Functor f or write :: f a -> (a -> b) -> f b generically. The workaround is structural gymnastics: a two-parameter generic class hierarchy (Functor[F, A], Applicative[App, A], Monad[M, A]) plus @final on concrete types to prevent unsafe subclassing. It's not pretty internally, but the external API stays clean.


Operator Mapping

If you already think in Haskell or Rust, here's the translation table:

Katharos Haskell Rust
`m \ f` m >>= f
v ** wrapped_f wrapped_f <*> v
a >> b a >> b
a @ b a <> b
@do(M) decorator do { ... }

Examples

1. Maybe[A] — Haskell's Maybe a / Rust's Option<T>

No more if x is None chains. Short-circuits automatically on Nothing.

```python from katharos.types import Maybe

def safe_div(x: float) -> Maybe[float]: return Maybe[float].Nothing() if x == 0 else Maybe[float].Just(10.0 / x)

def safe_sqrt(x: float) -> Maybe[float]: return Maybe[float].Nothing() if x < 0 else Maybe[float].Just(x ** 0.5)

| is >>=

Maybe[float].Just(4.0) | safe_div | safe_sqrt # Just(1.5811...) Maybe[float].Just(0.0) | safe_div | safe_sqrt # Nothing() — short-circuits at safe_div Maybe[float].Just(-1.0) | safe_div | safe_sqrt # Nothing() — short-circuits at safe_sqrt

fmap for pure transformations

Maybe[int].Just(5).fmap(lambda x: x * 2) # Just(10) Maybe[int].Nothing().fmap(lambda x: x * 2) # Nothing() ```


2. Result[E, A] — Haskell's Either e a / Rust's Result<T, E>

Errors as values. The | chain (>>=) stops at the first Failure, exactly like Rust's ?.

```python from katharos.types import Result

def parse_int(s: str) -> Result[ValueError, int]: try: return Result[ValueError, int].Success(int(s)) except ValueError as e: return Result[ValueError, int].Failure(e)

def validate_positive(n: int) -> Result[ValueError, int]: if n > 0: return Result[ValueError, int].Success(n)

else:
    return Result[ValueError, int].Failure(ValueError(f"{n} is not positive"))

parse_int("42") | validate_positive # Success(42) parse_int("abc") | validate_positive # Failure(ValueError("invalid literal...")) parse_int("-5") | validate_positive # Failure(ValueError("-5 is not positive"))

fmap only runs on the success path

parse_int("42").fmap(lambda n: n * 2) # Success(84) ```


3. do-notation — Python do blocks, exactly like Haskell

The @do(M) decorator desugars yield into >>= chains. Each yield unwraps the value; short-circuits on Nothing/Failure. The final return is lifted via M.pure(...).

```python from katharos.syntax_sugar import do, DoBlock from katharos.types import Maybe, Result

Maybe — like Haskell:

userScore uid = do

name <- lookupUser uid

score <- lookupScore name

return (name ++ ": " ++ show score)

def lookup_user(uid: int) -> Maybe[str]: db = {1: "alice", 2: "bob"} return Maybe[str].Just(db[uid]) if uid in db else Maybe[str].Nothing()

def lookup_score(name: str) -> Maybe[int]: scores = {"alice": 95, "bob": 87} return Maybe[int].Just(scores[name]) if name in scores else Maybe[int].Nothing()

@do(Maybe) def user_score(uid: int) -> DoBlock[str]: name: str = yield lookup_user(uid) score: int = yield lookup_score(name) return f"{name}: {score}"

user_score(1) # Just(alice: 95) user_score(99) # Nothing() — short-circuits at lookup_user

Result — equivalent of Rust's ? in a pipeline

def parse_positive(x: int) -> Result[ValueError, int]: return Result[ValueError, int].Success(x) if x > 0 else Result[ValueError, int].Failure(ValueError(f"{x} is not positive"))

@do(Result) def compute() -> DoBlock[int]: x: int = yield parse_positive(5) y: int = yield parse_positive(3) return x + y

compute() # Success(8) ```


4. ImmutableList[T] — the list monad, non-determinism included

ImmutableList is a full Monad + Monoid. Bind (|) is concatMap. The do-notation gives you Haskell list comprehensions.

```python from katharos.types import ImmutableList from katharos.syntax_sugar import do, DoBlock

concatMap / flatMap

ImmutableList([1, 2, 3]) | (lambda x: ImmutableList([x, -x]))

ImmutableList([1, -1, 2, -2, 3, -3])

do-notation = list comprehension

In Haskell: [(color, size) | color <- ["red","blue"], size <- ["S","M","L"]]

@do(ImmutableList) def variants() -> DoBlock[tuple]: color: str = yield ImmutableList(["red", "blue"]) size: str = yield ImmutableList(["S", "M", "L"]) return (color, size)

variants()

ImmutableList([

('red','S'), ('red','M'), ('red','L'),

('blue','S'), ('blue','M'), ('blue','L')

])

Monoid: @ is <>

ImmutableList([1, 2]) @ ImmutableList([3, 4]) # ImmutableList([1, 2, 3, 4]) ImmutableList.identity() # ImmutableList([]) — mempty ```


5. Semigroup / Monoid@ is <>

Sum, Product, and NonEmptyList are all Semigroup/Monoid instances. F.sigma is fold1 / sconcat over a NonEmptyList.

```python from katharos.types import NonEmptyList from katharos.types.monoid import Sum, Product from katharos.functools import F

@ is <>

Sum[int](3) @ Sum[int](4) @ Sum[int](5) # Sum(12) Product[int](2) @ Product[int](3) @ Product[int](4) # Product(24)

identity() is mempty

Sum[int].identity() # Sum(0) Product[int].identity() # Product(1)

F.sigma is fold1 / sconcat — requires NonEmptyList (no empty-list footgun)

values = NonEmptyList(Sum[int](1), [Sum[int](2), Sum[int](3), Sum[int](4)]) F.sigma(values) # Sum(10)

NonEmptyList itself is a Semigroup (no Monoid — no empty case)

nel1 = NonEmptyList(1, [2, 3]) nel2 = NonEmptyList(4, [5, 6]) nel1 @ nel2 # NonEmptyList([1, 2, 3, 4, 5, 6])

```

Docs

Full docs at https://katharos.readthedocs.io. If this scratches an itch for you, a star on the repo goes a long way.

https://github.com/kamalfarahani/katharos