prettyop :: (Pretty f, HasVar f, Pretty a) => f -> [a] -> Doc'
prettyop f a
  | Just v <- unVar f
  , Just (i,d) <- opPrec v = case (v,a,d) of
      (V "-",[x],_)       -> i #> pf <+> x
      (_,[x,y],LeftFix)   -> i #> pguard i x <+> pf <+> y
      (_,[x,y],NonFix)    -> i #> x <+> pf <+> y
      (_,[x,y],RightFix)  -> i #> x <+> pf <+> pguard i y
      _ -> prettyap f a
    where pf = pguard (-1) f
prettyop :: (Pretty f, HasVar f, Pretty a) => f -> [a] -> Doc'
prettyop f a
  | Just v <- unVar f
  , Just (i,d) <- opPrec v = case (v,a,d) of
      (V "-",[x],_)       -> i #> pf <+> x
      (_,[x,y],LeftFix)   -> i #> pguard i x <+> pf <+> y
      (_,[x,y],NonFix)    -> i #> x <+> pf <+> y
      (_,[x,y],RightFix)  -> i #> x <+> pf <+> pguard i y
      _ -> prettyap f a
    where pf = pguard (-1) f
prettyop f a
  | Just v <- unVar f
  , Just (i,d) <- opPrec v = case (v,a,d) of
      (V "-",[x],_)       -> i #> pf <+> x
      (_,[x,y],LeftFix)   -> i #> pguard i x <+> pf <+> y
      (_,[x,y],NonFix)    -> i #> x <+> pf <+> y
      (_,[x,y],RightFix)  -> i #> x <+> pf <+> pguard i y
      _ -> prettyap f a
    where pf = pguard (-1) f