O'Reilly logo

Mastering F# by Suhaib Fahad, Alfonso García-Caro Núñez

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Immutability, type declarations, and strong type inference

F# strongly adheres to immutability, meaning that the values declared in the program cannot be modified once they are constructed. Immutability also makes the code more readable because updates in the program state are more visible; thus it is easier to detect which operations affect the state. There are also F#-specific types, such as tuples, records, discriminated unions, and option types, which are immutable in their nature. They exhibit the following characteristics:

  • Being immutable
  • Values cannot be null
  • Built-in structural equality and comparison

F# has pattern matching as a special feature (from the ML family). We will go through pattern matching over predefined types and then discuss ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required