GHC Win32 ffi functions as implemented for Pugs

Max Maischein (Corion) perl6 at corion.net
Sun May 22 18:32:27 EDT 2005


Hello all,

I have been working on Pugs, the current Perl6 interpreter, and have
been hacking on Win32 compatibility. For that, I've written some
wrappers around native Win32 API calls using the very convenient FFI
that GHC 6.4 provides!

I wonder if you want to include the functions in GHC, as they are
missing on Win32. Autrijus Tang pointed me to this list.

The file is (live version) :

   http://svn.openfoundry.org/pugs/src/Pugs/Compat.hs

The implemented wrappers that are functional and not just stubs are (as
of r3680) :

For System.Environment:
setEnv :: String -> String -> Bool -> IO ()
getEnv :: String -> IO (Maybe String)
unsetEnv :: String -> IO ()

For some other module:
statFileSize :: FilePath -> IO Integer

For Posix.Process
getProcessTimes :: IO ProcessTimes
getProcessID :: IO Int

The code implementing them is inefficient and crude, partly because I
speak Haskell with a quite perlish lisp, and partly because I used the
first implementation that worked, so I like to hear about implementing
them in better style, or, even better that you choose to accept them
into GHC so I don't have to worry about them anymore.

The code itself is dual-licensed under the Artistic License and GPL and
thus should be compatible with whatever license GHC uses.

Hope you find my code useful,
-max

PS: If this message went to the wrong list, please tell me so and also
tell me where the message should go to!

PPS: Please CC me on the replies as I won't stay subscribed long.



More information about the Glasgow-haskell-users mailing list