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

Johan Tibell johan.tibell at gmail.com
Thu Jul 12 05:52:35 CEST 2012


On Wed, Jul 11, 2012 at 4:38 PM, Brandon Allbery <allbery.b at gmail.com> wrote:
> unsafePerformIO is unsafe.
>
> Data.ByteString.map is only unsafe if it allows unsafePerformIO to be
> abused.
>
> If it can verify that nothing actually unsafe takes place — which it does,
> by dint of the promise inherent in it being exposed as pure —
> Data.ByteString.map is *not* unsafe.  The mechanical application of "oh, it
> uses unsafePerformIO, we don't care whether it proves it has used it safely:
> it must by definition be unsafe" just complicates things even more.  If
> indeed it's not simply a strawman.

It's unsafe in the sense that any module containing it cannot be
marked as Safe (only Trustworthy) and thus won't fit the scheme with
modules containing only Safe functions that Simon described.

-- Johan



More information about the Libraries mailing list