Re: [Haskell-cafe] Re: [Haskell-beginners] Just how unsafe is unsafe

then Data.List.head Data.Maybe.fromMaybe etc are also unsafe?. Yes, I consider them unsafe. Whenever I see those functions I know
unsafe does not mean "with possible errors". unsafeXXX convert something in the IO monad into something that is not. So it can potentially contaminate your pure code. But Data.List.head applied to a empty list will interrupt the computation abruptly, so your code using head will either run side effect free or not run at all. I guess what unsafe should mean is a matter of taste. Personally I find correctness more important that pureness. An unsafe function will crash your program if evaluated when its preconditions do not hold. Whether that is because of impurity (segmentation fault?), a partial
On Fri, Feb 6, 2009 at 5:22 PM, Alberto G. Corona
participants (1)
-
Roel van Dijk