Table of Contents

Record syntax


)1 An algebraic sum type (see also https://en.wikipedia.org/wiki/Algebraic_data_type regarding sum types) is a type with different constructors seperated by |. Record syntax can generate errors, if combined with sum types.

Advantages

Disadvantages

With sum types combined: risk of runtime errors

Risk of namespace colisions without strong coding rules

Fields from records can be extrated by the accessor functions that have been declared within the record. Alternatively, records can be extrated by pattern matching, as well. If you use both with the same name then the pattern matching will shadow the accessor function(s).

Risk can be completely excluded by compiling with ghc parameter -Wall and cleaning up all warnings.

Risk can be mitigated by Coding rules.