
Hello all, I'm wondering if there is any equivalent to GHC.Handle.openFd which I can use with nhc98? It's nice being able to convert a file descriptor into a Handle... For the curious, I'm looking into how hard it might be to make darcs compilable using nhc98, and this is the first sticking point--actually the second one... the first was trivial. openFd is already handled via the configure script, so the interface doesn't need to be the same, as long as the functionality is equivalent, so I can write a wrapper. -- David Roundy http://www.darcs.net

On Friday 31 December 2004 09:35, David Roundy wrote:
For the curious, I'm looking into how hard it might be to make darcs compilable using nhc98, and this is the first sticking point--actually the
If you're interested in NHC98 from an academic perspective, then ignore my response... however, you're aware of the performance issues of NHC98? That it produces programs that are on the order of ten times slower than GHC compiled binaries? The binaries themselves are smaller, but the code is significantly -- and in my experience, noticably -- slower. -- --- SER "As democracy is perfected, the office of president represents, more and more closely, the inner soul of the people. On some great and glorious day the plain folks of the land will reach their heart's desire at last and the White House will be adorned by a downright moron." - H.L. Mencken (1880 - 1956)

David Roundy
I'm wondering if there is any equivalent to GHC.Handle.openFd which I can use with nhc98? It's nice being able to convert a file descriptor into a Handle...
I had a quick look at the documentation for openFd, and it wasn't very informative - no text, just a signature: openFd :: FD -> Maybe FDType -> FilePath -> IOMode -> Bool -> Bool -> IO Handle What are the FPType, FilePath, IOMode, and Bool arguments for? Also, there seem to be plenty of operations that /use/ an FD, but I couldn't find one that /returns/ an FD, so how are they created?. However, my guess is that these library functions are actually a thin skin over some fairly standard C library, in which case you can probably write a little bit of FFI code to interface to the same functionality. nhc98's representation of a Handle as a wrapper over C's FILE* type is "struct FileDesc", defined in src/runtime.h, and an example of some FFI stuff to manipulate a Handle can be seen in src/prelude/IO/OpenFile.hs and src/runtime/Builtin/cOpen.c Regards, Malcolm
participants (3)
-
David Roundy
-
Malcolm Wallace
-
Sean E. Russell