From 64850ca4f7dc2ca0fdb21d078d93cd636de5c87a Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Sun, 23 Feb 2014 15:37:13 +0100 Subject: Lower precedence of equality constraints This drops them to the new precedence pREC_CTX, which makes single eqaulity constraints show up as (a ~ b) => ty, in line with GHC's rendering. Additional tests added to make sure other type operators render as intended. Current behavior matches GHC --- html-test/ref/TypeOperators.html | 110 +++++++++++++++++-------------------- html-test/src/TypeOperators.hs | 25 ++++++--- src/Haddock/Backends/Xhtml/Decl.hs | 2 +- 3 files changed, 67 insertions(+), 70 deletions(-) diff --git a/html-test/ref/TypeOperators.html b/html-test/ref/TypeOperators.html index fa02b57e..eb9c3e9f 100644 --- a/html-test/ref/TypeOperators.html +++ b/html-test/ref/TypeOperators.html @@ -41,63 +41,9 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeOperators.html");} >

TypeOperators

Contents

Synopsis

stuff

Documentation

class a <=> b

biO :: (g `O` f) a

:: (g `O` f) a

f :: (a ~ b) => a -> b

g :: (a ~ b, b ~ c) => a -> c

x :: (a :-: a) <=> (a `Op` a) => a

y :: (a <=> a, (a `Op` a) <=> a) => a

b + biO :: (g `O` f) a biO = undefined + +f :: (a ~ b) => a -> b +f = id + +g :: (a ~ b, b ~ c) => a -> c +g = id + +x :: ((a :-: a) <=> (a `Op` a)) => a +x = undefined + +y :: (a <=> a, (a `Op` a) <=> a) => a +y = undefined diff --git a/src/Haddock/Backends/Xhtml/Decl.hs b/src/Haddock/Backends/Xhtml/Decl.hs index 427d5670..2ecde081 100644 --- a/src/Haddock/Backends/Xhtml/Decl.hs +++ b/src/Haddock/Backends/Xhtml/Decl.hs @@ -750,7 +750,7 @@ ppr_mono_ty _ (HsExplicitTupleTy _ tys) u q = quote $ parenList $ map (p ppr_mono_ty _ (HsWrapTy {}) _ _ = error "ppr_mono_ty HsWrapTy" ppr_mono_ty ctxt_prec (HsEqTy ty1 ty2) unicode qual - = maybeParen ctxt_prec pREC_OP $ + = maybeParen ctxt_prec pREC_CTX $ ppr_mono_lty pREC_OP ty1 unicode qual <+> char '~' <+> ppr_mono_lty pREC_OP ty2 unicode qual ppr_mono_ty ctxt_prec (HsAppTy fun_ty arg_ty) unicode qual -- cgit v1.2.3