[Haskell-cafe] Portability of Safe Haskell packages

Amit Levy amit at amitlevy.com
Tue Nov 27 18:34:31 CET 2012


FWIW, some very core libraries do this:
http://hackage.haskell.org/packages/archive/bytestring/0.10.2.0/doc/html/src/Data-ByteString.html

(see very top of linked source file)

Perhaps a more general solution would be for GHC to take the internet 
explorer route and require a special javascript include in each source 
file to get compatibility :)

-A

On 11/23/2012 03:34 PM, Roman Cheplyaka wrote:
> * 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
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20121127/c2171ab2/attachment.htm>


More information about the Haskell-Cafe mailing list