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

Ian Lynagh igloo at earth.li
Thu Jul 12 00:19:20 CEST 2012


On Wed, Jul 11, 2012 at 11:46:42PM +0200, Henning Thielemann wrote:
> 
> On Wed, 11 Jul 2012, Bas van Dijk wrote:
> 
> > 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

If you do that, then you can't do

    import Old
    import MyMod.Unsafe

    f = ... unsafeDoSomething ...

as you will get an ambiguity error.

(you can work around it, e.g. by using a qualified name to refer to
unsafeDoSomething, but different people will have differing opinions
about whether that's OK)


Thanks
Ian




More information about the Libraries mailing list