summaryrefslogtreecommitdiff
path: root/ghc/lib/std/PrelNum.lhs
Commit message (Collapse)AuthorAgeFilesLines
* [project @ 2002-02-12 15:17:13 by simonmar]simonmar2002-02-121-461/+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 @ 2002-01-29 09:58:14 by simonpj]simonpj2002-01-291-16/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ------------ Rule phasing ------------ This commit adds a little more control to when rules are enabled. {-# RULES "foo" [2] forall ... "baz" [~2] forall ... #-} Rule "foo" is active in phase 2 and later. The new thing is that the "~2" means that Rule "baz" is active in phase 3 and earlier. (Remember tha phases decrease towards zero.) All the machinery was there to implement this, it just needed the syntax. Why do this? Peter Gammie (at UNSW) found that rules weren't firing because of bindings of the form M.f = f f = .... where the rules where on the M.f binding. It turned out that an old hack (which have for some time elicited the harmless "shortMeOut" debug warnings) prevented this trivial construction from being correctly simplified. The hack in turn derived from a trick in the way the foldr/build rule was implemented....and that hack is no longer necessary now we can switch rules *off* as well as *on*. There are consequential changes in the Prelude foldr/build RULE stuff. It's a clean-up.... Instead of strange definitions like map = mapList which we had before, we have an ordinary recursive defn of map, together with rules to convert first to foldr/build form, and then (if nothing happens) back again. There's a fairly long comment about the general plan of attack in PrelBase, near the defn of map.
* [project @ 2001-12-18 15:23:15 by sewardj]sewardj2001-12-181-3/+4
| | | | Fix various bugs in the implementation of subIntC and mulMayOflo.
* [project @ 2001-12-14 15:26:14 by sewardj]sewardj2001-12-141-4/+3
| | | | | | | | | | | | | | | | | | | | | | Get rid of multiple-result MachOps (MO_NatS_AddC, MO_NatS_SubC, MO_NatS_MulC) which implement {add,sub,mul}IntC#. Supporting gunk in the NCG disappears as a result. Instead: * {add,sub}IntC# are translated out during abstract C simplification, turning into the xor-xor-invert-and-shift sequence previously defined in PrimOps.h. * mulIntC# is more difficult to get rid of portably. Instead we have a new single-result PrimOp, mulIntMayOflo, with corresponding MachOp MO_NatS_MulMayOflo. This tells you whether a W x W -> W signed multiply might overflow, where W is the word size. When W=32, is implemented by computing a 2W-long result. When W=64, we use the previous approximation. PrelNum.lhs' implementation of timesInteger changes slightly, to use the new PrimOp.
* [project @ 2001-12-13 10:48:29 by simonpj]simonpj2001-12-131-2/+5
| | | | Swap order of test; see comments in code
* [project @ 2001-10-31 16:38:55 by rrt]rrt2001-10-311-1/+7
| | | | Beginnings of .NET Integer support.
* [project @ 2001-10-03 13:57:42 by simonmar]simonmar2001-10-031-4/+4
| | | | | | | | | | | | | | | | Tidy up ghc/includes/Constants and related things. Now all the constants that the compiler needs to know, such as header size, update frame size, info table size and so on are generated automatically into a header file, DeriviedConstants.h, by a small C program in the same way as NativeDefs.h. The C code in the RTS is expected to use sizeof() directly (it already does). Also tidied up the constants in MachDeps.h - all the constants representing the sizes of various types are named SIZEOF_<foo>, to match the constants defined in config.h. PrelStorable.lhs now doesn't contain any special knowledge about GHC's conventions as regards the size of certain types, this is all in MachDeps.h.
* [project @ 2001-07-24 06:31:35 by ken]ken2001-07-241-10/+19
| | | | Innocent changes to resurrect/add 64-bit support.
* [project @ 2001-04-14 22:28:22 by qrczak]qrczak2001-04-141-6/+6
| | | | Cosmetics.
* [project @ 2001-03-29 13:55:01 by simonmar]simonmar2001-03-291-3/+3
| | | | | fix special cases for remInteger and divExact, to match new semantics for integer2word#.
* [project @ 2001-02-28 00:01:01 by qrczak]qrczak2001-02-281-37/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add {intToInt,wordToWord}{8,16,32}# primops. WARNING: Not implemented in ncg for Alpha and Sparc. But -O -fasm is not going to go far anyway because of other omissions. * Have full repertoire of 8,16,32-bit signed and unsigned MachMisc.Size values. Again only x86 is fully supported. They are used for {index,read,write}{Int,Word}{8,16,32}{OffAddr,Array}# and {intToInt,wordToWord}{8,16,32}# primops. * Have full repertoire of {index,read,write}\ {Char,WideChar,Int,Word,Addr,Float,Double,StablePtr,\ {Int,Word}{8,16,32,64}}\ {OffAddr,Array} primops and appropriate instances. There were various omissions in various places. * Add {plus,minus,times}Word# primops to avoid so many Word# <-> Int# coercions. * Rewrite modules PrelWord and PrelInt almost from scratch. * Simplify fromInteger and realToFrac rules. For each of {Int,Word}{8,16,32} there is just a pair of fromInteger rules replacing the source or target type with Int or Word. For {Int,Word,Int64,Word64} there are rules from any to any. Don't include rules which are derivable from inlining anyway, e.g. those mentioning Integer. Old explicit coercions are simply defined as appropriately typed fromInteger. * Various old coercion functions marked as deprecated. * Add instance Bits Int, and instance {Show,Num,Real,Enum,Integral,Bounded,Ix,Read,Bits} Word. * Coercions to sized integer types consistently behave as cutting the right amount of bits from the infinite two-complement representation. For example (fromIntegral (-1 :: Int8) :: Word64) == maxBound. * ghc/tests/numeric/should_run/arith011 tests {Int,Word}64 and instance Bits Int, and does not try to use overflowing toEnum. arith011.stdout is not updated yet because of a problem I will tell about soon. * Move fromInteger and realToFrac from Prelude to PrelReal. Move fromInt from PrelNum to PrelReal and define as fromInteger. Define toInt as fromInteger. fromInteger is the place to write integer conversion rules for. * Remove ArrayBase.newInitialisedArray, use default definition of newArray instead. * Bugs fixed: - {quot,rem}Word# primop attributes. - integerToInt64# for small negative values. - {min,max}Bound::Int on 64-bit platforms. - iShiftRL64#. - Various Bits instances. * Polishing: - Use 'ppr' instead of 'pprPrimOp' and 'text . showPrimRep'. - PrimRep.{primRepString,showPrimRepToUser} removed. - MachMisc.sizeOf returns Int instead of Integer. - Some eta reduction, parens, spacing, and reordering cleanups - sorry, couldn't resist. * Questions: - Should iShiftRL and iShiftRL64 be removed? IMHO they should, s/iShiftRA/iShiftR/, s/shiftRL/shiftR/. The behaviour on shifting is a property of the signedness of the type, not the operation! I haven't done this change.
* [project @ 2001-02-22 16:48:24 by qrczak]qrczak2001-02-221-3/+3
| | | | Since fromInt was degraded to a function, do the same with toInt.
* [project @ 2001-02-22 13:17:57 by simonpj]simonpj2001-02-221-7/+5
| | | | | | | | | | | | | | fromInt Remove fromInt from class Num, though it is retained as an overloaded operation (with unchanged type) in PrelNum. There are quite a few consequential changes in the Prelude. I hope I got them all correct! Also fix a bug that meant Integer (and its instances) wasn't getting slurped in by the renamer, even though it was needed for defaulting.
* [project @ 2000-09-26 16:45:33 by simonpj]simonpj2000-09-261-5/+1
| | | | | | | | | | | | * Remove all traces of addr2Integer. Big integer literals are now done by multiplying up small integers. * As a result, we can remove PrelNum.hi-boot altogether. * Correct the default method for (==) in PrelBase. (It simply returned True, which seems bogus to me!) * Add a type signature for PrelBase.mapFB
* [project @ 2000-09-25 12:58:39 by simonpj]simonpj2000-09-251-35/+31
| | | | | | | | | | | | -------------------------------------------------- Tidying up HsLit, and making it possible to define your own numeric library Simon PJ 22 Sept 00 -------------------------------------------------- I forgot to commit changes to the libraries! The main thing is to define monomorphic plusInteger, timesInteger etc, in PrelNum.
* [project @ 2000-06-30 13:39:35 by simonmar]simonmar2000-06-301-1/+3
| | | | | | - fix copyrights - remove some unused imports - comment formatting fixes
* [project @ 2000-06-04 18:27:45 by panne]panne2000-06-041-7/+9
| | | | | | | The GCD saga continues: Fixed gcdInt/gcdInteger to work correctly for non-positive values, i.e. call mpn_gcd_1 only with positive inputs, and issue an error if both operands are zero. This should fix the bug reported by Marc.
* [project @ 2000-04-14 15:28:24 by rrt]rrt2000-04-141-1/+1
| | | | Removed -fcompiling-prelude flag (now removed from compiler)
* [project @ 2000-04-10 16:02:58 by simonpj]simonpj2000-04-101-1/+1
| | | | | | | | | | 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.
* [project @ 2000-03-23 17:45:17 by simonpj]simonpj2000-03-231-8/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This utterly gigantic commit is what I've been up to in background mode in the last couple of months. Originally the main goal was to get rid of Con (staturated constant applications) in the CoreExpr type, but one thing led to another, and I kept postponing actually committing. Sorry. Simon, 23 March 2000 I've tested it pretty thoroughly, but doubtless things will break. Here are the highlights * Con is gone; the CoreExpr type is simpler * NoRepLits have gone * Better usage info in interface files => less recompilation * Result type signatures work * CCall primop is tidied up * Constant folding now done by Rules * Lots of hackery in the simplifier * Improvements in CPR and strictness analysis Many bug fixes including * Sergey's DoCon compiles OK; no loop in the strictness analyser * Volker Wysk's programs don't crash the CPR analyser I have not done much on measuring compilation times and binary sizes; they could have got worse. I think performance has got significantly better, though, in most cases. Removing the Con form of Core expressions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The big thing is that For every constructor C there are now *two* Ids: C is the constructor's *wrapper*. It evaluates and unboxes arguments before calling $wC. It has a perfectly ordinary top-level defn in the module defining the data type. $wC is the constructor's *worker*. It is like a primop that simply allocates and builds the constructor value. Its arguments are the actual representation arguments of the constructor. Its type may be different to C, because: - useless dict args are dropped - strict args may be flattened For every primop P there is *one* Id, its (curried) Id Neither contructor worker Id nor the primop Id have a defminition anywhere. Instead they are saturated during the core-to-STG pass, and the code generator generates code for them directly. The STG language still has saturated primops and constructor applications. * The Const type disappears, along with Const.lhs. The literal part of Const.lhs reappears as Literal.lhs. Much tidying up in here, to bring all the range checking into this one module. * I got rid of NoRep literals entirely. They just seem to be too much trouble. * Because Con's don't exist any more, the funny C { args } syntax disappears from inteface files. Parsing ~~~~~~~ * Result type signatures now work f :: Int -> Int = \x -> x -- The Int->Int is the type of f g x y :: Int = x+y -- The Int is the type of the result of (g x y) Recompilation checking and make ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * The .hi file for a modules is not touched if it doesn't change. (It used to be touched regardless, forcing a chain of recompilations.) The penalty for this is that we record exported things just as if they were mentioned in the body of the module. And the penalty for that is that we may recompile a module when the only things that have changed are the things it is passing on without using. But it seems like a good trade. * -recomp is on by default Foreign declarations ~~~~~~~~~~~~~~~~~~~~ * If you say foreign export zoo :: Int -> IO Int then you get a C produre called 'zoo', not 'zzoo' as before. I've also added a check that complains if you export (or import) a C procedure whose name isn't legal C. Code generation and labels ~~~~~~~~~~~~~~~~~~~~~~~~~~ * Now that constructor workers and wrappers have distinct names, there's no need to have a Foo_static_closure and a Foo_closure for constructor Foo. I nuked the entire StaticClosure story. This has effects in some of the RTS headers (i.e. s/static_closure/closure/g) Rules, constant folding ~~~~~~~~~~~~~~~~~~~~~~~ * Constant folding becomes just another rewrite rule, attached to the Id for the PrimOp. To achieve this, there's a new form of Rule, a BuiltinRule (see CoreSyn.lhs). The prelude rules are in prelude/PrelRules.lhs, while simplCore/ConFold.lhs has gone. * Appending of constant strings now works, using fold/build fusion, plus the rewrite rule unpack "foo" c (unpack "baz" c n) = unpack "foobaz" c n Implemented in PrelRules.lhs * The CCall primop is tidied up quite a bit. There is now a data type CCall, defined in PrimOp, that packages up the info needed for a particular CCall. There is a new Id for each new ccall, with an big "occurrence name" {__ccall "foo" gc Int# -> Int#} In interface files, this is parsed as a single Id, which is what it is, really. Miscellaneous ~~~~~~~~~~~~~ * There were numerous places where the host compiler's minInt/maxInt was being used as the target machine's minInt/maxInt. I nuked all of these; everything is localised to inIntRange and inWordRange, in Literal.lhs * Desugaring record updates was broken: it didn't generate correct matches when used withe records with fancy unboxing etc. It now uses matchWrapper. * Significant tidying up in codeGen/SMRep.lhs * Add __word, __word64, __int64 terminals to signal the obvious types in interface files. Add the ability to print word values in hex into C code. * PrimOp.lhs is no longer part of a loop. Remove PrimOp.hi-boot* Types ~~~~~ * isProductTyCon no longer returns False for recursive products, nor for unboxed products; you have to test for these separately. There's no reason not to do CPR for recursive product types, for example. Ditto splitProductType_maybe. Simplification ~~~~~~~~~~~~~~~ * New -fno-case-of-case flag for the simplifier. We use this in the first run of the simplifier, where it helps to stop messing up expressions that the (subsequent) full laziness pass would otherwise find float out. It's much more effective than previous half-baked hacks in inlining. Actually, it turned out that there were three places in Simplify.lhs that needed to know use this flag. * Make the float-in pass push duplicatable bindings into the branches of a case expression, in the hope that we never have to allocate them. (see FloatIn.sepBindsByDropPoint) * Arrange that top-level bottoming Ids get a NOINLINE pragma This reduced gratuitous inlining of error messages. But arrange that such things still get w/w'd. * Arrange that a strict argument position is regarded as an 'interesting' context, so that if we see foldr k z (g x) then we'll be inclined to inline g; this can expose a build. * There was a missing case in CoreUtils.exprEtaExpandArity that meant we were missing some obvious cases for eta expansion Also improve the code when handling applications. * Make record selectors (identifiable by their IdFlavour) into "cheap" operations. [The change is a 2-liner in CoreUtils.exprIsCheap] This means that record selection may be inlined into function bodies, which greatly improves the arities of overloaded functions. * Make a cleaner job of inlining "lone variables". There was some distributed cunning, but I've centralised it all now in SimplUtils.analyseCont, which analyses the context of a call to decide whether it is "interesting". * Don't specialise very small functions in Specialise.specDefn It's better to inline it. Rather like the worker/wrapper case. * Be just a little more aggressive when floating out of let rhss. See comments with Simplify.wantToExpose A small change with an occasional big effect. * Make the inline-size computation think that case x of I# x -> ... is *free*. CPR analysis ~~~~~~~~~~~~ * Fix what was essentially a bug in CPR analysis. Consider letrec f x = let g y = let ... in f e1 in if ... then (a,b) else g x g has the CPR property if f does; so when generating the final annotated RHS for f, we must use an envt in which f is bound to its final abstract value. This wasn't happening. Instead, f was given the CPR tag but g wasn't; but of course the w/w pass gives rotten results in that case!! (Because f's CPR-ness relied on g's.) On they way I tidied up the code in CprAnalyse. It's quite a bit shorter. The fact that some data constructors return a constructed product shows up in their CPR info (MkId.mkDataConId) not in CprAnalyse.lhs Strictness analysis and worker/wrapper ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * BIG THING: pass in the demand to StrictAnal.saExpr. This affects situations like f (let x = e1 in (x,x)) where f turns out to have strictness u(SS), say. In this case we can mark x as demanded, and use a case expression for it. The situation before is that we didn't "know" that there is the u(SS) demand on the argument, so we simply computed that the body of the let expression is lazy in x, and marked x as lazily-demanded. Then even after f was w/w'd we got let x = e1 in case (x,x) of (a,b) -> $wf a b and hence let x = e1 in $wf a b I found a much more complicated situation in spectral/sphere/Main.shade, which improved quite a bit with this change. * Moved the StrictnessInfo type from IdInfo to Demand. It's the logical place for it, and helps avoid module loops * Do worker/wrapper for coerces even if the arity is zero. Thus: stdout = coerce Handle (..blurg..) ==> wibble = (...blurg...) stdout = coerce Handle wibble This is good because I found places where we were saying case coerce t stdout of { MVar a -> ... case coerce t stdout of { MVar b -> ... and the redundant case wasn't getting eliminated because of the coerce.
* [project @ 2000-03-23 09:32:13 by simonmar]simonmar2000-03-231-0/+7
| | | | | Disable some of the special cases in remInteger and quotInteger, which turned out to be wrong.
* [project @ 2000-02-29 12:08:55 by simonmar]simonmar2000-02-291-18/+15
| | | | | | Fix boundary cases for quotInteger, remInteger & a few others. These changes somehow escaped 4.06 and have been sitting in my tree for a while.
* [project @ 2000-01-19 17:06:25 by simonmar]simonmar2000-01-191-14/+20
| | | | | | | | | The minInt saga continues: - fix several Integer division-type functions for the case when the dividend == S# (-2147483648#). Pointed out by: Marc Van Dongen <dongen@cs.ucc.ie>
* [project @ 1999-12-20 10:34:27 by simonpj]simonpj1999-12-201-351/+239
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-12-13 17:25:57 by simonmar]simonmar1999-12-131-4/+2
| | | | Fix bug in abs::Integer->Integer: result was wrong for minBound::Int.
* [project @ 1999-12-08 14:21:52 by simonmar]simonmar1999-12-081-22/+97
| | | | | | | | | | | | | | | | Add Marc Van Dongen's Integer improvements. Specifically: - new primops: gcdInt#, gcdIntegerInt#, divExact#, quotInteger#, remInteger#. - new definitions of quot and rem for Integer in PrelNum (using the new quotInteger# and remInteger# primops instead of quotRemInteger#). Should be slightly faster than before. div & mod aren't likewise optimised (yet). - specialisations of gcd for Int and Integer, and lcm for Integer in PrelNum.
* [project @ 1999-11-22 15:55:49 by simonmar]simonmar1999-11-221-43/+7
| | | | | | 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.
* [project @ 1999-11-11 15:17:59 by simonmar]simonmar1999-11-111-3/+8
| | | | | Integer divMod now uses the native GMP method. The PrimOp was already there, it just wasn't being used.
* [project @ 1999-07-06 16:45:31 by simonpj]simonpj1999-07-061-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 WorkWrap.tryWw. * 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.
* [project @ 1999-05-28 19:19:20 by simonpj]simonpj1999-05-281-10/+49
| | | | Make the Enum Integer instance deforestable
* [project @ 1999-05-18 14:59:04 by simonpj]simonpj1999-05-181-23/+45
| | | | ../compiler/msg_prel
* [project @ 1999-02-19 10:48:58 by simonm]simonm1999-02-191-0/+1
| | | | Fix negate (toInteger (minBound :: Int)).
* [project @ 1999-02-17 15:57:20 by simonm]simonm1999-02-171-50/+96
| | | | | | | | | | | | | | | | | | Fast Integers. The rep. of Integers is now data Integer = S# Int# | J# Int# ByteArray# - several new primops added for overflow-detecting arithmetic - negateInteger# removed; it can be done directly - integer_0, integer_1 etc. removed. - the compiler now uses S# where it previously used int2Integer. - the compiler generates small integers for -2^32 .. 2^32-1, instead of -2^29 .. -2^29-1. - PrelST.State datatype moved to LazyST (its only use). - some library code (in Time.lhs) still needs cleaning up, it depends on the Integer rep.
* [project @ 1999-02-01 10:02:15 by sof]sof1999-02-011-1/+1
| | | | H98 Prelude tweaks
* [project @ 1999-01-23 17:43:21 by sof]sof1999-01-231-1/+4
| | | | | | Changed the various Ix.range methods, to specifically check whether we're dealing with an empty range or not. As it was, empty array weren't handled properly.
* [project @ 1999-01-21 20:15:30 by sof]sof1999-01-211-8/+12
| | | | | | | | | | | | Enum instances updated to comply with the behaviour that Haskell 98 specifies. Notable changes, * [a..b] is not the empty list when a>b any longer. * [x..] and [x,y..] for Enum Int are now bounded lists. The first change is might be worth bearing in mind when converting 1.4 code to Haskell 98; functions may have made use of the old behaviour.
* [project @ 1999-01-19 11:44:07 by sof]sof1999-01-191-1/+1
| | | | The Fight against needless use of (++) continues.
* [project @ 1999-01-14 18:12:47 by sof]sof1999-01-141-54/+71
| | | | | | | 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-1024/+88
| | | | Move 4.01 onto the main trunk.
* [project @ 1998-10-21 11:37:03 by sof]sof1998-10-211-3/+0
| | | | Removed commented-out Haskell-1.2 methods
* [project @ 1998-09-30 08:58:25 by sof]sof1998-09-301-45/+70
| | | | tweaked Integral.Int.div to cope with overflows
* [project @ 1998-08-27 14:35:55 by sof]sof1998-08-271-12/+7
| | | | floatToDigits bugfix
* [project @ 1998-07-02 08:45:50 by simonm]simonm1998-07-021-3/+41
| | | | | Add specialise pragmas (which don't work at the moment, due to an unidentified bug in the specialiser/simplifier).
* [project @ 1998-05-22 15:57:05 by simonm]simonm1998-05-221-1/+1
| | | | | | - Add NOINLINE pragmas to the unsafe things (unsafe*IO, unsafe*ST, runST etc.) - Move unsafe function back into the proper modules - Remove PrelUnsafe*.lhs
* [project @ 1998-05-06 12:15:10 by simonm]simonm1998-05-061-1/+3
| | | | - one `quotRem` is faster than separate `quot` and `rem` on Integers.
* [project @ 1998-03-11 16:54:13 by sof]sof1998-03-111-1/+1
| | | | jtos: leave Integer-land ASAP
* [project @ 1998-02-02 17:27:26 by simonm]simonm1998-02-021-0/+1265
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