Commit 58d200ac authored by chak@cse.unsw.edu.au.'s avatar chak@cse.unsw.edu.au.
Browse files

Better pretty printing for CoPat

Mon Sep 18 16:45:13 EDT 2006  Manuel M T Chakravarty <chak@cse.unsw.edu.au>
  * Better pretty printing for CoPat
  Sun Aug  6 17:25:19 EDT 2006  Manuel M T Chakravarty <chak@cse.unsw.edu.au>
    * Better pretty printing for CoPat
    Wed Jul 26 08:22:22 EDT 2006  simonpj@microsoft.com
parent c58414c7
......@@ -323,6 +323,7 @@ data ExprCoFn
instance Outputable ExprCoFn where
ppr co_fn = pprCoFn (ptext SLIT("<>")) co_fn
pprCoFn :: SDoc -> ExprCoFn -> SDoc
pprCoFn it CoHole = it
pprCoFn it (CoCompose f1 f2) = pprCoFn (pprCoFn it f2) f1
pprCoFn it (ExprCoFn co) = it <+> ptext SLIT("`cast`") <+> pprParendType co
......
......@@ -22,7 +22,8 @@ module HsPat (
import {-# SOURCE #-} HsExpr ( SyntaxExpr )
-- friends:
import HsBinds ( DictBinds, HsBind(..), ExprCoFn, isIdCoercion, emptyLHsBinds, pprLHsBinds )
import HsBinds ( DictBinds, HsBind(..), ExprCoFn, isIdCoercion, pprCoFn,
emptyLHsBinds, pprLHsBinds )
import HsLit ( HsLit(HsCharPrim), HsOverLit )
import HsTypes ( LHsType, PostTcType )
import BasicTypes ( Boxity, tupleParens )
......@@ -192,7 +193,7 @@ pprPat (NPat l Nothing _ _) = ppr l
pprPat (NPat l (Just _) _ _) = char '-' <> ppr l
pprPat (NPlusKPat n k _ _) = hcat [ppr n, char '+', ppr k]
pprPat (TypePat ty) = ptext SLIT("{|") <> ppr ty <> ptext SLIT("|}")
pprPat (CoPat co pat _) = parens (ppr co) <+> ptext SLIT("`cast`") <+> ppr pat
pprPat (CoPat co pat _) = parens (pprCoFn (ppr pat) co)
pprPat (SigPatIn pat ty) = ppr pat <+> dcolon <+> ppr ty
pprPat (SigPatOut pat ty) = ppr pat <+> dcolon <+> ppr ty
pprPat (DictPat ds ms) = parens (sep [ptext SLIT("{-dict-}"),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment