CHAPTER 5

images

Understanding Types in Functional Programming

F# is a typed language, and F# programmers often use types in sophisticated ways. In this chapter, you learn about the foundations of types, focusing on how types are defined and used in F# functional programming. You also look closely at generics, and closely related to generics is the notion of subtyping. Generics and subtyping combine to allow you to write code that is generic over families of types. You will see how F# uses automatic generalization to automatically infer generic types for your code, and the chapter covers some of the basic generic functions in the F# libraries, such ...

Get Expert F# 3.0, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.