summaryrefslogtreecommitdiff
path: root/ghc/lib/std/PrelNumExtra.lhs
Commit message (Collapse)AuthorAgeFilesLines
* [project @ 1999-12-20 10:35:47 by simonpj]simonpj1999-12-201-998/+0
| | | | Forgot to remove PrelNumExtra in the last commit
* [project @ 1999-11-01 17:09:54 by simonpj]simonpj1999-11-011-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A regrettably-gigantic commit that puts in place what Simon PJ has been up to for the last month or so, on and off. The basic idea was to restore unfoldings to *occurrences* of variables without introducing a space leak. I wanted to make sure things improved relative to 4.04, and that proved depressingly hard. On the way I discovered several quite serious bugs in the simplifier. Here's a summary of what's gone on. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * No commas between for-alls in RULES. This makes the for-alls have the same syntax as in types. * Arrange that simplConArgs works in one less pass than before. This exposed a bug: a bogus call to completeBeta. * Add a top-level flag in CoreUnfolding, used in callSiteInline * Extend w/w to use etaExpandArity, so it does eta/coerce expansion * Implement inline phases. The meaning of the inline pragmas is described in CoreUnfold.lhs. You can say things like {#- INLINE 2 build #-} to mean "inline build in phase 2" * Don't float anything out of an INLINE. Don't float things to top level unless they also escape a value lambda. [see comments with SetLevels.lvlMFE Without at least one of these changes, I found that {-# INLINE concat #-} concat = __inline (/\a -> foldr (++) []) was getting floated to concat = __inline( /\a -> lvl a ) lvl = ...inlined version of foldr... Subsequently I found that not floating constants out of an INLINE gave really bad code like __inline (let x = e in \y -> ...) so I now let things float out of INLINE * Implement the "reverse-mapping" idea for CSE; actually it turned out to be easier to implement it in SetLevels, and may benefit full laziness too. * It's a good idea to inline inRange. Consider index (l,h) i = case inRange (l,h) i of True -> l+i False -> error inRange itself isn't strict in h, but if it't inlined then 'index' *does* become strict in h. Interesting! * Big change to the way unfoldings and occurrence info is propagated in the simplifier The plan is described in Subst.lhs with the Subst type Occurrence info is now in a separate IdInfo field than user pragmas * I found that (coerce T (coerce S (\x.e))) y didn't simplify in one round. First we get to (\x.e) y and only then do the beta. Solution: cancel the coerces in the continuation * Amazingly, CoreUnfold wasn't counting the cost of a function an application. * Disable rules in initial simplifier run. Otherwise full laziness doesn't get a chance to lift out a MFE before a rule (e.g. fusion) zaps it. queens is a case in point * Improve float-out stuff significantly. The big change is that if we have \x -> ... /\a -> ...let p = ..a.. in let q = ...p... where p's rhs doesn't x, we abstract a from p, so that we can get p past x. (We did that before.) But we also substitute (p a) for p in q, and then we can do the same thing for q. (We didn't do that, so q got stuck.) This is much better. It involves doing a substitution "as we go" in SetLevels, though.
* [project @ 1999-11-01 10:16:03 by sof]sof1999-11-011-4/+5
| | | | formatRealFloat: Fixed some e==0 confusion in the default case for FFExponent
* [project @ 1999-09-19 19:12:39 by sof]sof1999-09-191-1/+1
| | | | | Drop the use of _ccall_, _casm_ and lit-lits in std/, "foreign import" is the future.
* [project @ 1999-07-14 08:37:57 by simonmar]simonmar1999-07-141-0/+4
| | | | USE_REPORT_PRELUDE patches from Wolfram Kahl.
* [project @ 1999-06-09 16:59:31 by simonmar]simonmar1999-06-091-0/+11
| | | | Add a few SPECIALISE/INLINE pragmas.
* [project @ 1999-05-18 14:59:04 by simonpj]simonpj1999-05-181-9/+3
| | | | ../compiler/msg_prel
* [project @ 1999-03-01 08:58:53 by sof]sof1999-03-011-1/+1
| | | | wibble
* [project @ 1999-02-18 12:26:11 by simonm]simonm1999-02-181-27/+38
| | | | | | | | | | | | | | | | | Add two new operations to StgPrimFloat.c: __int_encodeFloat __int_encodeDouble for encoding floats/doubles from small integers. This avoids having to convert small integers to large ones before an encodeFloat operation, and fixes the two cases of slowdown in nofib after the small integer changes. Also: - remove encodeFloat and decodeFloat as primops - use foreign import for encode{Float,Double} and the various isNaN etc. ccalls in PrelNumExtra.
* [project @ 1999-02-17 21:54:48 by simonpj]simonpj1999-02-171-2/+2
| | | | Reinstate specialisations for fromIntegral and realToFrac
* [project @ 1999-02-17 15:57:20 by simonm]simonm1999-02-171-6/+8
| | | | | | | | | | | | | | | | | | 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-02 17:37:39 by simonm]simonm1999-02-021-1/+1
| | | | Optimise take a little.
* [project @ 1999-02-01 14:31:34 by simonm]simonm1999-02-011-2/+2
| | | | Fix two bugs in formatRealFloat.
* [project @ 1999-02-01 10:02:15 by sof]sof1999-02-011-0/+1
| | | | H98 Prelude tweaks
* [project @ 1999-01-21 20:15:30 by sof]sof1999-01-211-7/+29
| | | | | | | | | | | | 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-16/+17
| | | | The Fight against needless use of (++) continues.
* [project @ 1999-01-14 18:12:47 by sof]sof1999-01-141-86/+127
| | | | | | | 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-0/+909
Move 4.01 onto the main trunk.