[Haskell-cafe] Re: Why?

David Leimbach leimy2k at gmail.com
Thu Dec 10 14:28:06 EST 2009


Hi Stephen,

While it's fair to mention that unsafePerformIO is not in the report for the
reasons you give, it is present in some libraries.  The practical reality of
the situation is you can not in general trust that because a function's
signature is pure, that the implementation of that function is.

I mean you can, and you can pay the price for when you're wrong, as can the
other people affected by that choice to trust that nothing fishy is going on
behind the scenes, but it'd be a bad idea.

Here's a really contrived example.  Let's say you use a library, maybe one
of the soon to be supported shared libraries for GHC, and that you use some
pure functions of that library.  Now let's say the system is compromised,
and a modified version of said library is installed on the system which
during the pure computation, has the effect of sending data that's being
computed to some other internet connected machine.

Now let's say you're a financial institution and the haskell code is running
part of a webserver with people's account data in it.

Now do you want to trust all pure functions implicitly?

I realize this might be a bit too much of a straw man, but some people
actually have to consider these possibilities.

Dave

On Thu, Dec 10, 2009 at 9:45 AM, Stephen Tetley <stephen.tetley at gmail.com>wrote:

> Hello David
>
> Apropos the (unfortunately) frosty exchanges that greeted the first
> release of UHC a couple of months ago, which argued that UHC wasn't
> Haskell because it didn't implement n+k patterns, one could argue (at
> least for rhetorical effect) that Haskell plus unsafePerformIO isn't
> Haskell, I don't think you'll be able to find unsafePerformIO in the
> report...
>
> Best wishes
>
> Stephen
>
> 2009/12/10 David Leimbach <leimy2k at gmail.com>:
> >
> > That's not a "safe" way to think of 3rd party libraries.  It is a
> convenient
> > claim for promoting the language, and is probably more often than not the
> > case though it does not quite capture the whole truth.  unsafePerformIO
> can
> > exist in any library you import,
> [snip]
> > In short unsafePerformIO, while it's "supposed to be" avoided, may not be
> > avoided as much as the advice given to do so :-).
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20091210/d375442b/attachment.html


More information about the Haskell-Cafe mailing list