aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES2
-rw-r--r--haddock-api/src/Haddock/Convert.hs11
-rw-r--r--html-test/ref/Bug310.html89
-rw-r--r--html-test/src/Bug310.hs4
4 files changed, 102 insertions, 4 deletions
diff --git a/CHANGES b/CHANGES
index 352a739b..3a08424c 100644
--- a/CHANGES
+++ b/CHANGES
@@ -8,6 +8,8 @@ Changes in version 2.15.1
This is to disambiguate them from markdown links and will be require with a
future release.
+ * Fix re-exports of built-in type families (#310)
+
Changes in version 2.15.0
* Always read in prologue files as UTF8 (#286 and Cabal #1721)
diff --git a/haddock-api/src/Haddock/Convert.hs b/haddock-api/src/Haddock/Convert.hs
index 610e8fc6..ff7ca560 100644
--- a/haddock-api/src/Haddock/Convert.hs
+++ b/haddock-api/src/Haddock/Convert.hs
@@ -136,6 +136,7 @@ synifyAxiom ax@(CoAxiom { co_ax_tc = tc })
| otherwise
= error "synifyAxiom: closed/open family confusion"
+-- | Turn type constructors into type class declarations
synifyTyCon :: Maybe (CoAxiom br) -> TyCon -> TyClDecl Name
synifyTyCon coax tc
| isFunTyCon tc || isPrimTyCon tc
@@ -163,10 +164,12 @@ synifyTyCon coax tc
= case synTyConRhs_maybe tc of
Just rhs ->
let info = case rhs of
- OpenSynFamilyTyCon -> OpenTypeFamily
- ClosedSynFamilyTyCon (CoAxiom { co_ax_branches = branches }) ->
- ClosedTypeFamily (brListMap (noLoc . synifyAxBranch tc) branches)
- _ -> error "synifyTyCon: type/data family confusion"
+ OpenSynFamilyTyCon -> OpenTypeFamily
+ ClosedSynFamilyTyCon (CoAxiom { co_ax_branches = branches }) ->
+ ClosedTypeFamily (brListMap (noLoc . synifyAxBranch tc) branches)
+ BuiltInSynFamTyCon {} -> ClosedTypeFamily []
+ AbstractClosedSynFamilyTyCon {} -> ClosedTypeFamily []
+ _ -> error "synifyTyCon: type/data family confusion"
in FamDecl (FamilyDecl { fdInfo = info
, fdLName = synifyName tc
, fdTyVars = synifyTyVars (tyConTyVars tc)
diff --git a/html-test/ref/Bug310.html b/html-test/ref/Bug310.html
new file mode 100644
index 00000000..926d6cf2
--- /dev/null
+++ b/html-test/ref/Bug310.html
@@ -0,0 +1,89 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+><head
+ ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"
+ /><title
+ >Bug310</title
+ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"
+ /><script src="haddock-util.js" type="text/javascript"
+ ></script
+ ><script type="text/javascript"
+ >//<![CDATA[
+window.onload = function () {pageLoad();setSynopsis("mini_Bug310.html");};
+//]]>
+</script
+ ></head
+ ><body
+ ><div id="package-header"
+ ><ul class="links" id="page-menu"
+ ><li
+ ><a href=""
+ >Contents</a
+ ></li
+ ><li
+ ><a href=""
+ >Index</a
+ ></li
+ ></ul
+ ><p class="caption empty"
+ >&nbsp;</p
+ ></div
+ ><div id="content"
+ ><div id="module-header"
+ ><table class="info"
+ ><tr
+ ><th
+ >Safe Haskell</th
+ ><td
+ >None</td
+ ></tr
+ ></table
+ ><p class="caption"
+ >Bug310</p
+ ></div
+ ><div id="synopsis"
+ ><p id="control.syn" class="caption expander" onclick="toggleSection('syn')"
+ >Synopsis</p
+ ><ul id="section.syn" class="hide" onclick="toggleSection('syn')"
+ ><li class="src short"
+ ><span class="keyword"
+ >type family</span
+ > a <a href=""
+ >+</a
+ > b :: <a href=""
+ >Nat</a
+ ></li
+ ></ul
+ ></div
+ ><div id="interface"
+ ><h1
+ >Documentation</h1
+ ><div class="top"
+ ><p class="src"
+ ><span class="keyword"
+ >type family</span
+ > a <a name="t:-43-" class="def"
+ >+</a
+ > b :: <a href=""
+ >Nat</a
+ > <span class="fixity"
+ >infixl 6</span
+ ><span class="rightedge"
+ ></span
+ ></p
+ ><div class="doc"
+ ><p
+ >Addition of type-level naturals.</p
+ ></div
+ ></div
+ ></div
+ ></div
+ ><div id="footer"
+ ><p
+ >Produced by <a href=""
+ >Haddock</a
+ > version 2.15.1</p
+ ></div
+ ></body
+ ></html
+>
diff --git a/html-test/src/Bug310.hs b/html-test/src/Bug310.hs
new file mode 100644
index 00000000..d2492dc0
--- /dev/null
+++ b/html-test/src/Bug310.hs
@@ -0,0 +1,4 @@
+{-# LANGUAGE ExplicitNamespaces #-}
+module Bug310 ( type (+) ) where
+
+import GHC.TypeLits