Safe Haskell and Haskell Platform: near-term tactics

Yitzchak Gale gale at sefer.org
Fri Jul 13 12:16:53 BST 2012


Mark Lentczner wrote:
> Therefore, it seems to me that it can hardly be considered, at this point in
> I think we should not consider it a requirement of libraries for addition to the
> platform for the upcoming release (2012.4.0.0), nor the release after
> (2013.2.0.0).

Now the paper has come out, and it appears that
Safe Haskell is not much to be worried about.
There is likely to be a lot of benefit, and it's
very easy to support.

Even if SH surprisingly turns out not to be useful
and falls out of usage, having unused SH pragmas
in platform modules won't hurt anything; package
authors can later remove them at their leisure in
that case.

On the other hand, prompt support by the platform
may be the one critical point that determines
whether this effort succeeds or fails.

So I vote for requiring SH pragmas in all
platform packages already for 2013.2.0.0.
We can defer the final decision. But it
will very much help getting things moving
if we officially say that SH pragmas
are highly recommended for 2012.4.0.0,
and likely to be *required* for 2013.2.0.0.

For a future platform release, perhaps the
one after 2013.2.0.0, we can require that
the Safe pragma be used (and not just
Trustworthy) whenever that is possible,
i.e., whenever the package still compiles
with -fpackage-safe with Trustworthy
changed to Safe.

> ...and start now.

Here's a proposal for a more concrete plan:

Every platform package author should
*now* add a Safe pragma to every module,
except in those rare cases where there is
a reason to suspect a problem.

Test that it still works by compiling
with the extra GHC flag -fpackage-trust.

Reasons to suspect a problem include
direct use in the module of:

o Any function with the word "unsafe"
in its name

o Template Haskell

o GeneralizedNewtypeDeriving

o RULEs

o FFI

o Deriving Data.Typeable

In most of those cases, the Trustworthy
pragma should be used instead.

Another minor problem is when a
dependency does not yet provide
a Safe Haskell pragma. In that case,
use Trustworthy, and upgrade to Safe
once the dependency resolves the
problem.

If unsure, please contact the libraries or
haskell-platform list promptly.

Thanks,
Yitz



More information about the Haskell-platform mailing list