AuthorUrs Enzler

Myths about F#: F# is for math problems only! No, F# is a general-purpose programming language.

M

When I show F# code to non-F#ers, I often get a reaction that goes something like this: “This code looks kind of nice, but we don’t have math problems to solve, so F# is not for us.”

By the way, the code I show typically has nothing to do with math. We don’t solve math problems with F#. We write a business application with it.

So I wonder why I hear this almost every time when I present about F#. Some guesses:

Myths about F#: C# will become F# anyway, so we don’t need F#! Nope, not happening.

M

C# indeed gets more and more features known to F#, like pattern matching, switch expressions, records, a way to deal with nulls, and someday maybe even discriminate unions and deep equality on collections. Maybe even type inference could become as powerful as in F#. However, C# can’t eliminate the features it already has, like mutability by default and statements. Immutability by default and expressions-only are strengths of F# and make building error-free apps easier. Real pipes and...

Our journey to F#: C#-F# Interop

O

When we started with TimeRocket in 2015, we used C# as the programming language for our backend. In 2020, we started using F# for our new code. We see little value in rewriting existing C# code to F# and do so only when major changes are due in existing C# code. As a result, we have quite a bit of C#-F# interop in our system. Both from C# to F# and from F# to C#. This post overviews what we learned about C#-F# interop. This blog post is part of the F# Advent Calendar 2022 – check out the...

Our journey to F#: The effect of F# on our (unit) tests

O

On our journey from C# to F#, we were at a point where we changed our (unit) testing strategy. Our approach just didn’t feel right anymore. We struggled to do TDD because we didn’t get the tests to fail first. We wrote tests that didn’t increase our confidence and started thinking of them as waste.

This post is part of the F# Advent Calendar 2021 
Thanks to Sergey Tihon for organising the Advent Calendar.

Pimping Unquote

P

Unquote is a great library for writing test assertions in F#. In our acceptance tests, we frequently check data structures for equality. When these data structures get bigger, reading test failure messages gets harder. That’s why I implemented an F# data structure differ around Unquote that lets me quickly see the differences.

Recent Posts