App e1 op _ e2)
  = case unLoc op of
      HsVar (L _ v) -> pp_infixly v
      HsRecFld f    -> pp_infixly f
      _             -> pp_prefixly
  where
    pp_e1 = pprDebugParendExpr e1   -- In debug mode, add parens
    pp_e2 = pprDebugParendExpr e2   -- to make precedence clear

    pp_prefixly
      = hang (ppr op) 2 (sep [pp_e1, pp_e2])

    pp_infixly v
      = sep [pp_e1, sep [pprInfixOcc v, nest 2 pp_e2]]

ppr_expr (
ppr_expr (OpApp e1 op _ e2)
  = case unLoc op of
      HsVar (L _ v) -> pp_infixly v
      HsRecFld f    -> pp_infixly f
      _             -> pp_prefixly
  where
    pp_e1 = pprDebugParendExpr e1   -- In debug mode, add parens
    pp_e2 = pprDebugParendExpr e2   -- to make precedence clear

    pp_prefixly
      = hang (ppr op) 2 (sep [pp_e1, pp_e2])

    pp_infixly v
      = sep [pp_e1, sep [pprInfixOcc v, nest 2 pp_e2]]
ppr_expr (OpApp e1 op _ e2)
  = case unLoc op of
      HsVar (L _ v) -> pp_infixly v
      HsRecFld f    -> pp_infixly f
      _             -> pp_prefixly
  where
    pp_e1 = pprDebugParendExpr e1   -- In debug mode, add parens
    pp_e2 = pprDebugParendExpr e2   -- to make precedence clear

    pp_prefixly
      = hang (ppr op) 2 (sep [pp_e1, pp_e2])

    pp_infixly v
      = sep [pp_e1, sep [pprInfixOcc v, nest 2 pp_e2]]