1. 5
  1.  

  2. 5

    This discussion has been had within the F# community, and I think the general consensus is avoid where possible simply because when adding a case to your type you won’t get compile time warnings about needing to change the relevant match statements.

    Being said there are times you literally don’t care,

    let isSeven x = 
        Match x with 
        | 7 -> true
        | _ -> false
    
    1. 1

      Same story for Ocaml.

    2. 2

      Definitely something I’ve been bit by in the past and will comment on in code review. My general rule is no _ for pattern matches on user defined ADTs (since they may be extended in the future). Fine with it for builtin types because they often aren’t extensible.

      Un(but almost)related nit. Hate it when people use _ to avoid explicitly typing the final variant of an ADT.