diff options
-rw-r--r-- | compiler/hsSyn/HsUtils.hs | 8 | ||||
-rw-r--r-- | testsuite/tests/deriving/should_compile/T14578.stderr | 9 |
2 files changed, 12 insertions, 5 deletions
diff --git a/compiler/hsSyn/HsUtils.hs b/compiler/hsSyn/HsUtils.hs index e8e59b001b..9a66b4a0b0 100644 --- a/compiler/hsSyn/HsUtils.hs +++ b/compiler/hsSyn/HsUtils.hs @@ -497,7 +497,13 @@ nlHsParTy :: LHsType (GhcPass p) -> LHsType (GhcPass p) nlHsAppTy f t = noLoc (HsAppTy noExt f (parenthesizeHsType appPrec t)) nlHsTyVar x = noLoc (HsTyVar noExt NotPromoted (noLoc x)) -nlHsFunTy a b = noLoc (HsFunTy noExt a b) +nlHsFunTy a b = noLoc (HsFunTy noExt (parenthesizeHsType funPrec a) + (parenthesize_fun_tail b)) + where + parenthesize_fun_tail (L loc (HsFunTy ext ty1 ty2)) + = L loc (HsFunTy ext (parenthesizeHsType funPrec ty1) + (parenthesize_fun_tail ty2)) + parenthesize_fun_tail lty = lty nlHsParTy t = noLoc (HsParTy noExt t) nlHsTyConApp :: IdP (GhcPass p) -> [LHsType (GhcPass p)] -> LHsType (GhcPass p) diff --git a/testsuite/tests/deriving/should_compile/T14578.stderr b/testsuite/tests/deriving/should_compile/T14578.stderr index bdb6ca5296..acbbdd627b 100644 --- a/testsuite/tests/deriving/should_compile/T14578.stderr +++ b/testsuite/tests/deriving/should_compile/T14578.stderr @@ -7,10 +7,10 @@ Derived class instances: = GHC.Prim.coerce @(forall (a :: TYPE GHC.Types.LiftedRep) (b :: TYPE GHC.Types.LiftedRep). - a -> b -> f a -> f b) + (a -> b) -> f a -> f b) @(forall (a :: TYPE GHC.Types.LiftedRep) (b :: TYPE GHC.Types.LiftedRep). - a -> b -> T14578.App f a -> T14578.App f b) + (a -> b) -> T14578.App f a -> T14578.App f b) GHC.Base.fmap (GHC.Base.<$) = GHC.Prim.coerce @@ -43,11 +43,12 @@ Derived class instances: @(forall (a :: TYPE GHC.Types.LiftedRep) (b :: TYPE GHC.Types.LiftedRep) (c :: TYPE GHC.Types.LiftedRep). - a -> b -> c -> f a -> f b -> f c) + (a -> b -> c) -> f a -> f b -> f c) @(forall (a :: TYPE GHC.Types.LiftedRep) (b :: TYPE GHC.Types.LiftedRep) (c :: TYPE GHC.Types.LiftedRep). - a -> b -> c -> T14578.App f a -> T14578.App f b -> T14578.App f c) + (a -> b -> c) + -> T14578.App f a -> T14578.App f b -> T14578.App f c) GHC.Base.liftA2 (GHC.Base.*>) = GHC.Prim.coerce |