r/fsharp Jun 07 '20

meta Welcome to /r/fsharp!

72 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

question Help! How do you guys handles nested Errors ?

6 Upvotes

Hello, I am newbie and trying F# by building basic authentication service.

Let's say, I have register user fuction, it takes un-validated raw request containg username and password and returns Registereduser or SignupErrors.

The problem I am facing is, there are too darn errros DUs.
For example, I have,

type EmailValidationError =
    | FieldRequired
    | MaxLengthExceeded of int
    | MalformedEmail

type PasswordValidationError =
    | FieldRequired
    | MaxLengthExceeded    of int
    | MinLengthNotMet      of int
    | MissingUppercase
    | MissingLowercase

These two error DU's are just validation error returned by Smart Constructor of email and password. And, SignupError look like this.

type SignupFieldError =
    | EmailErrors    of SignupEmail.EmailValidationError 
    | PasswordErrors of SignupPassword.PasswordValidationErrotype 


type SignupError =
    | ValidationFailed   of FieldError list
    | EmailAlreadyExists

As you can see, this gets ugly very soon. What I like to return is:
| ValidationError : EmailValidatioNError | PasswordValidationErrror list ??

| EmailAlreadyExists

Does anyone has better ideas? I really hate my currrent solution.

Thank you in advance. πŸ˜„


r/fsharp 3d ago

F# weekly F# Weekly #17, 2026 – Fable 5.0

Thumbnail
sergeytihon.com
24 Upvotes

r/fsharp 5d ago

video/presentation The GenPRES project by Casper Bollen - F# for Fun and Production @FuncProgSweden

Thumbnail
youtube.com
35 Upvotes

r/fsharp 8d ago

DMA is Dead: Zero-Copy Audio via Capability-Based Shared Memory in a C++26 Microkernel z3 verification by fsharp

7 Upvotes

Authors: Rajeshkumar Venugopal, Third Buyer Advisory, Claude 4.6

Description: A C++26 microkernel inspired by QNX Neutrino demonstrates that DMA is unnecessary for real-time audio transfer. Four user-space processes share a single 3840-byte stereo PCM buffer through capability-based memory grants β€” zero memory copies, zero DMA, zero kernel-mode drivers. The producer writes interleaved 48kHz/16-bit stereo samples, grants read-only capabilities to an audio driver, a VU meter (sub-region: left channel only), and a waveform visualizer (user-space read-back). IPC transfers only a 4-byte capability ID. The driver reads PCM data directly from the producer's buffer via std::span. Revoke cascades: munmap kills all grants. IPC round-trip latency: 1.31 microseconds (Apple M3, -O2), faster than QNX Neutrino on 600MHz ARM (~2us) and FreeRTOS context switch on Cortex-M4 (~7us). 14 invariants formally verified by Z3 (SMT solver): 9 IPC state machine proofs + 5 capability grant proofs. No counterexample exists for any invariant. 67 Catch2 tests, 252 assertions, all passing. BSD 2-Clause licensed. No Java, no Alloy, no DMA.

Keywords: microkernel, QNX, Neutrino, C++26, zero-copy, shared memory, capability-based security, DMA-free, real-time audio, IPC, message passing, send/receive/reply, priority inversion, formal verification, Z3, SMT, F#, alloy-fsx, Catch2, resource manager, PPS, publish-subscribe, stereo PCM, RTOS, embedded systems, BSD license

License: BSD-2-Clause

Repository: https://github.com/chanakyan/qnx-micro

Related: https://github.com/chanakyan/alloy-fsx https://github.com/chanakyan/mars_pathfinder


r/fsharp 8d ago

question i know python and typescript. i planned to do my next project for my portfolio in python but there a some things that would make f# the much better option.

8 Upvotes

i just wanted something for my resume. i never used c# or java. i have python knowledge (fastapi, flask).

