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.

I’m currently using showSDocUnqual . pprType . snd . tidyOpenType emptyTidyEnv But this has the problem that predicates don’t 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

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to