Doc: module naming constraints (#3256)

This commit is contained in:
Stefano Volpe 2024-04-22 16:43:49 +02:00 committed by GitHub
parent 517b2832ef
commit ae3a43f72c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -74,14 +74,15 @@ The ``with`` keyword in expressions comes in two variants:
This is particularly useful with ``do`` notation, where it can often improve This is particularly useful with ``do`` notation, where it can often improve
error messages: ``with MyModule.(>>=) do ...`` error messages: ``with MyModule.(>>=) do ...``
There is no formal link between the module name and its filename, If a file contains a module declaration ``module Foo.Bar.MyModule``, its
although it is generally advisable to use the same name for each. An path relative to the ``sourcedir`` specified in the ``.ipkg`` project file
``import`` statement refers to a filename, using dots to separate (defaults to ``.``) must be ``./Foo/Bar/MyModule.idr``. If you are not using an
directories. For example, ``import foo.bar`` would import the file ``.ipkg`` project file, the path must be relative to the directory you are
``foo/bar.idr``, which would conventionally have the module declaration running Idris from. Similarly, an ``import`` statement also refers to such a
``module foo.bar``. The only requirement for module names is that the relative filepath stripped of its file extension, using dots to separate
main module, with the ``main`` function, must be called directories. As in the example above, all modules names and directories must be
``Main`` — although its filename need not be ``Main.idr``. capitalised identifiers. If a file does not contain a module declaration, it
is considered to be a module whose identifier is ``Main``.
Export Modifiers Export Modifiers
================ ================