This file documents the Mercury programming language, version 22.01.8.
Copyright © 1995–2012 The University of Melbourne.
Copyright © 2013–2023 The Mercury team.
Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.
Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided also that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.
Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions.
|• Introduction:||A brief introduction to Mercury.|
|• Syntax:||A description of Mercury’s syntax.|
|• Types:||Mercury has a strong parametric polymorphic type system.|
|• Modes:||Modes allow you to specify the direction of data flow.|
|• Unique modes:||Unique modes allow you to specify when there is only one reference to a particular value, so the compiler can safely use destructive update to modify that value.|
|• Determinism:||Determinism declarations let you specify that a predicate should never fail or should never succeed more than once.|
|• User-defined equality and comparison:||User-defined types can have user-defined equality and comparison predicates.|
|• Higher-order:||Mercury supports higher-order predicates and functions, with closures, lambda expressions, and currying.|
|• Modules:||Modules allow you to divide a program into smaller parts.|
|• Type classes:||Constrained polymorphism.|
|• Existential types:||Support for data abstraction and heterogeneous collections.|
|• Type conversions:||Converting between subtypes and supertypes.|
|• Exception handling:||Catching exceptions to recover from exceptional situations.|
|• Semantics:||Declarative and operational semantics of Mercury programs.|
|• Foreign language interface:||Calling code written in other programming languages from Mercury code|
|• Impurity:||Users can write impure Mercury code.|
|• Solver types:||Support for constraint logic programming|
|• Trace goals:||Trace goals allow programmers to add debugging and logging code to their programs.|
|• Pragmas:||Various compiler directives, used for example to control optimization.|
|• Implementation-dependent extensions:||The Melbourne Mercury implementation supports several extensions to the Mercury language.|
|• Bibliography:||References for further reading.|