Matching a pattern requires binding the record fields to some values, so you need to use explicit record syntax. Hence,
fun foo(({id = id, privateStack = x::xs})::players, ...) = (* do something *)
will work.
Note that pattern matching is not exhaustive; remember the empty list for players and the empty list for privateStack :
fun foo([], ...) = (* do something *) | foo({id = id, privateStack = []}::players, ...) = (* do something else *) | foo({id = id, privateStack = x::xs}::players, ...) = (* do something else *)
source share