aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpanne <unknown>2003-02-24 21:26:29 +0000
committerpanne <unknown>2003-02-24 21:26:29 +0000
commitbc42cc876275c14a8858f11bf301d00f4dab8b45 (patch)
treefe0fad2d321e7a4a39e41b650b9fe77aeb8e08dd
parent871f65df490f46d66523b38df2cf6311ecaabe39 (diff)
[haddock @ 2003-02-24 21:26:29 by panne]
Don't convert a "newtype" to a single-constructor "data" for non-abstractly exported types, they are quite different regarding strictness/pattern matching. Now a "data" without any constructors is only emitted for an abstractly exported type, regardless if it is actually a "newtype" or a "data".
-rw-r--r--src/HaddockUtil.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/HaddockUtil.hs b/src/HaddockUtil.hs
index 878abeb7..61c40373 100644
--- a/src/HaddockUtil.hs
+++ b/src/HaddockUtil.hs
@@ -130,8 +130,10 @@ restrictTo :: [HsName] -> HsDecl -> HsDecl
restrictTo names decl = case decl of
HsDataDecl loc ctxt n xs cons drv doc ->
HsDataDecl loc ctxt n xs (restrictCons names cons) drv doc
- HsNewTypeDecl loc ctxt n xs con drv doc ->
- HsDataDecl loc ctxt n xs (restrictCons names [con]) drv doc
+ decl@(HsNewTypeDecl loc ctxt n xs con drv doc) ->
+ case restrictCons names [con] of
+ [] -> HsDataDecl loc ctxt n xs [] drv doc
+ _ -> decl
HsClassDecl loc ctxt n tys fds decls doc ->
HsClassDecl loc ctxt n tys fds (restrictDecls names decls) doc
_ -> decl