-maybe_code sty x
- = if codeStyle sty
- then ppBesides (ppPStr SLIT("Prelude_") : map mangle x)
- else ppStr x
- where
- -- ToDo: really should be in CStrings
- mangle '(' = ppPStr SLIT("Z40") -- decimal ascii #s
- mangle ')' = ppPStr SLIT("Z41")
- mangle '[' = ppPStr SLIT("Z91")
- mangle ']' = ppPStr SLIT("Z93")
- mangle ',' = ppPStr SLIT("Z44")
- mangle '-' = ppPStr SLIT("Zm")
- mangle '>' = ppPStr SLIT("Zg")
-
-pprTyCon :: PprStyle -> TyCon -> Pretty
-pprTyCon sty tycon = ppr sty (getName tycon)
-
-{- This old code looks suspicious to me.
- Just printing the name should do the job; apart from the extra junk
- on SynTyCons etc.
-
- Let's try and live without all this...
- Delete in due course. SLPJ Nov 96
-
-pprTyCon sty (PrimTyCon _ name _ _) = ppr sty name
-
-pprTyCon sty FunTyCon = maybe_code sty "->"
-pprTyCon sty (TupleTyCon _ _ arity) = case arity of
- 0 -> maybe_code sty "()"
- 2 -> maybe_code sty "(,)"
- 3 -> maybe_code sty "(,,)"
- 4 -> maybe_code sty "(,,,)"
- 5 -> maybe_code sty "(,,,,)"
- n -> maybe_code sty ( "(" ++ nOfThem (n-1) ',' ++ ")" )
-
-pprTyCon sty tycon@(DataTyCon uniq name kind tyvars ctxt cons derivings nd)
- = ppr sty name
-
-pprTyCon sty (SpecTyCon tc ty_maybes)
- = ppBeside (pprTyCon sty tc)
- ((if (codeStyle sty) then identToC else ppPStr) tys_stuff)
+getTyDescription ty
+ = case (splitSigmaTy ty) of { (_, _, tau_ty) ->
+ case tau_ty of
+ TyVarTy _ -> "*"
+ AppTy fun _ -> getTyDescription fun
+ FunTy _ res -> '-' : '>' : fun_result res
+ TyConApp tycon _ -> getOccString tycon
+ NoteTy (FTVNote _) ty -> getTyDescription ty
+ NoteTy (SynNote ty1) _ -> getTyDescription ty1
+ ForAllTy _ ty -> getTyDescription ty
+ }