Idris includes a simple build system for building packages and executables from a named package description file. These files can be used with the Idris compiler to manage the development process .
A package description includes the following:
- A header, consisting of the keyword package followed by the package name.
- Fields describing package contents,
<field> = <value>
At least one field must be the modules field, where the value is a
comma separated list of modules. For example, given an idris package
maths that has modules
Maths.HexOps.idr, the corresponding
package file would be:
package maths modules = Maths , Maths.NumOps , Maths.BinOps , Maths.HexOps
Other examples of package files can be found in the
of the main Idris repository, and in third-party libraries.
More details including a complete listing of available fields can be found in Packages.
Using Package files¶
Given an Idris package file
maths.ipkg it can be used with the Idris compiler as follows:
idris --build maths.ipkgwill build all modules in the package
idris --install maths.ipkgwill install the package, making it accessible by other Idris libraries and programs.
idris --clean maths.ipkgwill delete all intermediate code and executable files generated when building.
idris --mkdoc maths.ipkgwill build HTML documentation for your package in the folder
maths_docin your project’s root directory.
idris --checkpkg maths.ipkgwill type check all modules in the package only. This differs from build that type checks and generates code.
idris --testpkg maths.ipkgwill compile and run any embedded tests you have specified in the
testsparamater. More information about testing is given in the next section.
Once the maths package has been installed, the command line option
--package maths makes it accessible (abbreviated to
idris -p maths Main.idr