1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | import GHC
import HscTypes (liftIO)
import GHC.Paths (libdir)
import Outputable (SDoc, showSDoc)
ppr :: SDoc -> GhcT IO ()
ppr = liftIO . putStrLn . showSDoc
main = runGhcT (Just libdir) $ do
dlflags <- getSessionDynFlags
setSessionDynFlags dlflags
mod <- findModule (mkModuleName "Prelude") Nothing
setContext [] [mod]
exprType "length []" >>= ppr . pprParendType
exprType "print" >>= ppr . pprParendType
|