diff options
Diffstat (limited to 'docs/users_guide')
-rw-r--r-- | docs/users_guide/glasgow_exts.rst | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst index 6d09b44cb7..5fef204831 100644 --- a/docs/users_guide/glasgow_exts.rst +++ b/docs/users_guide/glasgow_exts.rst @@ -2109,6 +2109,38 @@ data constructor in an import or export list with the keyword ``pattern``, to allow the import or export of a data constructor without its parent type constructor (see :ref:`patsyn-impexp`). +.. _importqualifiedpost: + +Writing qualified in postpositive position +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. extension:: ImportQualifiedPost + :shortdesc: ``ImportQualifiedPost`` allows the syntax ``import M qualified`` + + :since: 8.10.1 + + ``ImportQualifiedPost`` allows the syntax ``import M qualified``, that is, to annotate a module as qualified by writing ``qualified`` after the module name. + +To import a qualified module usually you must specify ``qualified`` in prepositive position : ``import qualified M``. This often leads to a "hanging indent" (which is automatically inserted by some autoformatters and common in many code bases. For example: + +.. code-block:: none + + import qualified A + import B + import C + +The ``ImportQualifiedPost`` extension allows ``qualified`` to appear in postpositive position : ``import M qualified``. With this extension enabled, one can write: + +.. code-block:: none + + import A qualified + import B + import C + +It is an error if ``qualified`` appears in both pre and postpositive positions. + +The warning ``-Wprepositive-qualified-syntax`` (off by default) reports on any occurrences of imports annotated ``qualified`` using prepositive syntax. + .. _block-arguments: More liberal syntax for function arguments |