Arranging matching rules
Wildcard pattern demonstrates the importance of arranging the match cases from more specific to less specific. For example, if I put the match all third rule with the wildcard pattern before the first two rules in the preceding script, then the F# compiler will put the blue squiggle line under explicit Multiples
values, indicating that these rules will never be matched (check out transformB''
definition in Ch4_1.fsx
).
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.