aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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