
Hi, Thanks for the reply, I've taken a look at the implementation of pprTypeForUser and it should do what I want but doesn't :( My function is printType :: PrintUnqualified -> Type.Type -> String printType qual = showSDocForUser qual . pprTypeForUser False but I still don't get the predicates printer out "(t_amCk, [a]) -> (t_amCk, [a]) -> (t_amCk, [a])" is what I get instead of "Num t => (t, [a]) -> (t, [a]) -> (t, [a])" :( Guess I'll go take a look at hint to see if it does anything else Cheers, Phyx -----Original Message----- From: Daniel Gorín [mailto:dgorin@dc.uba.ar] Sent: Sunday, July 04, 2010 15:49 To: Phyx Cc: haskell-cafe@haskell.org Subject: Re: [Haskell-cafe] ghc api printing of types I believe the way is done in hint is something like this (untested): showType t = do -- Unqualify necessary types -- (i.e., do not expose internals) unqual <- GHC.getPrintUnqual return $ GHC.showSDocForUser unqual (GHC.pprTypeForUser False t) -- False means 'drop explicit foralls' Hope that helps Daniel On Jul 4, 2010, at 8:36 AM, Phyx wrote:
I was wondering how given a Type I can get a pretty printed type out of it.
Im currently using showSDocUnqual . pprType . snd . tidyOpenType emptyTidyEnv But this has the problem that predicates dont get printed, anyone know how GHCi does this?
Thanks, Phyx _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe