DiffArray Performance

Stefan Reich doc at drjava.de
Fri Nov 7 15:21:10 EST 2003

Simon Marlow wrote:

>DiffArray is an example of a good use for unsafePerformIO: it uses
>imperative operations to implement a pure API.  The DiffArray is made of
>mutable objects under the hood, but as far as the programmer is
>concerned it behaves just like a pure Array.
I'd like to ask a general question about unsafePerformIO: What exactly 
does unsafe mean? Just "impure" or rather "may lead to all kinds of 
problems, you better don't use this"?

After a few experiments, I stopped using unsafePerformIO for disk access 
because it just segfaulted too much. I'm not 100% sure if 
unsafePerformIO was the culprit though; I did a lot of restructuring 
while eliminating it, so I might have inadvertently removed the real 
cause for the crashes in the process.


More information about the Glasgow-haskell-users mailing list