[Haskell-cafe] Using unsafePerformIO

Sebastian Sylvan sebastian.sylvan at gmail.com
Mon Aug 1 07:05:19 EDT 2005

On 8/1/05, Dinh Tien Tuan Anh <tuananhbirm at hotmail.com> wrote:

> depends on value of the first two elements of the list, f1, f2 and f3 will
> return three different values. So is it safe ?

If "f xs" always returns the same value for a given xs, then it's safe.
Doesn't look like that's the case here, though, since depending on the
GHC runtime scheduler f1 may finish first in one case, and then the
next time f2 may finish first, meaning that f xs will return two
different results for the same xs.
So that's not safe, and thus it should be in the IO monad.


Sebastian Sylvan
UIN: 44640862

More information about the Haskell-Cafe mailing list