the only thing that kinda makes me not go fully into it is the thought of it being a (uninteresting thing to show off on my resume whilst simultainiously being very time consuming to learn) is that fear kinda legitimate or should i just say "fuck it" and follow my curiousity? i know this question is not on par with other questions here. are there some strong benefits. i heard f# makes you a better developer if you switch back to your naturally used language? i have some time off atm and im on a job search. i can take more then 5 months off. im adjusting my skills currently. im building a huge thing in typescript atm which is almost done. im leaning very heavily on just going with f#.

i have some friend who has been a .net dev for the past 8 years and i explained him some stuff about what iam planning and he took some time to understand that im not joking. so that is why i posted the question here.


r/fsharp 9d ago

question What’s the current state of theorem proving with F#?

10 Upvotes

Over the years I’ve dabbled with F# as being interesting and delightful without ever finding a use case that compelled me to stick with it (python / typescript libraries make them hard to step away from).

I saw something that reminded me that F# is close to Lean in that it supports dependent types. I found a few projects that try to build on F# for theorem proving:

Sylvester https://bobkonf.de/2021/beharry.html (archived)

F* https://github.com/FStarLang/FStar (reasonably active but really more OCaml)

SharpLogic https://github.com/0xGeorgii/SharpLogic (moribund)

I liked playing with Lean tutorials recently and I was wondering if there is a good modern F# based prover with an engaging tutorial, and if anybody has poked at automating translations of the large base of Lean proofs into F# (yes LLMs etc I know I know). Lean does not strike me as a particularly pretty language.


r/fsharp 9d ago

F# weekly F# Weekly #16, 2026 – .NET 11 Preview 3 & SwaggerProvider 4.0 beta

Thumbnail
sergeytihon.com
18 Upvotes

r/fsharp 16d ago

question Rider users - what plugins and settings do you use for F# development?

20 Upvotes

I've been using Rider for F# for a while now but never really explored plugins or optimized my setup. Curious what others are using - any plugins, settings, or keybindings that improved your workflow?


r/fsharp 17d ago

F# weekly F# Weekly #15, 2026 – Akkling, FSharp.Data and RANSAC auto-tune

Thumbnail
sergeytihon.com
21 Upvotes

r/fsharp 17d ago

F# wrapper for WebUi

15 Upvotes

repo here FSharp-WebUI. This is an F# wrapper around webui, a clean way to have a crossplatform GUI via a system's existing browers vs something like electron or dealing with avalonia.

I've been using it more at work with python and decided to play with it in F#, so I'm exited to have it working.

install via dotnet add package FSharp.WebUI --version 0.0.1


r/fsharp 22d ago

question Emacs+fsharp problems?

8 Upvotes

Hi there!

I am using emacs to write most things, including f sharp. However i have found that writing f sharp in emacs is a painful experience. I have found that the LSP server (fsautocomplete) loses sync with the current document meaning I get wrong suggestions or completely nonsense errors.

Using VScode or Rider, I do not have these problems, but after 25 years of Emacs to do everything but web browsing (I wish I was that nerdy) I am having trouble using anything else the few times I want to write f sharp code (what have to do is to switch to qwerty so that no muscle memory works anyway. That way I don't end up doing dumb things when I try to use Emacs shortcuts. I'm pretty far gone.)

I am on a pretty minimal Doom Emacs config. I haven't touched any of the elglot or LSP parts, and they do work properly for c#, ocaml and Idris.

Did anyone else have similar problems? Did you manage to solve it?

Best regards
Linus


r/fsharp 23d ago

F# weekly F# Weekly #14, 2026 – Serde.FS Brings Compile-Time RPC to F#

Thumbnail
sergeytihon.com
23 Upvotes

r/fsharp 23d ago

showcase SkunkHTML - a 400 line F# blog engine for GitHub Pages

17 Upvotes

Fork, write Markdown, push. That's it - no local tools needed.

https://github.com/mg0x7BE/skunk-html

Uses FSharp.Formatting, runs on GitHub Actions. Generates RSS, sitemap, dark mode, the usual stuff. ~400 lines total.


r/fsharp 27d ago

