Re: [Haskell-cafe] An exceptional exception

2007-11-09 Thread Radosław Grzanka
2007/11/8, Andrew Coppin [EMAIL PROTECTED]:
 Anyway, I wrote a cute little test function for figuring out how each
 kind of exception works:

Hi,
  could you post your code for this cute test? I would be greatful.

Thanks,
  Radek

P.S. Not that I can help, but I'd like to start learning this.

-- 
Codeside: http://codeside.org/
Przedszkole Miejskie nr 86 w Lodzi: http://www.pm86.pl/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] An exceptional exception

2007-11-09 Thread Andrew Coppin

Radosław Grzanka wrote:

2007/11/8, Andrew Coppin [EMAIL PROTECTED]:
  

Anyway, I wrote a cute little test function for figuring out how each
kind of exception works:



Hi,
  could you post your code for this cute test? I would be greatful.

Thanks,
  Radek

P.S. Not that I can help, but I'd like to start learning this.

  


For you (and anybody else who's interested), it can be found here:

http://www.hpaste.org/3766

;-)

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] An exceptional exception

2007-11-09 Thread Andrew Coppin

Well, my problems have now multiplied beyong belief!

Allow me to summerise:

1. There exists an I/O exception called invalid parameter, which is 
not detectable with any of the 8 predicates. (Isn't this what illegal 
operation is supposed to be for? A general catch-all?)


2. Attempting to open an invalid filename yields the undetectable 
invalid parameter exception (rather than, say, illegal operation).


3. Attempting to read a directory with an invalid name does the same.

3. Attempting to open a *file* you don't have permission for yields 
permission error, as expected. However, attempting to read a 
*directory* yields... invalid parameter again. (Thus, even if this 
exception were detectable, there's no way to tell the difference between 
a permission error and a malformed filename.)


4. Not actually related to exceptions, but doesDirectoryExist C:\ 
yields False. (Even though getDirectoryContents C:\ yields the correct 
result.) So I can't even use that to filter out invalid directory names.


Aaaarrrgh! _

Clearly, making my program give the user meaningful error messages is 
going to be very hard - unless I resort to trying to *parse* the output 
of the Show instance for IOError...


Does anybody have any helpful hints for me at this point?

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] An exceptional exception

2007-11-09 Thread Brandon S. Allbery KF8NH


On Nov 9, 2007, at 15:01 , Andrew Coppin wrote:

4. Not actually related to exceptions, but doesDirectoryExist C:\  
yields False. (Even though getDirectoryContents C:\ yields the  
correct result.) So I can't even use that to filter out invalid  
directory names.


This is an ancient and extremely annoying general DOS/Windows wart.   
The root directory has several unexpected behaviors, because it is  
*not* in fact a directory (or wasn't on FAT, and the behaviors have  
to be kept for backward compatibility).


(You're also not the only one to be frustrated by having to parse  
stringified I/O exceptions to decipher them.)


--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED]
system administrator [openafs,heimdal,too many hats] [EMAIL PROTECTED]
electrical and computer engineering, carnegie mellon universityKF8NH


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe