Wibble to TH -> HsSyn conversion
cvtd (Meta.ValD p body ds) = PatMonoBind (cvtp p) (GRHSs (cvtguard body)
(cvtdecs ds)
void) loc0
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
cvtclause :: Meta.Clause -> Hs.Match RdrName
cvt_pred :: Meta.Type -> HsPred RdrName
cvt_pred ty = case split_ty_app ty of
(ConT tc, tys) -> HsClassP (tconName tc) (map cvtType 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 [])
cvtType :: Meta.Type -> HsType RdrName
cvtType ty = trans (root ty [])
-----------------------------------------------------------
-----------------------------------------------------------
+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 [])
-- some useful things
truePat = ConPatIn (cName "True") (PrefixCon [])