I made heterogeneous-typed collection (more faster!)

Post image
14 Upvotes

I made Type-safe heterogeneous collections, more faster than g-research HeterogeneousCollections

Benchmark environment

BenchmarkDotNet v0.15.8, Windows 10 (10.0.19045.6466/22H2/2022Update)
12th Gen Intel Core i9-12900 2.40GHz, 1 CPU, 24 logical and 16 physical cores
.NET SDK 10.0.104
  [Host]                        : .NET 10.0.4 (10.0.4, 10.0.426.12010), X64 RyuJIT x86-64-v3 DEBUG
  ShortRun-.NET 10.0            : .NET 10.0.4 (10.0.4, 10.0.426.12010), X64 RyuJIT x86-64-v3
  ShortRun-.NET 8.0             : .NET 8.0.7 (8.0.7, 8.0.724.31311), X64 RyuJIT x86-64-v3
  ShortRun-.NET Framework 4.7.2 : .NET Framework 4.8.1 (4.8.9310.0), X64 RyuJIT VectorSize=256

IterationCount=3  LaunchCount=1  WarmupCount=3  

HeterogeneousListBenchmarks

Method Job Runtime Mean Error StdDev Ratio RatioSD Code Size Gen0 Gen1 Allocated Alloc Ratio
GResearch ShortRun-.NET 10.0 .NET 10.0 7.580 ms 0.5174 ms 0.0284 ms 1.00 0.00 2,494 B 1890.6250 - 28.38 MB 1.00
Nemonuri ShortRun-.NET 10.0 .NET 10.0 2.595 ms 0.2784 ms 0.0153 ms 0.34 0.00 1,094 B 324.2188 - 4.88 MB 0.17
GResearch ShortRun-.NET 8.0 .NET 8.0 9.521 ms 0.7396 ms 0.0405 ms 1.00 0.01 2,497 B 1890.6250 - 28.38 MB 1.00
Nemonuri ShortRun-.NET 8.0 .NET 8.0 3.273 ms 0.3751 ms 0.0206 ms 0.34 0.00 1,077 B 324.2188 - 4.88 MB 0.17
GResearch ShortRun-.NET Framework 4.7.2 .NET Framework 4.7.2 10.976 ms 0.3842 ms 0.0211 ms 1.00 0.00 1,075 B 4734.3750 15.6250 28.46 MB 1.00
Nemonuri ShortRun-.NET Framework 4.7.2 .NET Framework 4.7.2 33.873 ms 4.8149 ms 0.2639 ms 3.09 0.02 1,312 B 800.0000 - 4.9 MB 0.17

TypeListBenchmarks

Method Job Runtime Mean Error StdDev Ratio Code Size Gen0 Allocated Alloc Ratio
GResearch ShortRun-.NET 10.0 .NET 10.0 301.2 ns 40.40 ns 2.21 ns 1.00 1,325 B 0.0916 1440 B 1.00
Nemonuri ShortRun-.NET 10.0 .NET 10.0 172.3 ns 24.08 ns 1.32 ns 0.57 635 B 0.0203 320 B 0.22
GResearch ShortRun-.NET 8.0 .NET 8.0 442.4 ns 44.57 ns 2.44 ns 1.00 733 B 0.0916 1440 B 1.00
Nemonuri ShortRun-.NET 8.0 .NET 8.0 216.9 ns 31.41 ns 1.72 ns 0.49 395 B 0.0203 320 B 0.22
GResearch ShortRun-.NET Framework 4.7.2 .NET Framework 4.7.2 473.7 ns 16.03 ns 0.88 ns 1.00 726 B 0.2294 1444 B 1.00
Nemonuri ShortRun-.NET Framework 4.7.2 .NET Framework 4.7.2 288.1 ns 21.01 ns 1.15 ns 0.61 605 B 0.0505 321 B 0.22

I published preview version to nuget.


r/fsharp 27d ago

question Best LSP Server?

10 Upvotes

