Commit 2f63e686 authored by dterei's avatar dterei

SafeHaskell: Change SafeHaskellMode to use Outputable vs Show

parent ebdbd8bc
...@@ -335,13 +335,13 @@ data SafeHaskellMode ...@@ -335,13 +335,13 @@ data SafeHaskellMode
| Sf_Safe | Sf_Safe
deriving (Eq) deriving (Eq)
instance Show SafeHaskellMode where instance Outputable SafeHaskellMode where
show Sf_None = "None" ppr Sf_None = ptext $ sLit "None"
show Sf_SafeImports = "SafeImports" ppr Sf_SafeImports = ptext $ sLit "SafeImports"
show Sf_SafeLanguage = "SafeLanguage" ppr Sf_SafeLanguage = ptext $ sLit "SafeLanguage"
show Sf_Trustworthy = "Trustworthy" ppr Sf_Trustworthy = ptext $ sLit "Trustworthy"
show Sf_TrustworthyWithSafeLanguage = "Trustworthy + SafeLanguage" ppr Sf_TrustworthyWithSafeLanguage = ptext $ sLit "Trustworthy + SafeLanguage"
show Sf_Safe = "Safe" ppr Sf_Safe = ptext $ sLit "Safe"
data ExtensionFlag data ExtensionFlag
= Opt_Cpp = Opt_Cpp
...@@ -1036,7 +1036,7 @@ combineSafeFlags a b = ...@@ -1036,7 +1036,7 @@ combineSafeFlags a b =
| otherwise -> err | otherwise -> err
where err = ghcError (CmdLineError $ "Incompatible SafeHaskell flags! (" where err = ghcError (CmdLineError $ "Incompatible SafeHaskell flags! ("
++ show a ++ "," ++ show b ++ ")") ++ showPpr a ++ "," ++ showPpr b ++ ")")
-- | Retrieve the options corresponding to a particular @opt_*@ field in the correct order -- | Retrieve the options corresponding to a particular @opt_*@ field in the correct order
getOpts :: DynFlags -- ^ 'DynFlags' to retrieve the options from getOpts :: DynFlags -- ^ 'DynFlags' to retrieve the options from
...@@ -1795,8 +1795,8 @@ languageFlags = [ ...@@ -1795,8 +1795,8 @@ languageFlags = [
safeHaskellFlags :: [FlagSpec SafeHaskellMode] safeHaskellFlags :: [FlagSpec SafeHaskellMode]
safeHaskellFlags = [mkF Sf_SafeImports, mkF' Sf_SafeLanguage, safeHaskellFlags = [mkF Sf_SafeImports, mkF' Sf_SafeLanguage,
mkF Sf_Trustworthy, mkF' Sf_Safe] mkF Sf_Trustworthy, mkF' Sf_Safe]
where mkF flag = (show flag, AlwaysAllowed, flag, nop) where mkF flag = (showPpr flag, AlwaysAllowed, flag, nop)
mkF' flag = (show flag, EnablesSafe, flag, nop) mkF' flag = (showPpr flag, EnablesSafe, flag, nop)
-- | These -X<blah> flags can all be reversed with -XNo<blah> -- | These -X<blah> flags can all be reversed with -XNo<blah>
xFlags :: [FlagSpec ExtensionFlag] xFlags :: [FlagSpec ExtensionFlag]
......
...@@ -1354,7 +1354,7 @@ isSafeModule m = do ...@@ -1354,7 +1354,7 @@ isSafeModule m = do
let iface = GHC.modInfoIface mi let iface = GHC.modInfoIface mi
case iface of case iface of
Just iface' -> do Just iface' -> do
let trust = show $ getSafeMode $ GHC.mi_trust iface' let trust = showPpr $ getSafeMode $ GHC.mi_trust iface'
pkg = if packageTrusted dflags m then "trusted" else "untrusted" pkg = if packageTrusted dflags m then "trusted" else "untrusted"
liftIO $ putStrLn $ "Trust type is (Module: " ++ trust liftIO $ putStrLn $ "Trust type is (Module: " ++ trust
++ ", Package: " ++ pkg ++ ")" ++ ", Package: " ++ pkg ++ ")"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment