[GHC] #1171: GHC doesn't respect the imprecise exceptions semantics

Simon Marlow simonmarhaskell at gmail.com
Wed Feb 28 06:31:54 EST 2007


Neil Mitchell wrote:
> Hi
> 
>>  In response to Neil: why use `unsafePerformIO` rather than IO exceptions
>>  here?  I think you're asking for more trouble...
> 
> Are you referring to ioError? My knowledge of exceptions in Haskell is 
> limited.
> 
> The error architecture is often a long way from the IO monad, so
> whatever we do can't require the IO monad.

Yes - the example was in the IO monad so I thought you could use IO exceptions. 
  In any case, I don't recommend using 'error' (or indeed 'unsafePerformIO') for 
errors you report to the user, purely because of its non-deterministic 
semantics.  If you use a suitable error monad or IO exceptions, you can be sure 
that you'll get the same behaviour regardless of compiler or optimisation settings.

Cheers,
	Simon



More information about the Glasgow-haskell-bugs mailing list