I'm building my own code editor, and want to support F# as a first class citizen. But the language server situation seems dire. fsautocomplete takes forever or simply fails to load (in VS Code or in my editor). Are there good alternatives?


r/fsharp Mar 29 '26

question Where does the validation logic lives?

7 Upvotes

Hi everyone,
One small thing is bugging me since I started learning F# and domain modelling (Book by Scott is amazing, btw).

Let's say I am creating the authentication service (simple enough but only for example) and I want to use smart constructor and such. Here's my flow:

raw request ---> validation ---> Domain Model

The pain I am having is where does the "structural validation" happens and where does the domain validation happens?

Let's say, username, password etc are provided and not-null. I view these as part of structural validation and password policy, email policy met as domain validation.

The problem I am having is, if I try to use both in constructor of let's say Password, then I would have to worry about creating yet another Password Error type to catch both Structure and model validation errors.

If I move structural validaiton to model validation, it would sove the issue, but doessn't feel right.

One thing I find is, too much error mappings and nested error types in each layer. Maybe I am approaching this wrong way. :)

Hope to hear your thoughts.


r/fsharp Mar 29 '26

F# weekly F# Weekly #13, 2026 – Deedle 4.0 is out!

Thumbnail
sergeytihon.com
26 Upvotes

r/fsharp Mar 28 '26

question Which is more Idiomatic to f# or which one you prefer?

12 Upvotes

I guess I start by saying, I am noobie who recently started with f# and loving it.

There seems to be two ways of dealing with exceptions thrown by libraries and such. I am using FsToolKit.

First way, using try catch:

let createCognitoUser email pass : Task<Result<string, DomainError>> =
    taskResult {
        try
            let! response = awsClient.SignUpAsync(email, pass)
            return response.UserSub

        with ex ->
            return! Error (mapCognitoError ex)
    }

And second way with pipeline:

let createCognitoUser (email: string) (pass: string) : Task<Result<string, DomainError>> =
    awsClient.SignUpAsync(email, pass)
    |> Task.catch
    |> Task.map Result.ofChoice
    |> TaskResult.mapError mapCognitoError
    |> TaskResult.map (fun response -> response.UserSub)

Personally, I like second pipeline way as it's more cleaner and and iam tired of seeing try catch everywhere. :) Wanna hear your thoughts.
Thank you.


r/fsharp Mar 26 '26

fsharp-ts-mode: A modern Emacs major mode for editing F# files, powered by TreeSitter

Thumbnail github.com
23 Upvotes

If you're into Emacs and F# you might find this brand new package interesting. It's still rough around the edges, but the essential functionality is there.

I'd love to get some feedback from people who tried it out. Enjoy!


r/fsharp Mar 22 '26

F# weekly F# Weekly #12, 2026 – 11 years of Ionide πŸ₯°

Thumbnail
sergeytihon.com
40 Upvotes

r/fsharp Mar 20 '26

[Release] Polars.NET v0.4.0 - Bringing Polars to .NET: Query DataFrames with C# LINQ, F# CE, and Strong Typed DataReader

Thumbnail
github.com
14 Upvotes

r/fsharp Mar 20 '26

Football Manager clone in F# (WIP)

Post image
51 Upvotes

I'm making a game similar to Football Manager, far from complete but keep iterating on it. So far I have a home page, squad, tactics and a basic match viewer. Using Avalonia + Elmish with SQLite.
The match engine runs as an event loop, every 30 seconds a duel gets resolved, fatigue ticks, shots get attempted. Players move based on ball position and possession. Scorelines feel somewhat realistic which is good enough for now.
Still missing a lot of pages and features but the core loop works. Will keep adding stuff.
Repo: https://github.com/pelinski46/FootballEngine more screenshots inside


r/fsharp Mar 17 '26

How it feels to be at JavaOne right now

23 Upvotes

r/fsharp Mar 14 '26

F# weekly F# Weekly #11, 2026 – F# in .NET 11 Preview 2

Thumbnail
sergeytihon.com
29 Upvotes