All Articles

F# in strange places: Supabase edge functions

31 Dec 2022
With the rising interest in WebAssembly, can we compile F# to WebAssembly, but then use it from a Supabase edge function?
This is my entry for the F# Advent Calendar 2022. Thank you Sergey Tihon for organizing it.

Recursive Async

15 Nov 2018
More involved take on recursion. How to properly type recursion when async is involved.
There was recently a project I was working on that required a recursive call. The problem was, that the function returned an async workflow, and in my inexperience, I was running into the problem that I didn’t know what each exit point should return exactly. This is a problem, because in F# all code paths must return the same type, and I wasn’t sure when I needed to wait for an async call, or return the async workflow itself. The idea behind the function was that it would query the database for a specific string, and if it didn’t find anything, it would shorten the string and try again, until the string was a certain length. After some looking around online, I came across this FSSnip that describes a recusive async function: