Sign in

A nice case for introducing the F word 🥁 in your workplace

when you say the F word

Introducing F# at Work

⭐️ F# as a .NET Meta Language — see Milner in ACM/Turing awards to get to know the cool granddad of this F-boy— shines as being a very FUN and amazing language, but 💤 I get it, you need some of those Ah Ah! moments for yourself, I cannot teach you that.

To make a comparison, it would be like debugging a bug in production, only based on what a colleague of yours said, instead of really trying to double-check and understand…

In this short post I will try to make a comparison between JavaScript and F#

Getting Started

npm init
dotnet new -lang f#

JS (or ECMAScript) being born as a Browser(Client-side) language (Mozilla/Netscape), works natively in your browser, or else it needs a backend runtime to be able to execute on your computer by its own. That’s why Node.js exists.

npm init creates the package.json file and allows you to start adding packages and scripts to your node environment.

JS is an interpreted language, doesn’t need to be compiled, can be directly executed, paying this with performance and extra security vulnerabilities…

Mmmm immutable OK, but, can you make my life easy?

You have been doing F# great, and you love Type Providers, especially the
awesome FSharp.Data. Unfortunately Json provided types from FSharp.Data are immutable, and here is the whole focus of this post. Give me that “mutation”!

Introducing FSharp.Data.Mutator

the open space, 1005 AD

Inspired from this post Programmers Today are like Scribes in the middle Ages, in the discomfort of realizing the truth, but hoping for a re-lit of Reason.

Sentences for intellectual sorrow

  • The Programming Language doesn’t matter
  • A programming language is just a tool (for the right job)
  • With the right tooling, all programming languages are equal
  • Eventually all programming languages evolve to become the same
  • All programming languages are Touring Complete (sigh!)

And this is not my own reply, but I tend to affiliate well enough with this answer

I wonder how people think all programming languages are equal. Can we think of anything…

While reading learn go in y minutes some time ago, I noticed some common «concepts» in the language design of go-lang and F#, a language for .NET I really love.

PS. a really nice comparison summary also here from a form thread on reddit.

✔️Here for reference if you want to play around with both languages:

Important Notice: I am not a Go programmer myself, but an F# enthusiast, so feel free to correct my imprecisions or mistakes :)

Note: I am not talking about performance here, but now-a-days NET5 (and upcoming NET6) are pretty well oiled…

scripting with #r NuGet and comparing some python syntax

F#5 in action in vscode + ionide

Getting Started

  • install latest dotnet SDK for NET5
  • install vscode and add all ionide extensions
  • install Microsoft.dotnet-interactive as a global tool
mkdir fsx && cd fsx; touch new.fsx; code .


Ionide is a great F# cross platform IDE plug-in for VScode, it works pretty good for F# scripting, sometimes might need you to clear cache or restart vscode though.

I will also compare a bit of F# and Python between the lines, as python is the de-facto standard for scripting in 2021.

A function in Python

def sum(a,b): 
return a + b

The same function in F#

let sum a b =…

F# logo

We will be creating a simple HTML View rendered in memory in a single MVC controller, where HTML and CSS will also be strongly typed (as code).

We won’t need any external .cshtml or .html file as F# allows HTML to be expressed within a very idiomatic style using Feliz.ViewEngine DSL as static functions and list parameters.

E.g. this HTML div:

<div class="my-class">HELLO</div>

simply becomes a standard F# function invocation from a static Html module:

Html.div [ 
prop.className "my-class"
prop.text "HELLO"

Giraffe has a similar html templating DSL but it’s a bit more verbose, so I go for Feliz…

in core

If you haven’t tried F# before

As you might already know, F# is a dotnet language, so you don’t need to install anything extra, you get it out of the box with dotnet-sdk.

If you haven’t before, I invite you to shake hands with your neighbor F#, and play out a bit, before reading further; here is a quick and awesome getting started.

dotnet new console -lang F#

First some notions on the test pyramid from Martin Fowler, and also on concept of solitary and social unit tests.

Solitary unit test can be defined as a test class where the one and only concrete service is the service under test (all other dependencies, except for data/value types are mocked)

A social (sociable) unit test is instead one which uses concrete service dependencies to test the class currently under test. Also called component test.

I believe as usual there shouldn’t be a strict rule around that, but is worth noting some differences, in order for us to sort the…

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store