aboutsummaryrefslogtreecommitdiffhomepage
path: root/System/Posix/IO.hsc
diff options
context:
space:
mode:
authorGravatar ross <unknown>2003-10-18 00:35:26 +0000
committerGravatar ross <unknown>2003-10-18 00:35:26 +0000
commit91399425157428e5a6171b50eeb810d927d8f977 (patch)
tree960f3e45ef85317925c82c13758452f522596b10 /System/Posix/IO.hsc
parentaf8f41be147bb67ebedeac337f808c45efb897e1 (diff)
[project @ 2003-10-18 00:35:26 by ross]
Hugs only: add handleToFd
Diffstat (limited to 'System/Posix/IO.hsc')
-rw-r--r--System/Posix/IO.hsc9
1 files changed, 6 insertions, 3 deletions
diff --git a/System/Posix/IO.hsc b/System/Posix/IO.hsc
index c350f8a..00e56af 100644
--- a/System/Posix/IO.hsc
+++ b/System/Posix/IO.hsc
@@ -51,10 +51,8 @@ module System.Posix.IO (
-- ** Duplicating file descriptors
dup, dupTo,
-#ifdef __GLASGOW_HASKELL__
-- ** Converting file descriptors to\/from Handles
handleToFd,
-#endif
fdToHandle,
) where
@@ -76,7 +74,7 @@ import qualified GHC.Handle
#ifdef __HUGS__
import Hugs.Prelude (IOException(..), IOErrorType(..))
-import qualified Hugs.IO (openFd)
+import qualified Hugs.IO (handleToFd, openFd)
#endif
#include "HsUnix.h"
@@ -194,6 +192,11 @@ fdToHandle fd = GHC.Handle.fdToHandle (fromIntegral fd)
#endif
#ifdef __HUGS__
+handleToFd :: Handle -> IO Fd
+handleToFd h = do
+ fd <- Hugs.IO.handleToFd h
+ return (fromIntegral fd)
+
fdToHandle :: Fd -> IO Handle
fdToHandle fd = do
mode <- fdGetMode (fromIntegral fd)