Like type-checking, this means that a large class of errors are detected at compile time. Mercury has a strong determinism system. If it cannot do so, it rejects the program. As with types and modes, determinism checking catches many program errors at compile time. Mercury has a module system.
Programs consist of one or more modules.
Each module has an interface section that contains the declarations for the types, functions and predicates exported from the module, and an implementation section that contains the definitions of the exported entities and also definitions for types and predicates that are local to the module. For predicates and functions that are not exported, Mercury supports automatic type, mode, and determinism inference. Mercury supports higher-order programming, with closures, currying, and lambda expressions. Strong types, modes, and determinism provide the compiler with the information it needs to generate very efficient code. The Mercury compiler is written in Mercury itself.