[Haskell-cafe] Safe Haskell?

Mario blamario at rogers.com
Mon May 3 15:47:23 UTC 2021



On 2021-05-03 10:25 a.m., Richard Eisenberg wrote:
> It's true that Safe cannot be overridden locally. This is implemented 
> by the fact that NoSafe does not exist. To me, this design makes 
> sense, because it means that compiling with `ghc -XSafe` is guaranteed 
> to use Safe Haskell. So we would need something like a default-safety 
> field in Cabal, that could be overridden locally.
>
> But, still, this may be easier than the status quo.


I don't see why this should be easier. I do understand how type checking 
is easier than type inference, but in this case the "type" of the module 
(and every declaration in it) is a single bit: Safe or Unsafe. How can 
checking whether a declaration is safe can be easier than inferring 
whether it is? I must be misunderstanding your proposal.


> Do we think this would work? Specifically:
>
> * Introduce a new flag -fdefault-safety={safe,trustworthy,unsafe} that 
> changes the module-level default. This default names the safety level 
> in effect for any module that declares none of Safe, Trustworthy, or 
> Unsafe.
> * If -fdefault-safety is not specified at the command line, it is as 
> if the user wrote -fdefault-safety=unsafe.
>
> And that's it.
>
> Consequence: Safe-inference would never take place, because every 
> module would have a declared level of Safety. The Safe-inference code 
> could thus be removed.
>
> Further work: Introduce default-safety in Cabal, but that's not really 
> necessary to make the changes above.
>
> What do we think?
>
> Richard
>
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.




More information about the Haskell-Cafe mailing list