diff options
author | David Waern <david.waern@gmail.com> | 2010-01-22 23:24:47 +0000 |
---|---|---|
committer | David Waern <david.waern@gmail.com> | 2010-01-22 23:24:47 +0000 |
commit | ccfaefee2d257de591d4f22e696a0e6bdc0957b8 (patch) | |
tree | 431b64b9b00e6f9c91732e04a6daba4e15746d8e | |
parent | 3badcc6c7bf703ec1e8f638ee2119b739497d884 (diff) |
Put parenthesis around type signature arguments of function type
-rw-r--r-- | src/Haddock/Backends/Html.hs | 8 | ||||
-rw-r--r-- | tests/tests/FunArgs.hs | 4 |
2 files changed, 8 insertions, 4 deletions
diff --git a/src/Haddock/Backends/Html.hs b/src/Haddock/Backends/Html.hs index 1a132c5b..05cddcac 100644 --- a/src/Haddock/Backends/Html.hs +++ b/src/Haddock/Backends/Html.hs @@ -867,7 +867,7 @@ ppTypeOrFunSig summary links loc docname typ (doc, argDocs) (pref1, pref2, sep) | otherwise = do_largs n leader ltype do_args n leader (HsFunTy lt r) - = (argBox (leader <+> ppLType unicode lt) <-> rdocBox (argDocHtml n)) + = (argBox (leader <+> ppLFunLhType unicode lt) <-> rdocBox (argDocHtml n)) </> do_largs (n+1) (arrow unicode) r do_args n leader t = argBox (leader <+> ppType unicode t) <-> rdocBox (argDocHtml n) @@ -1565,14 +1565,16 @@ maybeParen ctxt_prec op_prec p | ctxt_prec >= op_prec = parens p | otherwise = p -ppLType, ppLParendType :: Bool -> Located (HsType DocName) -> Html +ppLType, ppLParendType, ppLFunLhType :: Bool -> Located (HsType DocName) -> Html ppLType unicode y = ppType unicode (unLoc y) ppLParendType unicode y = ppParendType unicode (unLoc y) +ppLFunLhType unicode y = ppFunLhType unicode (unLoc y) -ppType, ppParendType :: Bool -> HsType DocName -> Html +ppType, ppParendType, ppFunLhType :: Bool -> HsType DocName -> Html ppType unicode ty = ppr_mono_ty pREC_TOP ty unicode ppParendType unicode ty = ppr_mono_ty pREC_CON ty unicode +ppFunLhType unicode ty = ppr_mono_ty pREC_FUN ty unicode -- Drop top-level for-all type variables in user style diff --git a/tests/tests/FunArgs.hs b/tests/tests/FunArgs.hs index 0389afe9..aadbf236 100644 --- a/tests/tests/FunArgs.hs +++ b/tests/tests/FunArgs.hs @@ -1,7 +1,9 @@ module FunArgs where -f :: Ord a => Int -- ^ First argument +f :: forall a. Ord a + => Int -- ^ First argument -> a -- ^ Second argument -> Bool -- ^ Third argument + -> (a -> a) -- ^ Fourth argument -> () -- ^ Result f = undefined |