Skip to content

Latest commit

 

History

History
36 lines (25 loc) · 1.46 KB

types-intro.md

File metadata and controls

36 lines (25 loc) · 1.46 KB
layout title description nav seriesId seriesOrder
post
Understanding F# types: Introduction
A new world of types
fsharp-types
Understanding F# types
1

NOTE: Before reading this series, I suggest that you read the "thinking functionally" and "expressions and syntax" series as a prerequisite.

F# is not just about functions; the powerful type system is another key ingredient. And just as with functions, understanding the type system is critical to being fluent and comfortable in the language.

Now, so far we have seen some basic types that can be used as input and output to functions:

  • Primitive types such as int, float, string, and bool
  • Simple function types such as int->int
  • The unit type
  • Generic types.

None of these types should be unfamiliar. Analogues of these are available in C# and other imperative languages.

But in this series we are going to introduce some new kinds of types that are very common in functional languages but uncommon in imperative languages.

The extended types we will look at in this series are:

  • Tuples
  • Records
  • Unions
  • The Option type
  • Enum types

For all these types, we will discuss both the abstract principles and the details of how to use them in practice.

Lists and other recursive data types are also very important types, but there is so much to say about them that they will need their own series!