diff options
author | Ian Lynagh <igloo@earth.li> | 2007-05-05 14:29:51 +0000 |
---|---|---|
committer | Ian Lynagh <igloo@earth.li> | 2007-05-05 14:29:51 +0000 |
commit | 74794eb854913b670cd8c06befee2c7b88342b42 (patch) | |
tree | 9b784574d577675797723419206470d41ee881cb /compiler/hsSyn/HsExpr.lhs | |
parent | a1632b0af860d28589b444d8e28896bee8bced38 (diff) | |
download | haskell-74794eb854913b670cd8c06befee2c7b88342b42.tar.gz |
Tweak the ... generation
Diffstat (limited to 'compiler/hsSyn/HsExpr.lhs')
-rw-r--r-- | compiler/hsSyn/HsExpr.lhs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/compiler/hsSyn/HsExpr.lhs b/compiler/hsSyn/HsExpr.lhs index a5f5f3001f..23b6b137dd 100644 --- a/compiler/hsSyn/HsExpr.lhs +++ b/compiler/hsSyn/HsExpr.lhs @@ -285,8 +285,18 @@ pprLExpr :: OutputableBndr id => LHsExpr id -> SDoc pprLExpr (L _ e) = pprExpr e pprExpr :: OutputableBndr id => HsExpr id -> SDoc -pprExpr e | isAtomicHsExpr e = ppr_expr e -- Never replace 'x' by "..." - | otherwise = pprDeeper (ppr_expr e) +pprExpr e | isAtomicHsExpr e || isQuietHsExpr e = ppr_expr e + | otherwise = pprDeeper (ppr_expr e) + +isQuietHsExpr :: HsExpr id -> Bool +-- Parentheses do display something, but it gives little info and +-- if we go deeper when we go inside them then we get ugly things +-- like (...) +isQuietHsExpr (HsPar _) = True +-- applications don't display anything themselves +isQuietHsExpr (HsApp _ _) = True +isQuietHsExpr (OpApp _ _ _ _) = True +isQuietHsExpr _ = False pprBinds :: OutputableBndr id => HsLocalBinds id -> SDoc pprBinds b = pprDeeper (ppr b) |