[Haskell-cafe] Portability of Safe Haskell packages

Roman Cheplyaka roma at ro-che.info
Sat Nov 24 00:34:27 CET 2012


* Herbert Valerio Riedel <hvr at gnu.org> [2012-11-24 00:06:44+0100]
> Roman Cheplyaka <roma at ro-che.info> writes:
> > It has been pointed out before that in order for Safe Haskell to be
> > useful, libraries (especially core libraries) should be annotated
> > properly with Safe Haskell LANGUAGE pragmas.
> >
> > However, that would make these libraries unusable with alternative
> > Haskell implementations, even if otherwise they these libraries are
> > Haskell2010.
> >
> > To quote the standard:
> >
> >   If a Haskell implementation does not recognize or support a particular
> >   language feature that a source file requests (or cannot support the
> >   combination of language features requested), any attempt to compile or
> >   otherwise use that file with that Haskell implementation must fail
> >   with an error. 
> >
> > Should it be advised to surround safe annotations with CPP #ifs?
> > Or does anyone see a better way out of this contradiction?
> 
> ...but IIRC CPP isn't part of Haskell2010, or is it?

It isn't indeed. But:

1) it's a very basic extension which is supported by (almost?) all
   existing implementations; or
2) if you want to be 100% Haskell2010, you can name your file *.cpphs and
   let Cabal do preprocessing.

1) is a compromise and 2) is not very practical, so I'm eager to hear
other alternatives.

Roman



More information about the Haskell-Cafe mailing list