diff options
-rw-r--r-- | src/Haddock/Backends/Html.hs | 18 | ||||
-rw-r--r-- | tests/output/Test.html | 20 | ||||
-rw-r--r-- | tests/output/Test.html.ref | 20 | ||||
-rw-r--r-- | tests/tests/Test.html.ref | 20 |
4 files changed, 39 insertions, 39 deletions
diff --git a/src/Haddock/Backends/Html.hs b/src/Haddock/Backends/Html.hs index df03acae..81cae215 100644 --- a/src/Haddock/Backends/Html.hs +++ b/src/Haddock/Backends/Html.hs @@ -1336,10 +1336,13 @@ ppType t = case t of HsSpliceTy _ -> error "ppType" HsDocTy t _ -> ppLType t -} + + -------------------------------------------------------------------------------- -- Rendering of HsType -------------------------------------------------------------------------------- + pREC_TOP = (0 :: Int) -- type in ParseIface.y in GHC pREC_FUN = (1 :: Int) -- btype in ParseIface.y in GHC -- Used for LH arg of (->) @@ -1366,16 +1369,12 @@ ppLType = ppType . unLoc ppLParendType = ppParendType . unLoc -ppType ty = ppr_mono_ty pREC_TOP (prepare ty) +ppType ty = ppr_mono_ty pREC_TOP ty ppParendType ty = ppr_mono_ty pREC_CON ty --- Before printing a type --- (a) Remove outermost HsParTy parens --- (b) Drop top-level for-all type variables in user style --- since they are implicit in Haskell -prepare (HsParTy ty) = prepare (unLoc ty) -prepare ty = ty +-- Drop top-level for-all type variables in user style +-- since they are implicit in Haskell ppForAll exp tvs cxt | show_forall = forall_part <+> ppLContext cxt @@ -1408,14 +1407,15 @@ ppr_mono_ty ctxt_prec (HsAppTy fun_ty arg_ty) hsep [ppr_mono_lty pREC_FUN fun_ty, ppr_mono_lty pREC_CON arg_ty] ppr_mono_ty ctxt_prec (HsOpTy ty1 op ty2) - = maybeParen ctxt_prec pREC_OP $ + = maybeParen ctxt_prec pREC_FUN $ ppr_mono_lty pREC_OP ty1 <+> ppr_op <+> ppr_mono_lty pREC_OP ty2 where ppr_op = if not (isSymOcc occName) then quote (ppLDocName op) else ppLDocName op occName = docNameOcc . unLoc $ op ppr_mono_ty ctxt_prec (HsParTy ty) - = parens (ppr_mono_lty pREC_TOP ty) +-- = parens (ppr_mono_lty pREC_TOP ty) + = ppr_mono_lty ctxt_prec ty ppr_mono_ty ctxt_prec (HsDocTy ty doc) = ppr_mono_lty ctxt_prec ty diff --git a/tests/output/Test.html b/tests/output/Test.html index a587a574..8cbce763 100644 --- a/tests/output/Test.html +++ b/tests/output/Test.html @@ -596,13 +596,13 @@ ><TD CLASS="recfield" ><A HREF="#v%3At" >t</A -> :: T1 -> (<A HREF="Test.html#t%3AT2" +> :: T1 -> <A HREF="Test.html#t%3AT2" >T2</A -> Int Int) -> (<A HREF="Test.html#t%3AT3" +> Int Int -> <A HREF="Test.html#t%3AT3" >T3</A -> Bool Bool) -> (<A HREF="Test.html#t%3AT4" +> Bool Bool -> <A HREF="Test.html#t%3AT4" >T4</A -> Float Float) -> <A HREF="Test.html#t%3AT5" +> Float Float -> <A HREF="Test.html#t%3AT5" >T5</A > () ()</TD ></TR @@ -931,11 +931,11 @@ >T</A > () () -> <A HREF="Test.html#t%3AT2" >T2</A -> Int Int -> <A HREF="Test.html#t%3AT3" +> Int Int -> (<A HREF="Test.html#t%3AT3" >T3</A > Bool Bool -> <A HREF="Test.html#t%3AT4" >T4</A -> Float Float -> <A HREF="Test.html#t%3AT5" +> Float Float) -> <A HREF="Test.html#t%3AT5" >T5</A > () () -> IO ()</TD ></TR @@ -1908,13 +1908,13 @@ ></A ><B >t</B -> :: T1 -> (<A HREF="Test.html#t%3AT2" +> :: T1 -> <A HREF="Test.html#t%3AT2" >T2</A -> Int Int) -> (<A HREF="Test.html#t%3AT3" +> Int Int -> <A HREF="Test.html#t%3AT3" >T3</A -> Bool Bool) -> (<A HREF="Test.html#t%3AT4" +> Bool Bool -> <A HREF="Test.html#t%3AT4" >T4</A -> Float Float) -> <A HREF="Test.html#t%3AT5" +> Float Float -> <A HREF="Test.html#t%3AT5" >T5</A > () ()</TD ><TD CLASS="rdoc" diff --git a/tests/output/Test.html.ref b/tests/output/Test.html.ref index a587a574..8cbce763 100644 --- a/tests/output/Test.html.ref +++ b/tests/output/Test.html.ref @@ -596,13 +596,13 @@ ><TD CLASS="recfield" ><A HREF="#v%3At" >t</A -> :: T1 -> (<A HREF="Test.html#t%3AT2" +> :: T1 -> <A HREF="Test.html#t%3AT2" >T2</A -> Int Int) -> (<A HREF="Test.html#t%3AT3" +> Int Int -> <A HREF="Test.html#t%3AT3" >T3</A -> Bool Bool) -> (<A HREF="Test.html#t%3AT4" +> Bool Bool -> <A HREF="Test.html#t%3AT4" >T4</A -> Float Float) -> <A HREF="Test.html#t%3AT5" +> Float Float -> <A HREF="Test.html#t%3AT5" >T5</A > () ()</TD ></TR @@ -931,11 +931,11 @@ >T</A > () () -> <A HREF="Test.html#t%3AT2" >T2</A -> Int Int -> <A HREF="Test.html#t%3AT3" +> Int Int -> (<A HREF="Test.html#t%3AT3" >T3</A > Bool Bool -> <A HREF="Test.html#t%3AT4" >T4</A -> Float Float -> <A HREF="Test.html#t%3AT5" +> Float Float) -> <A HREF="Test.html#t%3AT5" >T5</A > () () -> IO ()</TD ></TR @@ -1908,13 +1908,13 @@ ></A ><B >t</B -> :: T1 -> (<A HREF="Test.html#t%3AT2" +> :: T1 -> <A HREF="Test.html#t%3AT2" >T2</A -> Int Int) -> (<A HREF="Test.html#t%3AT3" +> Int Int -> <A HREF="Test.html#t%3AT3" >T3</A -> Bool Bool) -> (<A HREF="Test.html#t%3AT4" +> Bool Bool -> <A HREF="Test.html#t%3AT4" >T4</A -> Float Float) -> <A HREF="Test.html#t%3AT5" +> Float Float -> <A HREF="Test.html#t%3AT5" >T5</A > () ()</TD ><TD CLASS="rdoc" diff --git a/tests/tests/Test.html.ref b/tests/tests/Test.html.ref index a587a574..8cbce763 100644 --- a/tests/tests/Test.html.ref +++ b/tests/tests/Test.html.ref @@ -596,13 +596,13 @@ ><TD CLASS="recfield" ><A HREF="#v%3At" >t</A -> :: T1 -> (<A HREF="Test.html#t%3AT2" +> :: T1 -> <A HREF="Test.html#t%3AT2" >T2</A -> Int Int) -> (<A HREF="Test.html#t%3AT3" +> Int Int -> <A HREF="Test.html#t%3AT3" >T3</A -> Bool Bool) -> (<A HREF="Test.html#t%3AT4" +> Bool Bool -> <A HREF="Test.html#t%3AT4" >T4</A -> Float Float) -> <A HREF="Test.html#t%3AT5" +> Float Float -> <A HREF="Test.html#t%3AT5" >T5</A > () ()</TD ></TR @@ -931,11 +931,11 @@ >T</A > () () -> <A HREF="Test.html#t%3AT2" >T2</A -> Int Int -> <A HREF="Test.html#t%3AT3" +> Int Int -> (<A HREF="Test.html#t%3AT3" >T3</A > Bool Bool -> <A HREF="Test.html#t%3AT4" >T4</A -> Float Float -> <A HREF="Test.html#t%3AT5" +> Float Float) -> <A HREF="Test.html#t%3AT5" >T5</A > () () -> IO ()</TD ></TR @@ -1908,13 +1908,13 @@ ></A ><B >t</B -> :: T1 -> (<A HREF="Test.html#t%3AT2" +> :: T1 -> <A HREF="Test.html#t%3AT2" >T2</A -> Int Int) -> (<A HREF="Test.html#t%3AT3" +> Int Int -> <A HREF="Test.html#t%3AT3" >T3</A -> Bool Bool) -> (<A HREF="Test.html#t%3AT4" +> Bool Bool -> <A HREF="Test.html#t%3AT4" >T4</A -> Float Float) -> <A HREF="Test.html#t%3AT5" +> Float Float -> <A HREF="Test.html#t%3AT5" >T5</A > () ()</TD ><TD CLASS="rdoc" |