[Haskell-cafe] Re: Exception handling in numeric computations
lemming at henning-thielemann.de
Thu Mar 26 11:52:37 EDT 2009
On Thu, 26 Mar 2009, Xiao-Yong Jin wrote:
> So I have another question. Is the following function safe
> and legitimate?
>> safeDiv :: (Exception e, Integral a) =>
>> a -> a -> Either e a
>> safeDiv x y = unsafePerformIO . try . evaluate $ div x y
> I believe it should be okay to use this 'safeDiv'. What do
I think that question is wrong way around. The real question is, why do
you want to solve your problem using unsafePerformIO?
More information about the Haskell-Cafe