[commit: haddock] ghc-7.8: Lower precedence of equality constraints (2b115ef)

git at git.haskell.org git at git.haskell.org
Mon Feb 24 21:36:15 UTC 2014


Repository : ssh://git@git.haskell.org/haddock

On branch  : ghc-7.8
Link       : http://git.haskell.org/haddock.git/commitdiff/2b115ef9f4d22cc479b240141325863e5dfd89c3

>---------------------------------------------------------------

commit 2b115ef9f4d22cc479b240141325863e5dfd89c3
Author: Niklas Haas <git at nand.wakku.to>
Date:   Sun Feb 23 15:37:13 2014 +0100

    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
    
    (cherry picked from commit 64850ca4f7dc2ca0fdb21d078d93cd636de5c87a)


>---------------------------------------------------------------

2b115ef9f4d22cc479b240141325863e5dfd89c3
 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 fa02b57..eb9c3e9 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");}
 	><p class="caption"
 	>TypeOperators</p
 	></div
-      ><div id="table-of-contents"
-      ><p class="caption"
-	>Contents</p
-	><ul
-	><li
-	  ><a href=""
-	    >stuff</a
-	    ></li
-	  ></ul
-	></div
-      ><div id="synopsis"
-      ><p id="control.syn" class="caption expander" onclick="toggleSection('syn')"
-	>Synopsis</p
-	><ul id="section.syn" class="hide" onclick="toggleSection('syn')"
-	><li class="src short"
-	  ><span class="keyword"
-	    >data</span
-	    > a <a href=""
-	    >:-:</a
-	    > b</li
-	  ><li class="src short"
-	  ><span class="keyword"
-	    >data</span
-	    > (a <a href=""
-	    >:+:</a
-	    > b) c</li
-	  ><li class="src short"
-	  ><span class="keyword"
-	    >data</span
-	    > <a href=""
-	    >Op</a
-	    > a b</li
-	  ><li class="src short"
-	  ><span class="keyword"
-	    >newtype</span
-	    > <a href=""
-	    >O</a
-	    > g f a = <a href=""
-	    >O</a
-	    > {<ul class="subs"
-	    ><li
-	      ><a href=""
-		>unO</a
-		> :: g (f a)</li
-	      ></ul
-	    >}</li
-	  ><li class="src short"
-	  ><a href=""
-	    >biO</a
-	    > ::  (g `<a href=""
-	    >O</a
-	    >` f) a</li
-	  ></ul
-	></div
       ><div id="interface"
-      ><h1 id="g:1"
-	>stuff</h1
+      ><h1
+	>Documentation</h1
 	><div class="top"
 	><p class="src"
 	  ><span class="keyword"
@@ -164,17 +110,61 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeOperators.html");}
 	  ></div
 	><div class="top"
 	><p class="src"
+	  ><span class="keyword"
+	    >class</span
+	    > a <a name="t:-60--61--62-" class="def"
+	    ><=></a
+	    > b</p
+	  ></div
+	><div class="top"
+	><p class="src"
 	  ><a name="v:biO" class="def"
 	    >biO</a
-	    > ::  (g `<a href=""
-	    >O</a
-	    >` f) a</p
+	    > ::  (g <a href="TypeOperators.html#t:O"
+	    >`O`</a
+	    > f) a</p
+	  ></div
+	><div class="top"
+	><p class="src"
+	  ><a name="v:f" class="def"
+	    >f</a
+	    > :: (a ~ b) => a -> b</p
+	  ></div
+	><div class="top"
+	><p class="src"
+	  ><a name="v:g" class="def"
+	    >g</a
+	    > :: (a ~ b, b ~ c) => a -> c</p
+	  ></div
+	><div class="top"
+	><p class="src"
+	  ><a name="v:x" class="def"
+	    >x</a
+	    > :: (a <a href="TypeOperators.html#t::-45-:"
+	    >:-:</a
+	    > a) <a href="TypeOperators.html#t:-60--61--62-"
+	    ><=></a
+	    > (a <a href="TypeOperators.html#t:Op"
+	    >`Op`</a
+	    > a) => a</p
+	  ></div
+	><div class="top"
+	><p class="src"
+	  ><a name="v:y" class="def"
+	    >y</a
+	    > :: (a <a href="TypeOperators.html#t:-60--61--62-"
+	    ><=></a
+	    > a, (a <a href="TypeOperators.html#t:Op"
+	    >`Op`</a
+	    > a) <a href="TypeOperators.html#t:-60--61--62-"
+	    ><=></a
+	    > a) => a</p
 	  ></div
 	></div
       ></div
     ><div id="footer"
     ><p
-      >Produced by <a href=""
+      >Produced by <a href="http://www.haskell.org/haddock/"
 	>Haddock</a
 	> version 2.14.0</p
       ></div
diff --git a/html-test/src/TypeOperators.hs b/html-test/src/TypeOperators.hs
index edbb934..e69e89c 100644
--- a/html-test/src/TypeOperators.hs
+++ b/html-test/src/TypeOperators.hs
@@ -1,12 +1,5 @@
-{-# LANGUAGE TypeOperators #-}
-module TypeOperators (
-  -- * stuff
-  (:-:),
-  (:+:),
-  Op,
-  O(..),
-  biO,
-) where
+{-# LANGUAGE TypeOperators, GADTs, MultiParamTypeClasses, FlexibleContexts #-}
+module TypeOperators where
 
 data a :-: b
 
@@ -16,5 +9,19 @@ data a `Op` b
 
 newtype (g `O` f) a = O { unO :: g (f a) }
 
+class 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 427d567..2ecde08 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



More information about the ghc-commits mailing list