ppExpr' prec (ExprBinary op expr1 expr2)
  = if prec > op_prec then parens e else e
  where
    e = fsep [ppExpr' op_prec expr1, text x, ppExpr' (op_prec + 1) expr2 ]
    (x, op_prec) = lookupOp op binary_op_table

-- this adds unnecessary parens, but it makes the concrete syntax much easier to
-- read
{-
ppExpr' prec (ExprCond e1 e2 e3)
  = if prec > cond_prec then parens x else x
  where
    x = fsep [ pp e1, char '?', pp e2, colon, pp e3 ]

    pp e
      | add_parens e = parens (ppExpr e)
      | otherwise    = ppExpr e

    add_parens :: Expression -> Bool
    add_parens ExprCond{} = True
    add_parens _          = False
-}
ppExpr' prec (ExprBinary op expr1 expr2)
  = if prec > op_prec then parens e else e
  where
    e = fsep [ppExpr' op_prec expr1, text x, ppExpr' (op_prec + 1) expr2 ]
    (x, op_prec) = lookupOp op binary_op_table

-- this adds unnecessary parens, but it makes the concrete syntax much easier to
-- read
{-
ppExpr' prec (ExprCond e1 e2 e3)
  = if prec > cond_prec then parens x else x
  where
    x = fsep [ pp e1, char '?', pp e2, colon, pp e3 ]

    pp e
      | add_parens e = parens (ppExpr e)
      | otherwise    = ppExpr e

    add_parens :: Expression -> Bool
    add_parens ExprCond{} = True
    add_parens _          = False
-}
ppExpr' prec (ExprBinary op expr1 expr2)
  = if prec > op_prec then parens e else e
  where
    e = fsep [ppExpr' op_prec expr1, text x, ppExpr' (op_prec + 1) expr2 ]
    (x, op_prec) = lookupOp op binary_op_table

-- this adds unnecessary parens, but it makes the concrete syntax much easier to
-- read
{-
ppExpr' prec (ExprCond e1 e2 e3)
  = if prec > cond_prec then parens x else x
  where
    x = fsep [ pp e1, char '?', pp e2, colon, pp e3 ]

    pp e
      | add_parens e = parens (ppExpr e)
      | otherwise    = ppExpr e

    add_parens :: Expression -> Bool
    add_parens ExprCond{} = True
    add_parens _          = False
-}