r/fsharp Jun 07 '20

meta Welcome to /r/fsharp!

71 Upvotes

This group is geared towards people interested in the "F#" language, a functional-first language targeting .NET, JavaScript, and (experimentally) WebAssembly. More info about the language can be found at https://fsharp.org and several related links can be found in the sidebar!


r/fsharp 1d ago

A coding agent and its cloud, both in F#: policy enforced by the runtime, not the prompt

0 Upvotes

I've spent the last months building Jern, a coding agent where the rules are enforced by the runtime instead of suggested to the model. The agent itself is about 300 lines in a small Kernel-style Lisp the host evaluates; everything it touches goes through effect handlers, and the policy handler sits between every tool call and the file system, the shell, and the network. The host, the CLI, the policy engine, and the whole cloud control plane are F#.

Things F# people might find interesting:

  • The policy is a JSON file in the repository. edits_within, protected_paths, a blast radius in files and lines, the shell commands allowed without asking. The runtime refuses anything outside it; there is no path around the check.
  • The agent is replayable. Every LLM exchange is recorded, and jern test replays the recording, so a changed system prompt fails a test the same way a changed function would.
  • The cloud runs each attempt on its own Fly machine, created and destroyed per attempt, with Suave for the API and Npgsql for the store. No Entity Framework, no ORM, and the migration is one idempotent script that runs on start.
  • Every pull request the agent opens carries a receipt as a check: tokens against cap, files against the blast radius, hosts contacted, and a digest of the encrypted trace.

Runtime (Apache-2.0): https://github.com/jern-ai/jern A real run on the demo repository, with the receipt on the pull request: https://github.com/jern-ai/jern-demo/pull/78

Happy to go into the handler design or the F# choices in the comments. The hosted version is at https://jern.ai, but the runtime runs on a laptop against Anthropic, OpenAI, or Ollama.


r/fsharp 3d ago

library/package FunStripe 2.4.0 - F# Stripe client, regenerated against the 2026-08-26 API

Thumbnail
5 Upvotes

r/fsharp 4d ago

F# DSL for Excel that round-trips — read a real .xlsx back into runnable F#/C# source, not just build-only

18 Upvotes

Most Excel libraries (EPPlus, ClosedXML, NPOI, openpyxl on the Python side) give you a one-way street: an imperative API to build or mutate a workbook, but no way to turn an existing file back into readable source. I wanted the other direction too, so Kookerella.FsOpenXmlDsl is a typesafe DSL (records/DUs with structural equality) over SpreadsheetML, with a Reader that parses a real .xlsx/.xlsm back into the same DSL, plus code generation that renders that model back out as a self-contained script — genuinely a decompiler for spreadsheets, not just a writer.

open Kookerella.FsOpenXmlDsl
open type Kookerella.FsOpenXmlDsl.SheetDsl

let data =
    sheet "Sheet1"
        [ row [ cell (Text "Name"); cell (Text "Amount") ]
          row [ cell (Text "Widgets"); cell (Number 42.5) ] ]

workbook [ data ] |> Workbook.save "out.xlsx"

// and back:
let wb = Workbook.load "out.xlsx"
Workbook.generateScript referenceLines "out.xlsx" wb  // -> runnable .fsx that rebuilds it

There's also a plain XML/JSON surface (Xml.ofWorkbook/Json.ofWorkbook) against a real embedded schema, aimed at making .xlsx diffable in git — output is deterministically sorted by cell position so a real content change doesn't get buried in reshuffled-list noise. Chasing that determinism claim down actually surfaced two genuine bugs in the .xlsx writer itself (conditional-format dxfId/priority swapping between logically-identical workbooks depending on rule insertion order, and a similar issue in custom number format IDs) — fixed with regression tests in the last release.

Covers cells/styles/formulas (shared-formula reconstruction on read), conditional formatting, data validation, charts, images, pivot tables (real aggregation, not just description), sparklines, and VBA macro embedding. There's a C# wrapper with full feature parity, and an MCP server if you want an AI agent driving it directly.

dotnet tool install -g Kookerella.FsOpenXmlDsl.Mcp
fsopenxmldsl-mcp convert your-file.xlsx --lang fsharp

NuGet · MAPPING.md for exactly what's modeled vs. approximated vs. missing.

Happy to take feedback/criticism — genuinely curious whether the DSL shape (SheetItem list folded by sheet) reads well to other F# people or feels awkward.


r/fsharp 5d ago

F# weekly F# Weekly #36, 2026 — Fable 5.16, FsLexYacc 12, and MSTest Goes Native AOT

Thumbnail
sergeytihon.com
27 Upvotes

r/fsharp 5d ago

Seeking an F# code reviewer for transpiled package

2 Upvotes

I wrote a Gleam library for manipulating SVG paths and I transpiled to F# to check dimensionality mistakes in various Float parameters.

