How to get the file descriptor of a handle?

2010-02-13 Thread Volker Wysk
Hello
 
I'd like to know how you get the file descriptor, which is incapsulated in a 
handle. The libraries GHC.IO.Handle/GHC.IO.Handle.FD only provide for the other 
direction.

The function haFD, which I've used before I've updated to the current version 
of GHC (6.12), appears to be in use two times in the libraries. But there isn't 
a definition anywhere. 


Any help would be appreciated.

Cheers,
Volker


-- 
Volker Wysk p...@volker-wysk.de
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: How to get the file descriptor of a handle?

2010-02-13 Thread Jeremy Shaw

Hello,

In GHC 6.12 there is no guarantee that a Handle is backed up by a file  
descriptor. That said,  check out the handleToFd defined on line 141  
here:


http://patch-tag.com/r/mae/sendfile/snapshot/current/content/pretty/src/Network/Socket/SendFile/Internal.hs

A better type might be:

handleToFd :: Handle - IO (Maybe Fd)

instead of raising an exception. Having a Handle not backed by a Fd is  
not really an 'exceptional' condition after all.


- jeremy


On Feb 13, 2010, at 6:23 AM, Volker Wysk wrote:


Hello

I'd like to know how you get the file descriptor, which is  
incapsulated in a handle. The libraries GHC.IO.Handle/ 
GHC.IO.Handle.FD only provide for the other direction.


The function haFD, which I've used before I've updated to the  
current version of GHC (6.12), appears to be in use two times in the  
libraries. But there isn't a definition anywhere.



Any help would be appreciated.

Cheers,
Volker


--
Volker Wysk p...@volker-wysk.de
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users