diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2017-05-25 16:18:06 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2017-05-26 12:37:48 +0100 |
commit | ad14efd539377aaf472ad69449dcaf3e679b0e51 (patch) | |
tree | 8db1807c108abb62225820bd3780209d969f541b /testsuite/tests/roles/should_compile | |
parent | 226860e786ccb2c5660b64c9cf66e58eaf4dc672 (diff) | |
download | haskell-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/roles/should_compile')
-rw-r--r-- | testsuite/tests/roles/should_compile/Roles13.stderr | 2 | ||||
-rw-r--r-- | testsuite/tests/roles/should_compile/Roles3.stderr | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/testsuite/tests/roles/should_compile/Roles13.stderr b/testsuite/tests/roles/should_compile/Roles13.stderr index 6b7bb557f4..f4b44a28c4 100644 --- a/testsuite/tests/roles/should_compile/Roles13.stderr +++ b/testsuite/tests/roles/should_compile/Roles13.stderr @@ -14,7 +14,7 @@ convert :: Wrap Age -> Int convert = convert1 `cast` (<Wrap Age>_R -> Roles13.N:Wrap[0] Roles13.N:Age[0] - :: ((Wrap Age -> Wrap Age) :: *) ~R# ((Wrap Age -> Int) :: *)) + :: (Wrap Age -> Wrap Age :: *) ~R# (Wrap Age -> Int :: *)) -- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0} $trModule1 :: GHC.Prim.Addr# diff --git a/testsuite/tests/roles/should_compile/Roles3.stderr b/testsuite/tests/roles/should_compile/Roles3.stderr index 11abd0cd4c..32fcea0abd 100644 --- a/testsuite/tests/roles/should_compile/Roles3.stderr +++ b/testsuite/tests/roles/should_compile/Roles3.stderr @@ -8,7 +8,7 @@ TYPE CONSTRUCTORS meth1 :: a -> a {-# MINIMAL meth1 #-} class C2 a b where - meth2 :: a ~ b => a -> b + meth2 :: (a ~ b) => a -> b {-# MINIMAL meth2 #-} class C3 a b where type family F3 b :: * open @@ -23,7 +23,7 @@ TYPE CONSTRUCTORS COERCION AXIOMS axiom Roles3.N:C1 :: C1 a = a -> a -- Defined at Roles3.hs:6:1 axiom Roles3.N:C2 :: - C2 a b = a ~ b => a -> b -- Defined at Roles3.hs:9:1 + C2 a b = (a ~ b) => a -> b -- Defined at Roles3.hs:9:1 axiom Roles3.N:C3 :: C3 a b = a -> F3 b -> F3 b -- Defined at Roles3.hs:12:1 axiom Roles3.N:C4 :: |