module Hint.Conversions (
typeToString, kindToString, moduleToString, isSucceeded
) where
import qualified Hint.GHC as GHC
import Hint.Base
typeToString :: MonadInterpreter m => GHC.Type -> m String
typeToString t
= do
unqual <- runGhc GHC.getPrintUnqual
withDynFlags $ \df ->
return $ GHC.showSDocForUser df unqual (GHC.pprTypeForUser t)
kindToString :: MonadInterpreter m => GHC.Kind -> m String
kindToString k
= withDynFlags $ \df ->
return $ GHC.showSDoc df (GHC.pprTypeForUser k)
moduleToString :: GHC.Module -> String
moduleToString = GHC.moduleNameString . GHC.moduleName
isSucceeded :: GHC.SuccessFlag -> Bool
isSucceeded GHC.Succeeded = True
isSucceeded GHC.Failed = False