1. 29 Dec, 2001 1 commit
  2. 28 Dec, 2001 5 commits
    • sof's avatar
      [project @ 2001-12-28 22:58:17 by sof] · 44710bcb
      sof authored
      struct sigset_t -> sigset_t
    • simonpj's avatar
      [project @ 2001-12-28 17:25:31 by simonpj] · ae969b47
      simonpj authored
      	Dealing with deriving
      I spent a ridiculously long time peering at a bug report whereby
      a 'deriving' clause sent GHC 5.02.1 into a loop.  It was all to
      do with allowing instances like
      	instance Foo a b => Baz (T a)
      (Notice the 'b' on the left which does not appear on the right.)
      I realised that it's hard for the deriving machinery to find a
      fixpoint when these sort of instance decls are around.  So I
      now constrain *derived* instance decls not to have this form;
      all the tyvars on the left must appear on the right.
      On the way I commoned up the previously-separate tcSimplify
      machinery for 'deriving' and 'default' decls with that for
      everything else.   As a result, quite a few files are touched.
      I hope I havn't broken anything.
    • simonpj's avatar
      [project @ 2001-12-28 17:20:36 by simonpj] · 246dab8d
      simonpj authored
      	Buglet in rank-N polymorphism
      Fix a bug in the way result type signatures are handled; they
      hadn't been brought into the rank-N polymorphism world.
    • sof's avatar
      [project @ 2001-12-28 16:36:54 by sof] · 210d594c
      sof authored
    • sof's avatar
      [project @ 2001-12-28 00:14:33 by sof] · 9c77e2dc
      sof authored
      debugging-by-nightly-build-reports; give poke_c_flag a correct FI decl
  3. 27 Dec, 2001 3 commits
    • sof's avatar
      [project @ 2001-12-27 11:29:58 by sof] · d6977670
      sof authored
      Get rid of uses of #const, #peek, #poke and #ptr from PrelPosix.hsc
      (this leaves just uses of #type in PrelPosix) - provide constant and
      accessor wrappers via PrelIOUtils.c instead.
      Who knows, we might just be able to bootstrap via .hc files again..?
      Only compiled & tested under Win32.
    • sof's avatar
      [project @ 2001-12-27 11:26:03 by sof] · 14b9c05f
      sof authored
      Added & exported low-level memcpy() wrappers - possible to offset both
      src and dest.
    • sof's avatar
      [project @ 2001-12-27 09:28:10 by sof] · 215280e9
      sof authored
      - removed PrelPosix.c_read, PrelPosix.c_write
      - added Ptr and RawBuffer versions of PrelHandle.write_off,
        and PrelHandle.read_off and exported them, i.e., PrelHandle
        now exports:
          read_off_ba :: FD -> Bool -> RawBuffer -> Int -> CInt -> IO CInt
          read_off :: FD -> Bool -> Ptr CChar -> Int -> CInt -> IO CInt
          write_off_ba :: CInt -> Bool -> RawBuffer -> Int -> CInt -> IO CInt
          write_off :: CInt -> Bool -> Ptr CChar -> Int -> CInt -> IO CInt
      - make hPutChar (win)socket friendly.
  4. 26 Dec, 2001 1 commit
  5. 21 Dec, 2001 6 commits
  6. 20 Dec, 2001 8 commits
    • sewardj's avatar
      [project @ 2001-12-20 17:38:40 by sewardj] · fd37eea4
      sewardj authored
      Move some small inline-in-C functions out of PrelPosix.hsc and into
      the supporting cbits sources, where they belong.
      Following this change, can you now compile the entire Prelude on
      x86-linux with the native code generator, and get something which
      actually works properly.
    • simonpj's avatar
      [project @ 2001-12-20 17:10:00 by simonpj] · f3695b15
      simonpj authored
    • simonpj's avatar
      [project @ 2001-12-20 17:09:46 by simonpj] · e8e3d264
      simonpj authored
    • simonmar's avatar
      [project @ 2001-12-20 16:39:29 by simonmar] · 09355297
      simonmar authored
      Now that we can derive arbitrary classes for newtypes, use this to
      derive all the classes we need for the types in PrelCTypes and
      PrelCTypesISO, instead of the previous hack of explicitly coercing the
      This should improve the quality of code using these types too; the
      coercions were surely getting in the way of optimisations before.
    • sewardj's avatar
      [project @ 2001-12-20 16:12:09 by sewardj] · 791d890c
      sewardj authored
      Outline freeStablePtr, so NCG-generated code actually has something to call :)
      Also remove the presumably-defunct splitStablePtr.
    • sewardj's avatar
      [project @ 2001-12-20 15:20:37 by sewardj] · 0cc54eac
      sewardj authored
      Generate floating-point comparisons on x86 which deal with NaNs in what
      I assume is an IEEE854 compliant fashion.  For
         == >= > <= <
      if either arg is a NaN, produce False, and for
      if either arg is a NaN, produce True.
      This is the behaviour that gcc has, by default.
      Requires some ultramagical x86 code frags to be emitted.  A big comment
      in PprMach explains how it works.
    • sewardj's avatar
      [project @ 2001-12-20 15:16:13 by sewardj] · 5aaf7975
      sewardj authored
    • simonpj's avatar
      [project @ 2001-12-20 11:19:05 by simonpj] · 91c750cb
      simonpj authored
      	More type system extensions (for John Hughes)
      1.  Added a brand-new extension that lets you derive ARBITRARY CLASSES
      for newtypes.  Thus
      	newtype Age = Age Int deriving( Eq, Ord, Shape, Ix )
      The idea is that the dictionary for the user-defined class Shape Age
      is *identical* to that for Shape Int, so there is really no deriving
      work to do.   This saves you writing the very tiresome instance decl:
      	instance Shape Age where
      	   shape_op1 (Age x) = shape_op1 x
      	   shape_op2 (Age x1) (Age x2) = shape_op2 x1 x2
      It's more efficient, too, becuase the Shape Age dictionary really
      will be identical to the Shape Int dictionary.
      There's an exception for Read and Show, because the derived instance
      *isn't* the same.
      There is a complication where higher order stuff is involved.  Here is
      the example John gave:
         class StateMonad s m | m -> s where ...
         newtype Parser tok m a = Parser (State [tok] (Failure m) a)
      			  deriving( Monad, StateMonad )
      Then we want the derived instance decls to be
         instance Monad (State [tok] (Failure m)) => Monad (Parser tok m)
         instance StateMonad [tok] (State [tok] (Failure m))
      	 => StateMonad [tok] (Parser tok m)
      John is writing up manual entry for all of this, but this commit
      implements it.   I think.
      2.  Added -fallow-incoherent-instances, and documented it.  The idea
      is that sometimes GHC is over-protective about not committing to a
      particular instance, and the programmer may want to say "commit anyway".
      Here's the example:
          class Sat a where
            dict :: a
          data EqD a = EqD {eq :: a->a->Bool}
          instance Sat (EqD a) => Eq a where
            (==) = eq dict
          instance Sat (EqD Integer) where
            dict = EqD{eq=(==)}
          instance Eq a => Sat (EqD a) where
            dict = EqD{eq=(==)}
          class Collection c cxt | c -> cxt where
            empty :: Sat (cxt a) => c a
            single :: Sat (cxt a) => a -> c a
            union :: Sat (cxt a) => c a -> c a -> c a
            member :: Sat (cxt a) => a -> c a -> Bool
          instance Collection [] EqD where
            empty = []
            single x = [x]
            union = (++)
            member = elem
      It's an updated attempt to model "Restricted Data Types", if you
      remember my Haskell workshop paper. In the end, though, GHC rejects
      the program (even with fallow-overlapping-instances and
      fallow-undecideable-instances), because there's more than one way to
      construct the Eq instance needed by elem.
      Yet all the ways are equivalent! So GHC is being a bit over-protective
      of me, really: I know what I'm doing and I would LIKE it to pick an
      arbitrary one. Maybe a flag fallow-incoherent-instances would be a
      useful thing to add?
  7. 19 Dec, 2001 3 commits
  8. 18 Dec, 2001 8 commits
  9. 17 Dec, 2001 5 commits
    • sewardj's avatar
      [project @ 2001-12-17 18:03:08 by sewardj] · 9b3d7ebd
      sewardj authored
      Redo translation of array indexing primops in order to insert 8 <-> 32
      bit casts when dealing with Char arrays.  Also facilitate future removal
      of CMem and MO_{Read,Write}OSBI.
      In the process, notice and fix a large bogon in x86/sparc implementation
      of signed and unsigned integer widening.
    • simonmar's avatar
      [project @ 2001-12-17 16:01:44 by simonmar] · 1a3dfff8
      simonmar authored
      comment wibbles
    • simonmar's avatar
      [project @ 2001-12-17 12:33:45 by simonmar] · f871dbb8
      simonmar authored
      Generate better code for case-of-literal (i.e. just do the
      assignment).  These crop up now that the simplifier is a bit more
      careful about duplicating literal strings.
    • simonmar's avatar
      [project @ 2001-12-17 12:32:05 by simonmar] · 0a831b28
      simonmar authored
      mkLocalNonRec bug fix: we always want to generate a case when the rhs
      of a binding is an unlifted type.  Previously the two cases for an
      unlifted rhs and a strict binding were handled together which caused
      some confusion, so now the cases are separate.
    • simonmar's avatar
      [project @ 2001-12-17 10:12:34 by simonmar] · 2088394e
      simonmar authored
      slightly clearer fix for previous bogon, and re-indent the function