[Haskell-cafe] Idea for hackage feature

Henning Thielemann schlepptop at henning-thielemann.de
Thu Sep 16 13:18:26 EDT 2010

Ivan Lazar Miljenovic schrieb:
> On 16 September 2010 16:04, Mitar <mmitar at gmail.com> wrote:
>> Hi!
>> I just got an idea for hackage feature. All functions/modules listed
>> there could have some mark if they or any function/module they use
>> uses an unsafe* function. Of course this will make probably almost
>> everything marked as unsafe, but this is the idea - to raise awareness
>> about that so that you can prefer some function/implementation over
>> another.
>> ...
> The problem with this is: unsafe* functions would be better called
> "yesIGuaranteeThatUsingThisFunctionDoesResultInAReferentiallyTransparentEntityAndItsOKForMeToUseIt*".
>  They are "unsafe" in that you shouldn't use them blindly.

I think such a long and descriptive name would be helpful, since there
seem to be many programmers, that do not know, that functions using
unsafePerformIO must be referentially transparent.

My suggestion is to move the Unsafe modules to a new package 'unsafe'.
Then you can easily spot all "dirty" packages by looking at reverse
dependencies of 'unsafe'.

However I see the problem that there are two kinds of uses of

1. "Final" usage that turns some IO code into something that looks like
Non-IO and thus must behave this way.
2. "Interim" usage that provides new kinds of unsafe* functions, that
delegates the proof obligation to their users.

Packages that provide functions of type 2 must be treated like the
"unsafe" package, thus complicate the reverse dependency lookup.

More information about the Haskell-Cafe mailing list