safe vs. unsafe (Was: Haskell Platform proposal: Add the vector package)

Bas van Dijk v.dijk.bas at
Thu Jul 12 00:16:49 CEST 2012

On 11 July 2012 23:46, Henning Thielemann <lemming at> wrote:
> On Wed, 11 Jul 2012, Bas van Dijk wrote:
>> The ideal, but currently, impossible way of dealing with this is to
>> mark the _export_ of unsafe functions in a module as DEPRECATED and in
>> a later version remove the unsafe functions and mark the module as
>> Trustworthy. However this requires support for deprecating exports:
> We can easily re-define functions, like
> module Old where
> import MyMod.Unsafe as Unsafe
> {-# DEPRECATED "unsafeDoSomething" #-}
> unsafeDoSomething :: a -> b
> unsafeDoSomething = Unsafe.unsafeDoSomething
> Do we really need deprecating exports?

As explained in the ticket #4879 this will probably lead to lots of
"ambiguous occurrence of unsafeDoSomething" errors since users will
probably import both Old and MyMod.Unsafe. The only way to guard
against this is to use qualified imports. Lots of people don't use
them however.


More information about the Libraries mailing list