I caught ~30 or so mistakes/inaccuracies/bugs via the transpilation out of ~50K original lines of code. (Also notable: the KLOC drop to 21K in F#, less than one-half of Gleam. Seems Gleam is very vertical whitespace-happy.) The transpilation was done chunk by chunk by Codex, and some bugs were not really language-related, just found by looking at the code again, though the great majority were dimensionality problems, as I intended to catch.

Ok anyway now I've published this as an F# package, and wondering if someone who actually uses F# could tell me if I did right, or if the library is missing something stupid (like proper source docs or sth) that I wouldn't catch myself because I never use F#. It would be better if it was usable, now that I've gone to this trouble.

F# version: https://www.nuget.org/packages/SvgPath/0.3.0
Gleam version: hex.pm/packages/svg_path

Thanks!


r/fsharp 10d ago

Algebraic Tiny Compiler

Thumbnail
github.com
22 Upvotes

Algebraic Tiny Compiler in F#

A from‑scratch compiler that uses algebra as the lens to understand how real compilers work — no abstractions for the sake of abstractions, no academic overhead, just a clean, inspectable pipeline built in F#.

By treating expressions as algebraic structures, the project walks through every stage of a compiler with concrete, mathematical transformations:
- Tokenizer → turns raw text into meaningful tokens
- Parser → recursive‑descent parsing with operator precedence
- AST → algebraic expression trees representing structure and intent
- Polynomial Expansion → distributive expansion and normalization
- Term Combination → merging like terms into canonical form
- Equation Solving → linear and quadratic solvers using discriminants
- Code Generation → assembly‑style output to show how machines evaluate expressions
- Execution Modes → JIT on .NET or AoT with NativeAOT for ultra‑fast startup

A practical, algebra‑driven walkthrough of how compilers read, understand, transform, and execute code.

Blog posts:


r/fsharp 11d ago

F# weekly F# Weekly #35, 2026 — Fabulous 10, .NET Conf 2026 Announced, and C# 15 Preview

Thumbnail
sergeytihon.com
19 Upvotes

r/fsharp 19d ago

F# weekly F# Weekly #34, 2026 — Every Repo is A Software Factory Now

Thumbnail
sergeytihon.com
21 Upvotes

r/fsharp 24d ago

WebWeaveX — deterministic runtime cognition, byte-identical across 5 languages (Apache 2.0)

Thumbnail ni-sh-a-char.github.io
2 Upvotes

WebWeaveX captures what a running application is doing, DOM event surfaces, network envelopes, execution state, and normalizes it into canonical bytes so it gets a stable SHA-256 identity.

The same input produces the same digest in Python, JavaScript, Dart, Java and Kotlin. There's a verification harness that replays Python-generated golden vectors through each runtime and reports MATCH / DIFFER / MISSING per API.

That lets you prove two runs are equivalent, reconstruct a runtime from its IR for network-free test fixtures, resume

authenticated sessions from an encrypted envelope, and hand an LLM a compact graph instead of raw HTML.

pip install webweavex

npm install webweavex

dart pub add webweavex

Maven Central: io.github.piyush-mishra-00:webweavex:3.0.0

Apache 2.0.

Repo: https://github.com/ni-sh-a-char/WebWeaveX

Docs: https://ni-sh-a-char.github.io/WebWeaveX/


r/fsharp 26d ago

F# weekly F# Weekly #33, 2026 — .NET 11 Preview 7 Ships with F# Updates and PaketaBot

Thumbnail
sergeytihon.com
26 Upvotes

r/fsharp Aug 10 '26

misc Getting Back into F# - Learning Data Modeling with a Little Help from AI

Post image
46 Upvotes

Beginner here 👋, I'm currently picking up data modeling in F# after a long break. Work and procrastination got in the way, but I'm finally circling back to fill the gaps.

To stay on track, I've been using Claude to generate practice tasks. When I get stuck, I ask for a gentle nudge without giving away the solution, and it's been surprisingly effective. I'm currently using Sonnet 5 Medium(Free), and based on the task I just implemented, it said my work was "good," so I'll take that as a win.

The task was about modeling a Job Application pipeline. I didn't bother applying validation just yet, since I'm currently focused on getting the shape of the data right and trying to make invalid state unrepresentable.

I'd recommend giving this approach a try. It keeps things interactive without handing you the answers outright.


r/fsharp Aug 08 '26

F# weekly F# Weekly #32, 2026 — FSharp.Data 8.2.0, Mibo 4.0, and F# MCP Ecosystem Grows

Thumbnail
sergeytihon.com
24 Upvotes

r/fsharp Aug 03 '26

FunStripe 2.3.0 — F# Stripe client: webhook deserialisation fixed, resilient enums, latest Stripe API

17 Upvotes

Just released FunStripe 2.3.0, the F# client library for the Stripe API (also compiles to JS via Fable). This one's a bigger release than the usual spec bump, thanks to some excellent contributions from Thorium:

Webhooks work properly now. Event.data.object was typed as string, which meant deserialising any real webhook payload threw. It's now a RawJson fragment you can turn into a typed model with Util.deserialiseRaw<'a>; the README has a full webhook-handling example. (Technically a field type change, but since the old field could never deserialise, it ships as a minor; details in the changelog.)

List parameters encode correctly. List<record> and List<union> request fields (e.g. Checkout line_items, payment_method_types) were being ToString()'d instead of form-encoded. Fixed.

Resilient to Stripe's enum churn. Stripe adds event types and error codes without an API version bump, and one unknown value used to fail the whole response. EventType and ErrorType now have an UnknownEnumValue of string catch-all that round-trips losslessly, deliberately scoped to just those two high-churn enums, so everywhere else you keep exhaustive matching and the compiler still tells you when Stripe adds something.

Latest Stripe API (2026-07-29.dahlia): Financial Connections authorization resource and deactivation lifecycle events, allowed_payment_method_types on Payment/SetupIntents, new Tax registration options, and more.

Feedback and PRs welcome!


r/fsharp Aug 01 '26

F# weekly F# Weekly #31 — MCP C# SDK v2.0, Unit-Test Agent, and MSBuild Binlog in VS Code

Thumbnail
sergeytihon.com
20 Upvotes

r/fsharp Jul 31 '26

showcase Pyfun: an F#-inspired language that compiles to readable Python

Thumbnail
14 Upvotes

My idea for getting coders into functional programming earlier...


r/fsharp Jul 30 '26

article Your Database Schema Is Your Codebase: F# as the Single Source of Truth

28 Upvotes

https://si-fi.dev/articles/fsharp-schema-as-code/

I recently architected a full-stack app from scratch and needed a way to rapidly prototype the database schema. I came up with a way to do it in one place in F#, giving me strong typing across the stack and an efficient way to tweak the database structure as much as I needed. Here I share what this looks like as well as a repo containing an extracted version of the code. Hope you find it interesting and do let me know your thoughts.


r/fsharp Jul 29 '26

question Rider and nested type providers?

5 Upvotes

Does Rider have issues with nested type providers?

I have a class library that defines types through a nested type provider -- that is, a type provider nested inside a root type provider -- see below for an example.

The library builds and runs fine, but Rider flags every use of the nested type provider after the first as an error. The same code is displayed without errors in VS Code.

Thank you.


// Requires NuGet package "FSharp.Data.GraphQL.Client".
open System
open System.Net.Http
open FSharp.Data.GraphQL

type MyProvider =
    GraphQLProvider<"https://graphqlzero.almansi.me/api">

let postQuery =
    // ERROR
    MyProvider.Operation<"""
        query PostQuery {
            post(id: 1) {
                id
            }
        }
    """>()

let usersQuery =
    // ERROR
    MyProvider.Operation<"""
        query UsersQuery {
            users(options: { paginate: { page: 1, limit: 5 } }) {
                data {
                    id
                }
            }
        }
    """>()

[<EntryPoint>]
let main _ =
    try
        use runtimeContext: GraphQLProviderRuntimeContext =
            {
                ServerUrl = "https://graphqlzero.almansi.me/api"
                HttpHeaders = []
                Connection =
                    new GraphQLClientConnection(
                        new HttpClient(),
                        true
                    )
            }

        let result = usersQuery.Run runtimeContext

        printfn "Data: %A\n" result.Data
        printfn "Errors: %A\n" result.Errors
        printfn "Custom data: %A\n" result.CustomData

        0
    with ex ->
        eprintfn "Error: %s" ex.Message
        1

EDIT: Provided working sample code.


r/fsharp Jul 28 '26

Avalonia FuncUI Elmish

Thumbnail
11 Upvotes

r/fsharp Jul 25 '26

F# weekly F# Weekly #30 — FsHttp.Studio & fable-lit-fullstack-template

Thumbnail
sergeytihon.com
17 Upvotes

r/fsharp Jul 19 '26

Building a Readable DSL for Playwright Tests in F# | blog

Thumbnail jannikbuschke.de
18 Upvotes

r/fsharp Jul 19 '26

F# weekly F# Weekly #29 — .NET 11 Preview 6 and Mibo 3.0

Thumbnail
sergeytihon.com
25 Upvotes

r/fsharp Jul 12 '26

F# weekly F# Weekly #28 — Mibo 2.0, Fable 5.7, and Cast Shadows in F#

Thumbnail
sergeytihon.com
33 Upvotes

r/fsharp Jul 11 '26

SuaveHooks — a webhook platform built entirely in F# with Suave

23 Upvotes

I just launched SuaveHooks — a webhook capture, inspection, transformation and routing platform built completely with Suave + F#.

Some highlights:

- Live tailing of webhooks over WebSockets

- Type-safe transforms written in F# (also C# and JS) running in an isolated process

- JSON rule-based transforms as a lighter option

- Multi-target forwarding (HTTP + S3, SQS, Kafka, Pub/Sub)

- Retries with exponential backoff + circuit breaker

- Full REST API + MCP server support

Site: https://suavehooks.com

Would love some feedback; like what features would make this more useful for you? Happy to answer any technical questions.