1. 15 Aug, 2001 4 commits
  2. 18 May, 2001 1 commit
    • simonmar's avatar
      [project @ 2001-05-18 16:54:04 by simonmar] · d9af408e
      simonmar authored
      I/O library rewrite
      This commit replaces the old C/Haskell I/O implementation with a new
      Haskell-only one using the new FFI & hsc2hs.
      main points:
         - lots of code deleted: we're about 3000 lines of C lighter,
           but the amount of Haskell code is about the same.
         - performance is ok: some operations are faster, others are
           slower.  There's still some tuning to do, though.
         - the new library is designed to handle read/write streams
           much better: a read/write stream gets a special kind of
           handle internally called a "DuplexHandle", which actually
           contains two separate handles, one for writing and one for
           reading.  The upshot is that you can do simultaneous reading
           and writing to/from a socket or FIFO without any locking
           problems.  The effect is similar to calling socketToHandle
           twice, except that finalization works properly (creating
           two separate Handles could lead to the socket being closed
           too early when one of the Handles is GC'd).
         - hConnectTo and withHandleFor are gone (no one responded to
           my mail on GHC users, but we can always bring 'em back if
         - I made a half-hearted attempt at keeping the system-specific
           code in one place: see PrelPosix.hsc.
         - I've rearranged the I/O tests and added lots more.
           ghc/tests/lib/IO now contains Haskell 98-only IO tests,
           ghc/test/lib/{IOExts, Directory, Time} now contain tests for
           the relevant libraries.  I haven't quite finished in here yet,
           the IO tests work but the others don't yet.
         - I haven't done anything about Unicode yet, but now we can
           start to discuss what needs doing here.  The new library
           is using MutableByteArrays for its buffers because that
           turned out to be a *lot* easier (and quicker) than malloc'd
           buffers - I hope this won't cause trouble for unicode
           translations though.
      WARNING: Windows users refrain from updating until we've had a chance
      to fix any issues that arise.
      Testing: the basic H98 stuff has been pretty thoroughly tested, but
      the new duplex handle stuff is still a little green.
  3. 15 Mar, 2001 1 commit
    • qrczak's avatar
      [project @ 2001-03-15 20:35:49 by qrczak] · 5966a28f
      qrczak authored
      Finish the destruct story:
      * Add lengthArray0, destructArray, destructArray0 to module MarshalArray.
      * Call destruct in withObject, withArray, withArray0.
      * Document destruct and friends.
  4. 11 Jan, 2001 1 commit
    • simonmar's avatar
      [project @ 2001-01-11 17:25:56 by simonmar] · efa88123
      simonmar authored
      Re-organisation of ghc/lib/std and hslibs/lang
      In brief: move deprecated features out of ghc/lib/std and into
      hslibs/lang, move new FFI libraries into ghc/lib/std and start
      using them.
      - foreign import may now return an unboxed type (this was
        advertised to work before, but in fact didn't).  Subsequent
        cleanups in PrelInt/PrelWord.
      - Ptr is now defined in ghc/lib/std/PrelPtr.lhs.  Ptr is no
        longer a newtype of Addr, it is defined directly in terms of
      - PrelAddr has disappeared from ghc/lib/std, all uses of Addr in
        ghc/lib/std have been replaced with Ptr.  The definitions of
        Addr has been moved to hslibs/lang/Addr.lhs, as has
        lots of other Addr-related stuff.
      - ForeignObj has been removed from ghc/lib/std, and replaced with
        ForeignPtr.  The definition of ForeignObj has been moved to
      - Most of the new FFI has been moved into ghc/lib/std in the form
        of modules PrelMarshalAlloc, PrelCString, PrelCError,
        PrelMarshalError, PrelMarshalArray, PrelMarshalUtils,
        PrelCTypes, PrelCTypesISO, and PrelStorable.  The corresponding
        modules in hslibs/lang simply re-export the contents of these
      - PrelPosixTypes defines a few POSIX types (CMode == mode_t,
      - PrelCError changed to access errno using foreign label and peek
        (the POSIX book I have says that errno is guaranteed to be an
        extern int, so this should be OK until I get around to making
        errno thread-safe).
      - Hacked the macros that generate the code for CTypes and
        CTypesISO to generate much less code
      - RtsAPI is now a bit more honest when it comes to building heap
        objects (it uses the correct constructors).
      - the Bits class and related stuff has been moved to ghc/lib/std
        (it was simpler this way).
      - Directory and System have been converted to use the new FFI.