Plain source file: base/AST/HsGuardsPretty.hs (2002-03-30)

HsGuardsPretty is imported by: BaseSyntaxPretty, HsDeclPretty, HsExpPretty, HsGuards.

module HsGuardsPretty where

import SrcLoc
import HsGuardsStruct
import PrettySymbols(rarrow)
import PrettyUtil(ppWhere)
import PrettyPrint

-- Pretty printing for HsAlt
instance (Printable e, Printable p, Printable ds) =>
         Printable (HsAlt e p ds) where
    ppi (HsAlt s p rhs ds) =
      sep [ppi p,nest 2 $ sep [ppRhs rarrow rhs,ppWhere (ppis ds)]]

--ppRhs :: Printable e => Doc -> Doc -> HsRhs e -> Doc -> Doc
ppRhs to (HsBody e)   = nest 2 $ sep [ppi to, funNest e]
ppRhs to (HsGuard gs) = vcat $ map ppGuard gs
  where ppGuard (_, guard, body) =
	  nest 2 $ sep [ '|' <+> guard <+> to, funNest body]


(HTML for this module was generated on 2009-01-04. About the conversion tool.)