[commit: ghc] master: Improved data family export documentation (b138248)
git at git.haskell.org
git at git.haskell.org
Fri Dec 11 22:17:24 UTC 2015
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/b1382481ac14a9f8999321581eaf88148bd44415/ghc
>---------------------------------------------------------------
commit b1382481ac14a9f8999321581eaf88148bd44415
Author: David Kraeutmann <kane at kane.cx>
Date: Fri Dec 11 22:36:55 2015 +0100
Improved data family export documentation
Reviewers: simonpj, austin, bgamari
Reviewed By: simonpj
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1587
GHC Trac Issues: #11164
>---------------------------------------------------------------
b1382481ac14a9f8999321581eaf88148bd44415
compiler/rename/RnNames.hs | 5 +++--
docs/users_guide/glasgow_exts.rst | 5 +++++
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/compiler/rename/RnNames.hs b/compiler/rename/RnNames.hs
index d61c299..0024304 100644
--- a/compiler/rename/RnNames.hs
+++ b/compiler/rename/RnNames.hs
@@ -1223,8 +1223,9 @@ exports_from_avail Nothing rdr_env _imports _this_mod
where
-- #11164: when we define a data instance
-- but not data family, re-export the family
- -- Generally, whenever we export a part of a declaration,
- -- export the declaration, too.
+ -- Even though we don't check whether this is actually a data family
+ -- only data families can locally define subordinate things (`ns` here)
+ -- without locally defining (and instead importing) the parent (`n`)
fix_faminst (AvailTC n ns flds)
| not (n `elem` ns)
= AvailTC n (n:ns) flds
diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst
index 0959337..9993618 100644
--- a/docs/users_guide/glasgow_exts.rst
+++ b/docs/users_guide/glasgow_exts.rst
@@ -6666,6 +6666,11 @@ adjustment for type families:
associated types ``Tj``. The types need a keyword "``type``" to
distinguish them from data constructors.
+- Whenever there is no export list and a data instance is defined, the
+ corresponding data family type constructor is exported along with
+ the new data constructors, regardless of whether the data family
+ is defined locally or in another module.
+
.. _data-family-impexp-examples:
Examples
More information about the ghc-commits
mailing list