[Haskell-cafe] Safe Haskell safe-inferred status

Roman Cheplyaka roma at ro-che.info
Sat Dec 8 15:45:29 CET 2012


* Omari Norman <omari at smileystation.com> [2012-12-08 08:34:14-0500]
> Is there a way to determine whether a module has been marked safe by GHC
> for purposes of Safe Haskell?
> 
> The GHC 7.4 docs say that if I compile a module and I don't use the -XSafe
> or -XTrustworthy flag, GHC will automatically figure out whether the module
> would have compiled with -XSafe and, if so, marks the module as safe. Where
> does GHC record this determination? It doesn't seem to show up in ghc-pkg
> dump (there you can see trusted packages, but I am looking for
> safe-inferred status for modules.) ghc --show-iface seems to come up dry
> too.

% ghc --show-iface /opt/ghc761/lib/ghc-7.6.1/filepath-1.3.0.1/System/FilePath.hi | grep trusted:
trusted: safe

> I know Haddock shows this information but sometimes it says "Safe Haskell:
> None". I have no idea what this means so I was wondering what GHC itself
> says.

It's what GHC says — see the SafeHaskellMode type in
https://github.com/ghc/ghc/blob/master/compiler/main/DynFlags.hs

It seems that None means that the module was compile with Safe Haskell
disabled (-fno-safe-infer), but I'm not sure what the semantics of this
is. Perhaps it's equivalent to Unsafe?

Roman



More information about the Haskell-Cafe mailing list