1. 14 Apr, 2001 1 commit
    • qrczak's avatar
      [project @ 2001-04-14 22:27:00 by qrczak] · 8bd82b88
      qrczak authored
      Implementation of arrays rewritten
      Bulk operations like listArray, elems, fmap/amap, (==), getElems,
      getAssocs, freeze etc. no longer check whether indices which are
      not provided by the programmer are in bounds (they always are), and
      avoid unnecessary translation between Ix indices and Int indices.
      Some operations are implemented more efficiently, most notably (==)
      and compare.
      This applies to all IArray and MArray instances, including Haskell
      98 Arrays.
      Old methods of IArray and MArray are now functions; this is the only
      change in the interface. New methods are exported only by ArrayBase,
      i.e. not officially exported. They work on Int indices and are unsafe:
      they don't do bounds checks themselves. Public functions do checks
      and index translation instead where necessary.
      More is inlined, to ensure that anything worth specialization or list
      fusion gets specialized and fused. Perhaps a bit too much is inlined.
      If it was possible to say that a function should be instantiated in
      other modules for each type but not inlined on each use, it would be
      useful here.
      Using UArray Int Char wrapped in a nice interface (not included
      here) instead of PackedString should be reasonable. PackedStrings
      are 10% faster than UArray in a sorting test (and don't support
      Unicode). Standard Strings are 50% slower (and take up more memory),
      even though other test versions convert input from standard Strings
      and convert output to them. ByteArrays tuned by hand for the benchmark
      are 15% faster. The same UArray test compiled with released ghc-5.00,
      with compare defined in terms of assocs, is 7 times slower.
  2. 25 Mar, 2001 1 commit
    • qrczak's avatar
      [project @ 2001-03-25 09:57:24 by qrczak] · 9bff24a3
      qrczak authored
      Promote (//) from a function to IArray method with an inefficient
      default definition. This completely compatible change allows efficient
      implementations of (//) for particular types.
      Explicitly define efficient (//) for Array and UArray.
      Use unsafeFreeze* instead of freeze* in (//), accum and accumArray
      for Array and IArray.
      Remove showList in instance Show Array (the default definition does
      the job).
      Add Eq, Ord and Show instances for UArray. (Would be simpler if types
      in instance contexts were not required to be type variables. I didn't
      use -fallow-undecidable-instances but defined instances for individual
      element types separately.)
      Add unsafe{Freeze,Thaw}/{STArray,IOArray,IOUArray} rules.
      Fix thaw/IOUArray rule (nobody uses IOUArrays in the ST monad!).
  3. 31 Aug, 2000 1 commit
  4. 07 Jul, 2000 1 commit
    • simonmar's avatar
      [project @ 2000-07-07 11:03:57 by simonmar] · 6151c960
      simonmar authored
      Rearrange exception stuff, as per my message on glasgow-haskell-users
      The main change is the IOError type is now a synonym for Exception.
      IO.ioError can therefore be used for throwing exceptions.  IO.catch
      still catches only IO exceptions, for backwards compatibility.
      The interface exported by Exception has changed somewhat:
      	try       :: IO a -> IO (Either Exception a)
      	tryJust   :: (Exception -> Maybe b) -> a    -> IO (Either b a)
      	catch     :: IO a -> (Exception -> IO a) -> IO a
      	catchJust :: (Exception -> Maybe b) -> IO a -> (b -> IO a) -> IO a
      	ioErrors		:: Exception -> Maybe IOError
      	arithExceptions 	:: Exception -> Maybe ArithException
      	errorCalls		:: Exception -> Maybe String
      	dynExceptions		:: Exception -> Maybe Dynamic
      	assertions		:: Exception -> Maybe String
      	asyncExceptions 	:: Exception -> Maybe AsyncException
      raiseInThread is now called throwTo.
      Where possible, the old functions have been left around, but marked
  5. 30 Jun, 2000 1 commit
  6. 14 Apr, 2000 1 commit
  7. 10 Apr, 2000 2 commits
    • simonpj's avatar
      [project @ 2000-04-10 16:02:58 by simonpj] · a103a9dc
      simonpj authored
      Make it so that -fcompiling-prelude applies only
      for Prelude modules (i.e. ones called Prelxxx).
      I've done this with an {-# OPTIONS #-} line in each
      such module (they all has -fno-implicit-prelude anyway)
      but a less repetitive approach in the Makefile would
      be welcome.
    • simonpj's avatar
      [project @ 2000-04-10 12:12:27 by simonpj] · 94084171
      simonpj authored
      Make it so that
      (A) All modules imported by Prelude are PrelXXX modules,
          not library modules (notably Ix, Monad were culprits).
          This lines up with the Hugs story, and is more intuitive.
      (B) All things needed implicitly by syntax (e.g. do-notation
          needs Monad) come from PrelXXX modules, even if they aren't
          visible when you say 'import Prelude'.
      These changes simplify the story, and fix the 'looking for [boot]
      interface for Ix' problem.
      This change is not quite complete.  I'm committing it so
      Simon can finish it off.
  8. 14 Mar, 2000 1 commit
    • simonmar's avatar
      [project @ 2000-03-14 12:16:00 by simonmar] · 716d91c2
      simonmar authored
      Simplfy the mutable array story:
      	- rename MutableArray to STArray (and similarly
      	  for all operations on MutableArray, eg newArray
      	  is now newSTArray).
      	- remove the extra level of indirection between
      	  STArrays and MutableArrays.
      	- remove the MutableArray interface from
      	  hslibs/lang/MutableArray.  This module will go
      	  away soon - Andy, don't bother porting it to Hugs.
  9. 20 Dec, 1999 1 commit
    • simonpj's avatar
      [project @ 1999-12-20 10:34:27 by simonpj] · e921b2e3
      simonpj authored
      This commit implements a substantial re-organisation of the Prelude
      It also fixes a couple of small renamer bugs that were reported recently
      	(notably, Sven pointed out that we weren't reporting
      	unused imports properly)
      My original goal was to get rid of all "orphan" modules (i.e. ones
      with instance decls that don't belong either to a tycon or a class
      defined in the same module).  This should reduce the number of
      interface files that have to be read when compiling small Haskell
      But like most expeditions into the Prelude Swamp, it spiraled out
      of control.  The result is quite satisfactory, though.
      	GONE AWAY:	PrelCCall, PrelNumExtra
      	NEW:		PrelReal, PrelFloat, PrelByteArr, PrelNum.hi-boot
      (The extra PrelNum.hi-boot is because of a tiresome thin-air Id, addr2Integer,
      which used to be in PrelBase.)
      Quite a lot of types have moved from one module to another,
      which entails some changes to part of the compiler (PrelInfo, PrelMods) etc,
      and there are a few places in the RTS includes and even in the driver
      that know about these home modules (alas).
      So the rough structure is as follows, in (linearised) dependency order
      	[this list now appears in PrelBase.lhs]
      PrelGHC		Has no implementation.  It defines built-in things, and
      		by importing it you bring them into scope.
      		The source file is PrelGHC.hi-boot, which is just
      		copied to make PrelGHC.hi
      		Classes: CCallable, CReturnable
      PrelBase	Classes: Eq, Ord, Functor, Monad
      		Types:   list, (), Int, Bool, Ordering, Char, String
      PrelTup		Types: tuples, plus instances for PrelBase classes
      PrelShow	Class: Show, plus instances for PrelBase/PrelTup types
      PrelEnum	Class: Enum,  plus instances for PrelBase/PrelTup types
      PrelMaybe	Type: Maybe, plus instances for PrelBase classes
      PrelNum		Class: Num, plus instances for Int
      		Type:  Integer, plus instances for all classes so far (Eq, Ord, Num, Show)
      		Integer is needed here because it is mentioned in the signature
      		of 'fromInteger' in class Num
      PrelReal	Classes: Real, Integral, Fractional, RealFrac
      			 plus instances for Int, Integer
      		Types:  Ratio, Rational
      			plus intances for classes so far
      		Rational is needed here because it is mentioned in the signature
      		of 'toRational' in class Real
      Ix		Classes: Ix, plus instances for Int, Bool, Char, Integer, Ordering, tuples
      PrelArr		Types: Array, MutableArray, MutableVar
      		Does *not* contain any ByteArray stuff (see PrelByteArr)
      		Arrays are used by a function in PrelFloat
      PrelFloat	Classes: Floating, RealFloat
      		Types:   Float, Double, plus instances of all classes so far
      		This module contains everything to do with floating point.
      		It is a big module (900 lines)
      		With a bit of luck, many modules can be compiled without ever reading PrelFloat.hi
      PrelByteArr	Types: ByteArray, MutableByteArray
      		We want this one to be after PrelFloat, because it defines arrays
      		of unboxed floats.
      Other Prelude modules are much easier with fewer complex dependencies.
  10. 22 Nov, 1999 1 commit
    • simonmar's avatar
      [project @ 1999-11-22 15:55:49 by simonmar] · d3aa7046
      simonmar authored
      Reduce the number of orphan-instance modules.  There are a few left,
      but these can't be removed without significant reorganisation due to
      recursive dependencies.
  11. 11 Nov, 1999 2 commits
  12. 05 Oct, 1999 1 commit
    • simonmar's avatar
      [project @ 1999-10-05 09:02:30 by simonmar] · 34df3534
      simonmar authored
      Flatten out the tuple of bounds in the Array, MutableArray and
      ByteArray datatypes.  This improves performance of heavy array
      manipulations quite significantly.
  13. 06 Jul, 1999 1 commit
    • simonpj's avatar
      [project @ 1999-07-06 16:45:31 by simonpj] · 9d38678e
      simonpj authored
      All Simon's recent tuning changes.  Rough summary follows:
      * Fix Kevin Atkinson's cant-find-instance bug.  Turns out that Rename.slurpSourceRefs
        needs to repeatedly call getImportedInstDecls, and then go back to slurping
        source-refs.  Comments with Rename.slurpSourceRefs.
      * Add a case to Simplify.mkDupableAlt for the quite-common case where there's
        a very simple alternative, in which case there's no point in creating a
        join-point binding.
      * Fix CoreUtils.exprOkForSpeculation so that it returns True of (==# a# b#).
        This lack meant that
      	case ==# a# b# of { True -> x; False -> x }
        was not simplifying
      * Make float-out dump bindings at the top of a function argument, as
        at the top of a let(rec) rhs.  See notes with FloatOut.floatRhs
      * Make the ArgOf case of mkDupableAlt generate a OneShot lambda.
        This gave a noticeable boost to spectral/boyer2
      * Reduce the number of coerces, using worker/wrapper stuff.
        The main idea is in WwLib.mkWWcoerce.  The gloss is that we must do
        the w/w split even for small non-recursive things.  See notes with
      * This further complicated getWorkerId, so I finally bit the bullet and
        make the workerInfo field of the IdInfo work properly, including
        under substitutions.  Death to getWorkerId.  Kevin Glynn will be happy.
      * Make all lambdas over realWorldStatePrimTy
        into one-shot lambdas.  This is a GROSS HACK.
      * Also make the occurrence analyser aware of one-shot lambdas.
      * Make various Prelude things into INLINE, so that foldr doesn't
        get inlined in their body, so that the caller gets the benefit
        of fusion.  Notably in PrelArr.lhs.
  14. 18 May, 1999 1 commit
  15. 27 Apr, 1999 1 commit
  16. 05 Mar, 1999 1 commit
    • sof's avatar
      [project @ 1999-03-05 10:21:22 by sof] · 9b910bc8
      sof authored
      Support for unsafely thawing your (Byte)Arrays, i.e., added the
      following ops:
       MutableArray.unsafeThawArray :: Ix ix => Array ix elt -> ST s (MutableArray s ix elt)
       MutableArray.unsafeThawByteArray :: Ix ix => ByteArray ix -> ST s (MutableByteArray s ix)
       MutableArray.thawByteArray :: Ix ix => ByteArray ix -> ST s (MutableByteArray s ix)
       ST.unsafeThawSTArray 	    :: Ix ix => Array ix elt -> ST s (STArray s ix elt)
       LazyST.unsafeThawSTArray   :: Ix ix => Array ix elt -> ST s (STArray s ix elt)
       IOExts.unsafeFreezeIOArray :: Ix ix => IOArray ix elt -> IO (Array ix elt)
       IOExts.unsafeThawIOArray   :: Ix ix => Array ix elt -> IO (IOArray ix elt)
      + removed the re-exportation of Monad that ST and LazyST did.
  17. 02 Feb, 1999 1 commit
  18. 01 Feb, 1999 1 commit
  19. 28 Jan, 1999 1 commit
  20. 14 Jan, 1999 1 commit
    • sof's avatar
      [project @ 1999-01-14 18:12:47 by sof] · 0d65c162
      sof authored
      Changes to make the Prelude comply with Haskell 98.
      I claim that this completes GHC's implementation of Haskell 98 (at
      least feature-wise, but there's bound to be some bugs lurking..)
  21. 02 Dec, 1998 1 commit
  22. 29 Jun, 1998 1 commit
  23. 29 May, 1998 1 commit
  24. 22 May, 1998 1 commit
    • simonm's avatar
      [project @ 1998-05-22 15:57:05 by simonm] · 6bfd2f54
      simonm authored
      - Add NOINLINE pragmas to the unsafe things (unsafe*IO, unsafe*ST, runST etc.)
      - Move unsafe function back into the proper modules
      - Remove PrelUnsafe*.lhs
  25. 02 Feb, 1998 1 commit
    • simonm's avatar
      [project @ 1998-02-02 17:27:26 by simonm] · 28139aea
      simonm authored
      Library re-organisation:
      All libraries now live under ghc/lib, which has the following structure:
      	ghc/lib/std    		--  all prelude files 		(libHS.a)
      	ghc/lib/exts		-- standard Hugs/GHC extensions (libHSexts.a)
      				-- available with '-fglasgow-exts'
      	ghc/lib/posix		-- POSIX library                (libHSposix.a)
      	ghc/lib/posix/cbits     -- available with '-syslib posix'
      	ghc/lib/misc		-- used to be hslibs/ghc	(libHSmisc.a)
      	ghc/lib/misc/cbits	-- available with '-syslib misc'
      	ghc/lib/concurrent	-- Concurrent libraries		(libHSconc.a)
      				-- available with '-concurrent'
      Also, several non-standard prelude modules had their names changed to begin
      with 'Prel' to reduce namespace pollution.
      	Addr      ==> PrelAddr     (Addr interface available in 'exts')
      	ArrBase   ==> PrelArr
      	CCall     ==> PrelCCall    (CCall interface available in 'exts')
      	ConcBase  ==> PrelConc
      	GHCerr    ==> PrelErr
      	Foreign   ==> PrelForeign  (Foreign interface available in 'exts')
      	GHC       ==> PrelGHC
      	IOHandle  ==> PrelHandle
      	IOBase    ==> PrelIOBase
      	GHCmain   ==> PrelMain
      	STBase    ==> PrelST
      	Unsafe    ==> PrelUnsafe
      	UnsafeST  ==> PrelUnsafeST
  26. 22 Jan, 1998 1 commit
    • sof's avatar
      [project @ 1998-01-22 15:54:43 by sof] · 552de7b4
      sof authored
      * removed ghc/Error.{lhs,hi-boot}
      * moved contents of Error to GHCerr + adjusted
        import lists of files that use old Error functionality.
      * moved seqError from Prelude to GHCerr.
  27. 04 Dec, 1997 2 commits
  28. 11 Nov, 1997 1 commit
    • simonm's avatar
      [project @ 1997-11-11 14:32:34 by simonm] · a138ab7b
      simonm authored
      Library changes to:
      	* remove PrimIO
      	* change type of _ccall_ to IO
      	* incorporate Alastair Reid's new library interfaces for
      	  compatibility with Hugs.
  29. 13 Oct, 1997 1 commit
    • simonm's avatar
      [project @ 1997-10-13 16:12:54 by simonm] · df10403c
      simonm authored
      Changes to unbox the state in the ST and IO monads.
      ST now has type
      	newtype ST s a = ST (State# s -> STret s a)
      	data STret s a = STret (State# s) a
      IO now has type
      	newtype IO a = IO (State# RealWorld -> IOResult a)
      	data IOResult a = IOok   (State# RealWorld) a
      	                | IOfail (State# RealWorld) IOError
      So ST should be slightly more efficient, and IO should be nearly as
      efficient as ST.
  30. 25 Sep, 1997 1 commit
  31. 04 Sep, 1997 1 commit
  32. 03 Sep, 1997 1 commit
  33. 18 May, 1997 1 commit
  34. 14 Mar, 1997 1 commit
  35. 07 Jan, 1997 1 commit
  36. 06 Jan, 1997 1 commit
  37. 19 Dec, 1996 1 commit