Hello,

The code in YHC is roughly "if some list is empty then error "No files found" 
else error "Many files found"". If this code were changed to the equivalent 
of "error (if some list is empty then "No files found" else "Many files 
found")", would there still be circumstances where the actual output produced 
could vary?

Thanks and best regards
Thorkil
On Wednesday 28 February 2007 12:31, Simon Marlow wrote:
> 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
> _______________________________________________
> Glasgow-haskell-bugs mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
> 
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to