O'Reilly logo

Expert F# by Antonio Cisternino, Adam Granicz, Don Syme

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

CHAPTER 5Mastering Types and Generics

F# constructs such as lists, tuples, and function values are all generic, which means they can be instantiated at multiple different types. For example, int list, string list, and (int * int) list are all instantiations of the generic family of F# list types. Likewise, int -> int and string -> int are both instantiations of the generic family of F# function types. The F# library and the .NET Framework have many other generic types and operations in addition to these.

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. In this chapter, we cover .NET and F# types in general and generics and subtyping in particular. ...

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