I don't have anything to answer for the "interesting" part of your question, but if you're just interested in getting something working...
On Feb 16, 2008 3:13 PM, Dave Hinton <[EMAIL PROTECTED]> wrote: > 2. If GHC's implementation is working as designed, how do I translate > the C program above into Haskell? You can use the FFI to call localtime() directly; see http://www.haskell.org/haskellwiki/FFI_Introduction There's information on the types to use here: http://haskell.org/ghc/docs/latest/html/libraries/base/Foreign-C.html http://haskell.org/ghc/docs/latest/html/libraries/base/Foreign.html Something along the lines of: {-# LANGUAGE FFI #-} {-# INCLUDE <time.h> #-} import Foreign import Foreign.C data CStructTm = ... -- implement struct tm here instance Storable CStructTm where ... foreign import ccall unsafe "localtime" c_localtime :: Ptr CTime -> IO (Ptr CStructTm) localtime :: CTime -> IO CStructTm localtime = do ... -- marshal time into a pointer, call c_localtime, marshal structure back into a CStructTm and return it. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe