module Modules.Imports where
Module definitions can be detached into separate files:
.agda
should contain the module declaration.module X where module ImportExample where data Bool : Set where false true : Bool x = ImportExample.true
can be replaced by
module X′ where import ImportExample -- click to see the contents of ImportExample.agda x = ImportExample.true
Agda source files should be accessible from the Agda search paths.
In the Emacs environment, the Agda search paths can be set by
x
customize-group
agda2
Agda2 Include dirs
The default search paths are the current directory (from where emacs
was started) and the path of the Standard Libraries if it was installed properly.
If you invoke the Agda compiler from the command line, you can add a path to the search paths by the -i
flag. The default search path is the current directory.
Module definitions can be detached into separate files contained in (possibly nested) directories accessible from the search paths.
Example:
module X″ where module ImportExample where data Bool : Set where false true : Bool x = ImportExample.true
can be replaced by
module X‴ where import Modules.ImportExample -- click to see the contents of Modules/ImportExample.agda x = Modules.ImportExample.true
Note that the top level module declaration of Modules/ImportExample.agda
declares the qualified module Modules.ImportExample
. Qualified module declaration are allowed only in this case.
One can rename imported modules:
module X⁗ where import Modules.ImportExample as ImportExample x = ImportExample.true
open import
M
stands for
import
Mopen
M
There are similar abbreviations for using
, hiding
, renaming
, public
constructs.