prettyEquation :: (f -> PP.Doc) -> (v -> PP.Doc) -> Equation f v tp -> PP.Doc
prettyEquation ppFun ppVar eqn = pp False (lhs eqn) PP.<+> PP.text "=" PP.</> ppDist (rhs eqn) where
  pp showLabel = prettyExpression showLabel ppFun ppVar
  ppDist (Distribution _ [(1,r)]) = pp False r
  ppDist (Distribution d ls) =
    PP.encloseSep (PP.text "{") (PP.text "}") (PP.text ";")
    [ppRatio d p PP.<+> PP.text ":" PP.<+> pp False r | (p,r) <- ls ]
  ppRatio d p = PP.int p PP.<> PP.text "/" PP.<> PP.int d
prettyEquation :: (f -> PP.Doc) -> (v -> PP.Doc) -> Equation f v tp -> PP.Doc
prettyEquation ppFun ppVar eqn = pp False (lhs eqn) PP.<+> PP.text "=" PP.</> ppDist (rhs eqn) where
  pp showLabel = prettyExpression showLabel ppFun ppVar
  ppDist (Distribution _ [(1,r)]) = pp False r
  ppDist (Distribution d ls) =
    PP.encloseSep (PP.text "{") (PP.text "}") (PP.text ";")
    [ppRatio d p PP.<+> PP.text ":" PP.<+> pp False r | (p,r) <- ls ]
  ppRatio d p = PP.int p PP.<> PP.text "/" PP.<> PP.int d
prettyEquation ppFun ppVar eqn = pp False (lhs eqn) PP.<+> PP.text "=" PP.</> ppDist (rhs eqn) where
  pp showLabel = prettyExpression showLabel ppFun ppVar
  ppDist (Distribution _ [(1,r)]) = pp False r
  ppDist (Distribution d ls) =
    PP.encloseSep (PP.text "{") (PP.text "}") (PP.text ";")
    [ppRatio d p PP.<+> PP.text ":" PP.<+> pp False r | (p,r) <- ls ]
  ppRatio d p = PP.int p PP.<> PP.text "/" PP.<> PP.int d