Wildcard matching
If I put the preceding scripts into Visual Studio, the F# source code editor will draw a blue warning squiggle line under the ``compare me``
comparison expression, indicating that the set of rules in this match
construction is not exhaustive, as shown in the following screenshot:
The compiler even gives a sample value of ``compare me``
, which is not going to match. Although this value is not present within the definition of type Multiples
, if I synthetically create this value as enum<Multiples>(1)
and feed it as an argument into transformB
, the result would be the run-time exception of ...
Get F# 4.0 Design Patterns 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.