From: simonpj Date: Fri, 31 Oct 2003 12:57:59 +0000 (+0000) Subject: [project @ 2003-10-31 12:57:59 by simonpj] X-Git-Tag: Approx_11550_changesets_converted~300 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=d0c3963993f2255069d63229f8ccfc9ac0435719;p=ghc-hetmet.git [project @ 2003-10-31 12:57:59 by simonpj] Wibble to TH -> HsSyn conversion --- diff --git a/ghc/compiler/hsSyn/Convert.lhs b/ghc/compiler/hsSyn/Convert.lhs index a21f364..5098901 100644 --- a/ghc/compiler/hsSyn/Convert.lhs +++ b/ghc/compiler/hsSyn/Convert.lhs @@ -225,7 +225,9 @@ cvtd (FunD nm cls) = FunMonoBind (vName nm) False (map cvtclause cls) loc cvtd (Meta.ValD p body ds) = PatMonoBind (cvtp p) (GRHSs (cvtguard body) (cvtdecs ds) void) loc0 -cvtd x = panic "Illegal kind of declaration in where clause" + +cvtd d = cvtPanic "Illegal kind of declaration in where clause" + (text (show (Meta.pprDec d))) cvtclause :: Meta.Clause -> Hs.Match RdrName @@ -302,7 +304,8 @@ cvt_context tys = map cvt_pred tys cvt_pred :: Meta.Type -> HsPred RdrName cvt_pred ty = case split_ty_app ty of (ConT tc, tys) -> HsClassP (tconName tc) (map cvtType tys) - other -> pprPanic "Malformed predicate" (text (show (Meta.pprType ty))) + (VarT tv, tys) -> HsClassP (tName tv) (map cvtType tys) + other -> cvtPanic "Malformed predicate" (text (show (Meta.pprType ty))) cvtType :: Meta.Type -> HsType RdrName cvtType ty = trans (root ty []) @@ -335,6 +338,11 @@ sigP other = False ----------------------------------------------------------- +cvtPanic :: String -> SDoc -> b +cvtPanic herald thing + = pprPanic herald (thing $$ ptext SLIT("When splicing generated code into the program")) + +----------------------------------------------------------- -- some useful things truePat = ConPatIn (cName "True") (PrefixCon [])