Record pattern matching

Viewed 667

According to this accepted answer, in F# and OCaml I need to use underscore for discarding the rest of the record. However, why does the handle' function work but handle function doesn't?

type Type = Type of int

type Entity =
    { type' : Type
      foo : string }

let handle entities =
    match entities with
    | {type' = Type i; _ }::entites -> ()
    | [] -> ()

let handle' entities =
    match entities with
    | {type' = Type i }::entites -> ()
    | [] -> ()
1 Answers
Related