summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorAlan Zimmerman <alan.zimm@gmail.com>2017-04-09 21:06:06 +0200
committerAlan Zimmerman <alan.zimm@gmail.com>2017-04-09 21:15:41 +0200
commit5282bb1772ba3f1dc999a177965e543822f342a0 (patch)
tree196a22e522c045fcf896fd71c0c4e7e87e5ac726 /compiler
parentff84d052850b637b03bbb98cf05202e44886257d (diff)
downloadhaskell-5282bb1772ba3f1dc999a177965e543822f342a0.tar.gz
Parenthesize type/data families correctly for -ddump-splices
Fix a regression in the pretty-printed code for -ddump-splices, which regressed since 8.0. Closes trac issue #13550
Diffstat (limited to 'compiler')
-rw-r--r--compiler/hsSyn/Convert.hs9
1 files changed, 5 insertions, 4 deletions
diff --git a/compiler/hsSyn/Convert.hs b/compiler/hsSyn/Convert.hs
index 921448e51d..8d90344f2f 100644
--- a/compiler/hsSyn/Convert.hs
+++ b/compiler/hsSyn/Convert.hs
@@ -37,7 +37,7 @@ import Outputable
import MonadUtils ( foldrM )
import qualified Data.ByteString as BS
-import Control.Monad( unless, liftM, ap )
+import Control.Monad( unless, liftM, ap, (<=<) )
import Data.Maybe( catMaybes, fromMaybe, isNothing )
import Language.Haskell.TH as TH hiding (sigP)
@@ -386,7 +386,7 @@ cvtDec (TH.PatSynSigD nm ty)
----------------
cvtTySynEqn :: Located RdrName -> TySynEqn -> CvtM (LTyFamInstEqn RdrName)
cvtTySynEqn tc (TySynEqn lhs rhs)
- = do { lhs' <- mapM cvtType lhs
+ = do { lhs' <- mapM (wrap_apps <=< cvtType) lhs
; rhs' <- cvtType rhs
; returnL $ TyFamEqn { tfe_tycon = tc
, tfe_pats = mkHsImplicitBndrs lhs'
@@ -433,7 +433,7 @@ cvt_tyinst_hdr :: TH.Cxt -> TH.Name -> [TH.Type]
cvt_tyinst_hdr cxt tc tys
= do { cxt' <- cvtContext cxt
; tc' <- tconNameL tc
- ; tys' <- mapM cvtType tys
+ ; tys' <- mapM (wrap_apps <=< cvtType) tys
; return (cxt', tc', mkHsImplicitBndrs tys') }
----------------
@@ -552,7 +552,8 @@ cvtSrcStrictness SourceStrict = SrcStrict
cvt_arg :: (TH.Bang, TH.Type) -> CvtM (LHsType RdrName)
cvt_arg (Bang su ss, ty)
- = do { ty' <- cvtType ty
+ = do { ty'' <- cvtType ty
+ ; ty' <- wrap_apps ty''
; let su' = cvtSrcUnpackedness su
; let ss' = cvtSrcStrictness ss
; returnL $ HsBangTy (HsSrcBang NoSourceText su' ss') ty' }