'field :='(Term, ValueTerm)
Each field label ‘field’ in a constructor causes generation of a field update function ‘'field :='/2’. The first argument of this function is a data-term of the same type as the constructor. The second argument is a data-term of the same type as the labelled field. The return value is a copy of the first argument with value of the labelled field replaced by the second argument. ‘'field :='/2’ fails if the top-level constructor of the first argument is not the constructor containing the labelled field.
If the declaration of the field is in the interface section of the module, the corresponding field update function is also exported from the module.
By default, this function has no declared modes — the modes are inferred at each call to the function. However, the type and modes of this function may be explicitly declared, in which case it will have only the declared modes.
To create a higher-order term from a field update function, an explicit lambda expression must be used, unless a single mode declaration is supplied for the field update function.
Some fields cannot be updated using field update functions. For the constructor ‘unsettable/2’ below, neither field may be updated because the resulting term would not be well-typed. A future release may allow multiple fields to be updated by a single expression to avoid this problem.
:- type unsettable ---> some [T] unsettable( unsettable1 :: T, unsettable2 :: T ).