summaryrefslogtreecommitdiff
path: root/testsuite/tests/haddock
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2017-05-25 16:18:06 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2017-05-26 12:37:48 +0100
commitad14efd539377aaf472ad69449dcaf3e679b0e51 (patch)
tree8db1807c108abb62225820bd3780209d969f541b /testsuite/tests/haddock
parent226860e786ccb2c5660b64c9cf66e58eaf4dc672 (diff)
downloadhaskell-ad14efd539377aaf472ad69449dcaf3e679b0e51.tar.gz
Some tidying up of type pretty-printing
Triggered by the changes in #13677, I ended up doing a bit of refactoring in type pretty-printing. * We were using TyOpPrec and FunPrec rather inconsitently, so I made it consisent. * That exposed the fact that we were a bit undecided about whether to print a + b -> c + d vs (a+b) -> (c+d) and similarly a ~ [b] => blah vs (a ~ [b]) => blah I decided to make TyOpPrec and FunPrec compare equal (in BasicTypes), so (->) is treated as equal precedence with other type operators, so you get the unambiguous forms above, even though they have more parens. We could readily reverse this decision. See Note [Type operator precedence] in BasicTypes * I fixed a bug in pretty-printing of HsType where some parens were omitted by mistake.
Diffstat (limited to 'testsuite/tests/haddock')
-rw-r--r--testsuite/tests/haddock/haddock_examples/haddock.Test.stderr22
-rw-r--r--testsuite/tests/haddock/should_compile_flag_haddock/haddockA023.stderr2
-rw-r--r--testsuite/tests/haddock/should_compile_flag_haddock/haddockA024.stderr2
-rw-r--r--testsuite/tests/haddock/should_compile_flag_haddock/haddockA025.stderr2
-rw-r--r--testsuite/tests/haddock/should_compile_flag_haddock/haddockA026.stderr3
-rw-r--r--testsuite/tests/haddock/should_compile_flag_haddock/haddockA027.stderr4
-rw-r--r--testsuite/tests/haddock/should_compile_flag_haddock/haddockA028.stderr2
7 files changed, 19 insertions, 18 deletions
diff --git a/testsuite/tests/haddock/haddock_examples/haddock.Test.stderr b/testsuite/tests/haddock/haddock_examples/haddock.Test.stderr
index 8f06390348..49618904a2 100644
--- a/testsuite/tests/haddock/haddock_examples/haddock.Test.stderr
+++ b/testsuite/tests/haddock/haddock_examples/haddock.Test.stderr
@@ -151,26 +151,26 @@ data Ex a
Ex4 (forall a. a -> a)
<document comment>
k ::
- T () () This argument has type 'T'
- -> (T2 Int Int) This argument has type 'T2 Int Int'
- -> (T3 Bool Bool
- -> T4 Float Float) This argument has type @T3 Bool Bool -> T4 Float Float@
- -> T5 () () This argument has a very long description that should
+ (T () () This argument has type 'T')
+ -> ((T2 Int Int) This argument has type 'T2 Int Int')
+ -> ((T3 Bool Bool
+ -> T4 Float Float) This argument has type @T3 Bool Bool -> T4 Float Float@)
+ -> (T5 () () This argument has a very long description that should
hopefully cause some wrapping to happen when it is finally
- rendered by Haddock in the generated HTML page.
+ rendered by Haddock in the generated HTML page.)
-> IO () This is the result type
-l :: (Int, Int, Float) takes a triple -> Int returns an 'Int'
+l :: ((Int, Int, Float) takes a triple) -> Int returns an 'Int'
<document comment>
m ::
- R -> N1 () one of the arguments -> IO Int and the return value
+ R -> (N1 () one of the arguments) -> IO Int and the return value
<document comment>
newn ::
- R one of the arguments, an 'R'
- -> N1 () one of the arguments -> IO Int
+ (R one of the arguments, an 'R')
+ -> (N1 () one of the arguments) -> IO Int
newn = undefined
<document comment>
foreign import ccall unsafe "header.h" o
- :: Float The input float -> IO Float The output float
+ :: (Float The input float) -> IO Float The output float
<document comment>
newp :: Int
newp = undefined
diff --git a/testsuite/tests/haddock/should_compile_flag_haddock/haddockA023.stderr b/testsuite/tests/haddock/should_compile_flag_haddock/haddockA023.stderr
index 63c2b2f74b..c0233de0d5 100644
--- a/testsuite/tests/haddock/should_compile_flag_haddock/haddockA023.stderr
+++ b/testsuite/tests/haddock/should_compile_flag_haddock/haddockA023.stderr
@@ -1,7 +1,7 @@
==================== Parser ====================
module ShouldCompile where
-test :: (Eq a) => [a] doc1 -> [a] doc2 -> [a] doc3
+test :: (Eq a) => ([a] doc1) -> ([a] doc2 ) -> [a] doc3
test xs ys = xs
diff --git a/testsuite/tests/haddock/should_compile_flag_haddock/haddockA024.stderr b/testsuite/tests/haddock/should_compile_flag_haddock/haddockA024.stderr
index b3caa71b9e..f1db2374b1 100644
--- a/testsuite/tests/haddock/should_compile_flag_haddock/haddockA024.stderr
+++ b/testsuite/tests/haddock/should_compile_flag_haddock/haddockA024.stderr
@@ -1,7 +1,7 @@
==================== Parser ====================
module ShouldCompile where
-test2 :: a doc1 -> b doc2 -> a doc 3
+test2 :: (a doc1 ) -> (b doc2 ) -> a doc 3
test2 x y = x
diff --git a/testsuite/tests/haddock/should_compile_flag_haddock/haddockA025.stderr b/testsuite/tests/haddock/should_compile_flag_haddock/haddockA025.stderr
index 472ec1a1eb..4b208f858a 100644
--- a/testsuite/tests/haddock/should_compile_flag_haddock/haddockA025.stderr
+++ b/testsuite/tests/haddock/should_compile_flag_haddock/haddockA025.stderr
@@ -1,7 +1,7 @@
==================== Parser ====================
module ShouldCompile where
-test2 :: a doc1 -> a
+test2 :: (a doc1 ) -> a
test2 x = x
diff --git a/testsuite/tests/haddock/should_compile_flag_haddock/haddockA026.stderr b/testsuite/tests/haddock/should_compile_flag_haddock/haddockA026.stderr
index 769da3f0d3..fcf9e0c2d6 100644
--- a/testsuite/tests/haddock/should_compile_flag_haddock/haddockA026.stderr
+++ b/testsuite/tests/haddock/should_compile_flag_haddock/haddockA026.stderr
@@ -1,7 +1,8 @@
==================== Parser ====================
module ShouldCompile where
-test :: (Eq a) => [a] doc1 -> forall b. [b] doc2 -> [a] doc3
+test ::
+ (Eq a) => ([a] doc1) -> forall b. ([b] doc2 ) -> [a] doc3
test xs ys = xs
diff --git a/testsuite/tests/haddock/should_compile_flag_haddock/haddockA027.stderr b/testsuite/tests/haddock/should_compile_flag_haddock/haddockA027.stderr
index e7707c5ec0..cd8884080f 100644
--- a/testsuite/tests/haddock/should_compile_flag_haddock/haddockA027.stderr
+++ b/testsuite/tests/haddock/should_compile_flag_haddock/haddockA027.stderr
@@ -2,9 +2,9 @@
==================== Parser ====================
module ShouldCompile where
test ::
- [a] doc1
+ ([a] doc1)
-> forall b.
- (Ord b) => [b] doc2 -> forall c. (Num c) => [c] doc3 -> [a]
+ (Ord b) => ([b] doc2 ) -> forall c. (Num c) => ([c] doc3) -> [a]
test xs ys zs = xs
diff --git a/testsuite/tests/haddock/should_compile_flag_haddock/haddockA028.stderr b/testsuite/tests/haddock/should_compile_flag_haddock/haddockA028.stderr
index 47d2468ea5..9e1edc661b 100644
--- a/testsuite/tests/haddock/should_compile_flag_haddock/haddockA028.stderr
+++ b/testsuite/tests/haddock/should_compile_flag_haddock/haddockA028.stderr
@@ -2,7 +2,7 @@
==================== Parser ====================
module ShouldCompile where
data a <--> b = Mk a b
-test :: [a] doc1 -> a <--> b -> [a] blabla
+test :: ([a] doc1 ) -> a <--> b -> [a] blabla
test xs ys = xs