Fields of constructors of discriminated union types may be labelled (see Discriminated unions). These labels cause the compiler to generate function which can be used to select and update fields of a term in a manner independent of the definition of the type.
The Mercury language includes syntactic sugar to make it more convenient to select and update fields inside nested terms (see Record syntax) and to select and update fields of the DCG arguments of a clause (see DCG-goals).
|• Field selection:|
|• Field update:|
|• User-supplied field access function declarations:|
|• Field access examples:|