The module system in Ampersand is currently being developed. It isn't yet in the main branch. This page is being created as work progresses.


An Ampersand specification consists of a CONTEXT file and a set of Modules. A module in Ampersand serves the dual purpose of controlling name-spaces and ordering definitions in multiple files.
We have been inspired by the module system of Haskell.



Syntax and meaning

MODULE <name> <language>? <markup>? <import>* <module element>* MODULE


To tell Ampersand what language your module is in, you can append a language directive to your module. Currently English and Dutch are supported. To do so, directly following the name of your context, you can specify
IN <language>
Where <language> can be ENGLISH or DUTCH.


Directly following the optional language definition, you can optionally specify the format of texts in your PURPOSE statements and MEANING blocks. This allows you to use your favourite markup language within Ampersand, as long as it is one of REST (Restructured Text), HTML, LATEX or MARKDOWN. If you specify one of these words in your CONTEXT definition, that value will be the default markup of all purposes and meanings in your context.
(For details on these formats, see pandoc.org).


An IMPORT statement contains a reference to another module and contains information of what definitions are imported from that module together with information about possible name-changes.

Module elements

A module may contain different types of statements. The order of statements in a context is irrelevant for the software that Ampersand generates. However, the order is maintained when documentation is generated.
a block of code that represents rules on a single and specific topic, at the user's discretion
a statement that declares a rule
a statement that specifies generalization/specialization of concepts
a declaration of a relation, stating the existence of a relation within the context
a description of a concept, to document its meaning
a statement that defines the atomic type of a concept
a statement that makes a role responsible for satisfying a rule
a statement for presenting facts in a readable sentence
a unit of code that can be run independently and specifies interaction with a user or a computer
a statement to describe the purpose of a context or a context element
a statement that sums up the initial population of a relation
Last modified 10mo ago