summaryrefslogtreecommitdiff
path: root/ghc/lib/std/Array.lhs
Commit message (Collapse)AuthorAgeFilesLines
* [project @ 2002-02-12 15:17:13 by simonmar]simonmar2002-02-121-148/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Switch over to the new hierarchical libraries --------------------------------------------- This commit reorganises our libraries to use the new hierarchical module namespace extension. The basic story is this: - fptools/libraries contains the new hierarchical libraries. Everything in here is "clean", i.e. most deprecated stuff has been removed. - fptools/libraries/base is the new base package (replacing "std") and contains roughly what was previously in std, lang, and concurrent, minus deprecated stuff. Things that are *not allowed* in libraries/base include: Addr, ForeignObj, ByteArray, MutableByteArray, _casm_, _ccall_, ``'', PrimIO For ByteArrays and MutableByteArrays we use UArray and STUArray/IOUArray respectively now. Modules previously called PrelFoo are now under fptools/libraries/GHC. eg. PrelBase is now GHC.Base. - fptools/libraries/haskell98 provides the Haskell 98 std. libraries (Char, IO, Numeric etc.) as a package. This package is enabled by default. - fptools/libraries/network is a rearranged version of the existing net package (the old package net is still available; see below). - Other packages will migrate to fptools/libraries in due course. NB. you need to checkout fptools/libraries as well as fptools/hslibs now. The nightly build scripts will need to be tweaked. - fptools/hslibs still contains (almost) the same stuff as before. Where libraries have moved into the new hierarchy, the hslibs version contains a "stub" that just re-exports the new version. The idea is that code will gradually migrate from fptools/hslibs into fptools/libraries as it gets cleaned up, and in a version or two we can remove the old packages altogether. - I've taken the opportunity to make some changes to the build system, ripping out the old hslibs Makefile stuff from mk/target.mk; the new package building Makefile code is in mk/package.mk (auto-included from mk/target.mk). The main improvement is that packages now register themselves at make boot time using ghc-pkg, and the monolithic package.conf in ghc/driver is gone. I've updated the standard packages but haven't tested win32, graphics, xlib, object-io, or OpenGL yet. The Makefiles in these packages may need some further tweaks, and they'll need pkg.conf.in files added. - Unfortunately all this rearrangement meant I had to bump the interface-file version and create a bunch of .hi-boot-6 files :-(
* [project @ 2001-04-14 22:27:00 by qrczak]qrczak2001-04-141-37/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* [project @ 2000-11-08 15:54:05 by simonpj]simonpj2000-11-081-7/+17
| | | | Move fixity decl inside ifdef Hugs
* [project @ 2000-08-29 16:36:23 by simonpj]simonpj2000-08-291-2/+1
| | | | Remove redundant imports
* [project @ 2000-06-30 13:39:35 by simonmar]simonmar2000-06-301-2/+3
| | | | | | - fix copyrights - remove some unused imports - comment formatting fixes
* [project @ 2000-04-06 00:04:01 by andy]andy2000-04-061-1/+1
| | | | Changing PrimPrel to PrelPrim
* [project @ 2000-04-04 02:20:30 by andy]andy2000-04-041-9/+8
| | | | Using the new Prelude structure to handle prims.
* [project @ 2000-03-30 09:04:34 by andy]andy2000-03-301-0/+1
| | | | Wibble One.
* [project @ 2000-03-09 21:16:49 by andy]andy2000-03-091-1/+0
| | | | Wibble: rm needless import Prelude used by Hugs.
* [project @ 2000-03-09 06:14:38 by andy]andy2000-03-091-1/+10
| | | | | | | | | | | | | | | improving the synatax and semantics of the privileged import Typical use might be: import Prelude import privileged Prelude ( IORef , unsafePerformIO ) Which means please ignore the export that comes with Prelude, and let me at compiler internal magic operations, IORef and unsafePerformIO (both are later exported by IOExt) I've also updated the stdlib files to use this (hugs only :-).
* [project @ 1999-12-20 10:34:27 by simonpj]simonpj1999-12-201-47/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 modules. 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.
* [project @ 1999-10-29 01:16:48 by andy]andy1999-10-291-0/+80
| | | | | | | Adding in the modified versions of the Standard Haskell 98 libraries. These should compile under both Hugs and GHC. use the flags -D__HUGS__ -DUSE_REPORT_PRELUDE to extract the Hugs src.
* [project @ 1999-05-18 14:59:04 by simonpj]simonpj1999-05-181-0/+1
| | | | ../compiler/msg_prel
* [project @ 1999-01-14 18:12:47 by sof]sof1999-01-141-11/+33
| | | | | | | 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..)
* [project @ 1998-12-02 13:17:09 by simonm]simonm1998-12-021-1/+3
| | | | Move 4.01 onto the main trunk.
* [project @ 1998-05-29 12:29:02 by simonm]simonm1998-05-291-5/+5
| | | | Replace more GENERATE_SPECs with explicit SPECIALISE.
* [project @ 1998-02-02 17:27:26 by simonm]simonm1998-02-021-0/+99
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/std/cbits 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