Edit

Share via


FS0025: Incomplete pattern match

This message is given when pattern matching is incomplete.

Given the following definition:

F#
type Faucet =
| Hot
| Cold

let faucet = Hot

And match expression:

F#
let incompleteFaucetString =
    match faucet with
    | Hot -> "Hot"

The compiler will yield the following message:

text
FS0025: Incomplete pattern matches on this expression. For example, the value 'Cold' may indicate a case not covered by the pattern(s).

To resolve, you can either complete the pattern match:

F#
let completeFaucetString =
    match faucet with
    | Hot -> "Hot"
    | Cold -> "Cold"

Or, introduce a wildcard, _ (use with caution)

F#
let wildcardFaucetString =
    match faucet with
    | Hot -> "Hot"
    | _ -> "Other"