Essay - Published: 2024.02.28 | create | featured | fsharp | programming | python | tech |
DISCLOSURE: If you buy through affiliate links, I may earn a small commission. (disclosures)
F# is often described as a fun programming language. I've personally described it thus many times.
But this isn't really self-evident if you haven't used F#. How can a programming language be fun?
In this post I'm going to share why I think F# is fun.
Support my blog and show how fun() you are with a fun() tshirt.
First off "F# is fun" is a pun on a few things.
fun for function - fun is the keyword for a function, often used in anonymous or no-arg contextsfun is a simple way to reference thatfun appears a lot in F# programs - Prior to dotnet 8, many list ops required the use of fun for anonymous functions. Because F# is functional, it leans towards list ops which means most codebases were filled with fun.let simplePrint = fun() ->
printfn "F# is fun"
simplePrint()
|> ignore
Prints "F# is fun"
So on the surface F# is fun because it's punny - F# is functional and fun is how you declare many kinds of functions.
But I don't think punniness is the only reason this description sticks. After all what makes something funny / sticky is that it tends to hold some grain of truth.
I believe F# actually is a fun language. To explain this, let's look at another language that many people think of as "fun" - Python.
I think most people who say Python is fun do so because it feels like a toy. It is easy to use and do things compared to other languages they've used allowing them to focus on doing what they want and not fighting their tools.
Thus comparitively: Fun.
Python feels like a toy because:
; to end statements, can run/write like a scriptF# similarly feels like a toy:
; to end statements, can run / write like a scriptSo F# feels like a toy for very similar reasons Python does - it allows you to write easier to read programs with less boilerplate for common things.
Thus comparitively: Fun!
Toys are fun but you'll often lose interest once it loses novelty, it no longer fits the usecases, or you find a better toy. Toys that have longevity are those that can scale with you to new usecases and difficulty levels.
Python is used in many large-scale deployments but at scale runs into many issues. It's a toy in the former category - it's like a video game that has a good early / mid game but falls off at the endgame which means there's little reason to keep playing / using it at scale.
The primary issues with Python at scale are typically:
Python is fun to work with and can scale (we use it at Rippling where I currently work). But it starts to breakdown at scale and be a lot less fun to work with. It's like a video game that doesn't have an endgame.
What I think really hooks people on F# is that it's fun both at small and large scale. It has a good progression from early through end game.
So F# is fun to work with at small scale but it really starts to shine at larger scale. The more you play with it the more you appreciate its depth and how fun it really is to use.
It's like a video game that has such a good endgame that the earlier parts just feel like a long tutorial.
I've personally been using F# as my main language in personal projects for the past few years and have really been enjoying it. I mostly build fullstack web apps with F# and HTMX (my version of The HAM Stack) so that's where my perspective comes from but with the power of dotnet you can really build anything with F# from CLIs to video games to generative art.
I've yet to use F# for work (IMO F#'s weakest attribute is its level of adoption) but it's really opened my eyes to what programming can be and different ways to solve common problems. So even if you don't think you'll use it at work / your own projects, I still think it's a great toy to play with.
At the very least you'll learn a lot.
If you liked this post you might also like:
The best way to support my work is to like / comment / share for the algorithm and subscribe for future updates.