diff options
author | Shayne Fletcher <shayne.fletcher@digitalasset.com> | 2019-05-07 17:35:50 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-05-08 15:29:01 -0400 |
commit | ed5f858b8484a207e28baf9cbec4c60de1c86187 (patch) | |
tree | 4dfe0b1ff3970bf2cac267299251e803f7ced7e8 /docs/users_guide/glasgow_exts.rst | |
parent | 0eeb4cfad732d0b9b278c2274cb6db9633f9d3b5 (diff) | |
download | haskell-ed5f858b8484a207e28baf9cbec4c60de1c86187.tar.gz |
Implement ImportQualifiedPost
Diffstat (limited to 'docs/users_guide/glasgow_exts.rst')
-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 |