Ticket #2271: newRealFrac.dpatch

File newRealFrac.dpatch, 74.5 KB (added by daniel.is.fischer, 3 years ago)

new patch with our own rint versions

Line 
11 patch for repository /home/dafis/Haskell/Hacking/ghc/libraries/base:
2
3Mon Oct 18 02:58:24 CEST 2010  Daniel Fischer <daniel.is.fischer@web.de>
4  * FIX #2271
5  Faster rounding functions for Double and float with Int or Integer results.
6  Fixes #2271.
7  Since some glibc's have buggy rintf or rint functions and the behaviour of
8  these functions depends on the setting of the rounding mode, we provide our
9  own implementations which always round ties to even.
10 
11  Also added rewrite rules and removed trailing whitespace.
12
13New patches:
14
15[FIX #2271
16Daniel Fischer <daniel.is.fischer@web.de>**20101018005824
17 Ignore-this: da1b7b7fa503712cf1140e9f18102315
18 Faster rounding functions for Double and float with Int or Integer results.
19 Fixes #2271.
20 Since some glibc's have buggy rintf or rint functions and the behaviour of
21 these functions depends on the setting of the rounding mode, we provide our
22 own implementations which always round ties to even.
23 
24 Also added rewrite rules and removed trailing whitespace.
25] {
26adddir ./GHC/Float
27hunk ./GHC/Float.lhs 24
28 #include "ieee-flpt.h"
29 
30 -- #hide
31-module GHC.Float( module GHC.Float, Float(..), Double(..), Float#, Double# )
32+module GHC.Float( module GHC.Float, Float(..), Double(..), Float#, Double#
33+                , double2Int, int2Double, float2Int, int2Float )
34     where
35 
36 import Data.Maybe
37hunk ./GHC/Float.lhs 38
38 import GHC.Num
39 import GHC.Real
40 import GHC.Arr
41+import GHC.Float.RealFracMethods
42 
43 infixr 8  **
44 \end{code}
45hunk ./GHC/Float.lhs 196
46     fromRational x      =  fromRat x
47     recip x             =  1.0 / x
48 
49-{-# RULES "truncate/Float->Int" truncate = float2Int #-}
50+-- RULES for Integer and Int
51+{-# RULES
52+"properFraction/Float->Integer"     properFraction = properFractionFloatInteger
53+"truncate/Float->Integer"           truncate = truncateFloatInteger
54+"floor/Float->Integer"              floor = floorFloatInteger
55+"ceiling/Float->Integer"            ceiling = ceilingFloatInteger
56+"round/Float->Integer"              round = roundFloatInteger
57+"properFraction/Float->Int"         properFraction = properFractionFloatInt
58+"truncate/Float->Int"               truncate = float2Int
59+"floor/Float->Int"                  floor = floorFloatInt
60+"ceiling/Float->Int"                ceiling = ceilingFloatInt
61+"round/Float->Int"                  round = roundFloatInt
62+  #-}
63 instance  RealFrac Float  where
64 
65hunk ./GHC/Float.lhs 211
66-    {-# SPECIALIZE properFraction :: Float -> (Int, Float) #-}
67-    {-# SPECIALIZE round    :: Float -> Int #-}
68-
69-    {-# SPECIALIZE properFraction :: Float  -> (Integer, Float) #-}
70-    {-# SPECIALIZE round    :: Float -> Integer #-}
71-
72         -- ceiling, floor, and truncate are all small
73hunk ./GHC/Float.lhs 212
74-    {-# INLINE ceiling #-}
75-    {-# INLINE floor #-}
76-    {-# INLINE truncate #-}
77+    {-# INLINE [1] ceiling #-}
78+    {-# INLINE [1] floor #-}
79+    {-# INLINE [1] truncate #-}
80 
81 -- We assume that FLT_RADIX is 2 so that we can use more efficient code
82 #if FLT_RADIX != 2
83hunk ./GHC/Float.lhs 357
84     acosh x = log (x + (x+1.0) * sqrt ((x-1.0)/(x+1.0)))
85     atanh x = 0.5 * log ((1.0+x) / (1.0-x))
86 
87-{-# RULES "truncate/Double->Int" truncate = double2Int #-}
88+-- RULES for Integer and Int
89+{-# RULES
90+"properFraction/Double->Integer"    properFraction = properFractionDoubleInteger
91+"truncate/Double->Integer"          truncate = truncateDoubleInteger
92+"floor/Double->Integer"             floor = floorDoubleInteger
93+"ceiling/Double->Integer"           ceiling = ceilingDoubleInteger
94+"round/Double->Integer"             round = roundDoubleInteger
95+"properFraction/Double->Int"        properFraction = properFractionDoubleInt
96+"truncate/Double->Int"              truncate = double2Int
97+"floor/Double->Int"                 floor = floorDoubleInt
98+"ceiling/Double->Int"               ceiling = ceilingDoubleInt
99+"round/Double->Int"                 round = roundDoubleInt
100+  #-}
101 instance  RealFrac Double  where
102 
103hunk ./GHC/Float.lhs 372
104-    {-# SPECIALIZE properFraction :: Double -> (Int, Double) #-}
105-    {-# SPECIALIZE round    :: Double -> Int #-}
106-
107-    {-# SPECIALIZE properFraction :: Double -> (Integer, Double) #-}
108-    {-# SPECIALIZE round    :: Double -> Integer #-}
109-
110         -- ceiling, floor, and truncate are all small
111hunk ./GHC/Float.lhs 373
112-    {-# INLINE ceiling #-}
113-    {-# INLINE floor #-}
114-    {-# INLINE truncate #-}
115+    {-# INLINE [1] ceiling #-}
116+    {-# INLINE [1] floor #-}
117+    {-# INLINE [1] truncate #-}
118 
119     properFraction x
120       = case (decodeFloat x)      of { (m,n) ->
121hunk ./GHC/Float.lhs 379
122-        let  b = floatRadix x     in
123         if n >= 0 then
124hunk ./GHC/Float.lhs 380
125-            (fromInteger m * fromInteger b ^ n, 0.0)
126+            (fromInteger m * 2 ^ n, 0.0)
127         else
128hunk ./GHC/Float.lhs 382
129-            case (quotRem m (b^(negate n))) of { (w,r) ->
130+            case (quotRem m (2^(negate n))) of { (w,r) ->
131             (fromInteger w, encodeFloat r n)
132             }
133         }
134hunk ./GHC/Float.lhs 836
135 ltFloat     (F# x) (F# y) = ltFloat# x y
136 leFloat     (F# x) (F# y) = leFloat# x y
137 
138-float2Int :: Float -> Int
139-float2Int   (F# x) = I# (float2Int# x)
140-
141-int2Float :: Int -> Float
142-int2Float   (I# x) = F# (int2Float# x)
143-
144 expFloat, logFloat, sqrtFloat :: Float -> Float
145 sinFloat, cosFloat, tanFloat  :: Float -> Float
146 asinFloat, acosFloat, atanFloat  :: Float -> Float
147hunk ./GHC/Float.lhs 876
148 ltDouble    (D# x) (D# y) = x <## y
149 leDouble    (D# x) (D# y) = x <=## y
150 
151-double2Int :: Double -> Int
152-double2Int   (D# x) = I# (double2Int#   x)
153-
154-int2Double :: Int -> Double
155-int2Double   (I# x) = D# (int2Double#   x)
156-
157 double2Float :: Double -> Float
158 double2Float (D# x) = F# (double2Float# x)
159 
160addfile ./GHC/Float/RealFracMethods.hs
161hunk ./GHC/Float/RealFracMethods.hs 1
162+{-# LANGUAGE CPP, MagicHash, UnboxedTuples, ForeignFunctionInterface,
163+    NoImplicitPrelude #-}
164+{-# OPTIONS_HADDOCK hide #-}
165+-----------------------------------------------------------------------------
166+-- |
167+-- Module      :  GHC.Float.RealFracMethods
168+-- Copyright   :  (c) Daniel Fischer 2010
169+-- License     :  see libraries/base/LICENSE
170+--
171+-- Maintainer  :  cvs-ghc@haskell.org
172+-- Stability   :  internal
173+-- Portability :  non-portable (GHC Extensions)
174+--
175+-- Methods for the RealFrac instances for 'Float' and 'Double',
176+-- with specialised versions for 'Int'.
177+--
178+-- Moved to their own module to not bloat GHC.Float further.
179+--
180+-----------------------------------------------------------------------------
181+
182+#include "MachDeps.h"
183+
184+-- #hide
185+module GHC.Float.RealFracMethods
186+    ( -- * Double methods
187+      -- ** Integer results
188+      properFractionDoubleInteger
189+    , truncateDoubleInteger
190+    , floorDoubleInteger
191+    , ceilingDoubleInteger
192+    , roundDoubleInteger
193+      -- ** Int results
194+    , properFractionDoubleInt
195+    , floorDoubleInt
196+    , ceilingDoubleInt
197+    , roundDoubleInt
198+      -- * Double/Int conversions, wrapped primops
199+    , double2Int
200+    , int2Double
201+      -- * Float methods
202+      -- ** Integer results
203+    , properFractionFloatInteger
204+    , truncateFloatInteger
205+    , floorFloatInteger
206+    , ceilingFloatInteger
207+    , roundFloatInteger
208+      -- ** Int results
209+    , properFractionFloatInt
210+    , floorFloatInt
211+    , ceilingFloatInt
212+    , roundFloatInt
213+      -- * Float/Int conversions, wrapped primops
214+    , float2Int
215+    , int2Float
216+    ) where
217+
218+import GHC.Integer
219+
220+import GHC.Base
221+import GHC.Num
222+
223+#if WORD_SIZE_IN_BITS < 64
224+
225+import GHC.IntWord64
226+
227+#define TO64 integerToInt64
228+#define FROM64 int64ToInteger
229+#define MINUS64 minusInt64#
230+#define NEGATE64 negateInt64#
231+
232+#else
233+
234+#define TO64 toInt#
235+#define FROM64 smallInteger
236+#define MINUS64 ( -# )
237+#define NEGATE64 negateInt#
238+
239+uncheckedIShiftRA64# :: Int# -> Int# -> Int#
240+uncheckedIShiftRA64# = uncheckedIShiftRA#
241+
242+uncheckedIShiftL64# :: Int# -> Int# -> Int#
243+uncheckedIShiftL64# = uncheckedIShiftL#
244+
245+#endif
246+
247+default ()
248+
249+------------------------------------------------------------------------------
250+--                              Float Methods                               --
251+------------------------------------------------------------------------------
252+
253+-- Special Functions for Int, nice, easy and fast.
254+-- They should be small enough to be inlined automatically.
255+
256+properFractionFloatInt :: Float -> (Int, Float)
257+properFractionFloatInt (F# x) =
258+    case float2Int# x of
259+      n -> (I# n, F# (x `minusFloat#` int2Float# n))
260+
261+-- truncateFloatInt = float2Int
262+
263+floorFloatInt :: Float -> Int
264+floorFloatInt (F# x) =
265+    case float2Int# x of
266+      n | x `ltFloat#` int2Float# n -> I# (n -# 1#)
267+        | otherwise                 -> I# n
268+
269+ceilingFloatInt :: Float -> Int
270+ceilingFloatInt (F# x) =
271+    case float2Int# x of
272+      n | int2Float# n `ltFloat#` x  -> I# (n +# 1#)
273+        | otherwise                 -> I# n
274+
275+roundFloatInt :: Float -> Int
276+roundFloatInt x = float2Int (c_rintFloat x)
277+
278+-- Functions with Integer results
279+
280+-- With the new code generator in GHC 7, the explicit bit-fiddling is
281+-- slower than the old code for values of small modulus, but when the
282+-- 'Int' range is left, the bit-fiddling quickly wins big, so we use that.
283+-- If the methods are called on smallish values, hopefully people go
284+-- through Int and not larger types.
285+
286+-- Note: For negative exponents, we must check the validity of the shift
287+-- distance for the right shifts of the mantissa.
288+
289+{-# INLINE properFractionFloatInteger #-}
290+properFractionFloatInteger :: Float -> (Integer, Float)
291+properFractionFloatInteger v@(F# x) =
292+    case decodeFloat_Int# x of
293+      (# m, e #)
294+        | e <# 0#   ->
295+          case negateInt# e of
296+            s | s ># 23#    -> (0, v)
297+              | m <# 0#     ->
298+                case negateInt# (negateInt# m `uncheckedIShiftRA#` s) of
299+                  k -> (smallInteger k,
300+                            case m -# (k `uncheckedIShiftL#` s) of
301+                              r -> F# (encodeFloatInteger (smallInteger r) e))
302+              | otherwise           ->
303+                case m `uncheckedIShiftRL#` s of
304+                  k -> (smallInteger k,
305+                            case m -# (k `uncheckedIShiftL#` s) of
306+                              r -> F# (encodeFloatInteger (smallInteger r) e))
307+        | otherwise -> (shiftLInteger (smallInteger m) e, F# 0.0#)
308+
309+{-# INLINE truncateFloatInteger #-}
310+truncateFloatInteger :: Float -> Integer
311+truncateFloatInteger x =
312+    case properFractionFloatInteger x of
313+      (n, _) -> n
314+
315+-- floor is easier for negative numbers than truncate, so this gets its
316+-- own implementation, it's a little faster.
317+{-# INLINE floorFloatInteger #-}
318+floorFloatInteger :: Float -> Integer
319+floorFloatInteger (F# x) =
320+    case decodeFloat_Int# x of
321+      (# m, e #)
322+        | e <# 0#   ->
323+          case negateInt# e of
324+            s | s ># 23#    -> if m <# 0# then (-1) else 0
325+              | otherwise   -> smallInteger (m `uncheckedIShiftRA#` s)
326+        | otherwise -> shiftLInteger (smallInteger m) e
327+
328+-- ceiling x = -floor (-x)
329+-- If giving this its own implementation is faster at all,
330+-- it's only marginally so, hence we keep it short.
331+{-# INLINE ceilingFloatInteger #-}
332+ceilingFloatInteger :: Float -> Integer
333+ceilingFloatInteger (F# x) =
334+    negateInteger (floorFloatInteger (F# (negateFloat# x)))
335+
336+{-# INLINE roundFloatInteger #-}
337+roundFloatInteger :: Float -> Integer
338+roundFloatInteger x = float2Integer (c_rintFloat x)
339+
340+------------------------------------------------------------------------------
341+--                              Double Methods                              --
342+------------------------------------------------------------------------------
343+
344+-- Special Functions for Int, nice, easy and fast.
345+-- They should be small enough to be inlined automatically.
346+
347+properFractionDoubleInt :: Double -> (Int, Double)
348+properFractionDoubleInt (D# x) =
349+    case double2Int# x of
350+      n -> (I# n, D# (x -## int2Double# n))
351+
352+-- truncateDoubleInt = double2Int
353+
354+floorDoubleInt :: Double -> Int
355+floorDoubleInt (D# x) =
356+    case double2Int# x of
357+      n | x <## int2Double# n   -> I# (n -# 1#)
358+        | otherwise             -> I# n
359+
360+ceilingDoubleInt :: Double -> Int
361+ceilingDoubleInt (D# x) =
362+    case double2Int# x of
363+      n | int2Double# n <## x   -> I# (n +# 1#)
364+        | otherwise             -> I# n
365+
366+roundDoubleInt :: Double -> Int
367+roundDoubleInt x = double2Int (c_rintDouble x)
368+
369+-- Functions with Integer results
370+
371+-- The new Code generator isn't quite as good for the old 'Double' code
372+-- as for the 'Float' code, so for 'Double' the bit-fiddling also wins
373+-- when the values have small modulus.
374+
375+-- When the exponent is negative, all mantissae have less than 64 bits
376+-- and the right shifting of sized types is much faster than that of
377+-- 'Integer's, especially when we can
378+
379+-- Note: For negative exponents, we must check the validity of the shift
380+-- distance for the right shifts of the mantissa.
381+
382+{-# INLINE properFractionDoubleInteger #-}
383+properFractionDoubleInteger :: Double -> (Integer, Double)
384+properFractionDoubleInteger v@(D# x) =
385+    case decodeDoubleInteger x of
386+      (# m, e #)
387+        | e <# 0#   ->
388+          case negateInt# e of
389+            s | s ># 52#    -> (0, v)
390+              | m < 0       ->
391+                case TO64 (negateInteger m) of
392+                  n ->
393+                    case n `uncheckedIShiftRA64#` s of
394+                      k ->
395+                        (FROM64 (NEGATE64 k),
396+                          case MINUS64 n (k `uncheckedIShiftL64#` s) of
397+                            r ->
398+                              D# (encodeDoubleInteger (FROM64 (NEGATE64 r)) e))
399+              | otherwise           ->
400+                case TO64 m of
401+                  n ->
402+                    case n `uncheckedIShiftRA64#` s of
403+                      k -> (FROM64 k,
404+                            case MINUS64 n (k `uncheckedIShiftL64#` s) of
405+                              r -> D# (encodeDoubleInteger (FROM64 r) e))
406+        | otherwise -> (shiftLInteger m e, D# 0.0##)
407+
408+{-# INLINE truncateDoubleInteger #-}
409+truncateDoubleInteger :: Double -> Integer
410+truncateDoubleInteger x =
411+    case properFractionDoubleInteger x of
412+      (n, _) -> n
413+
414+-- floor is easier for negative numbers than truncate, so this gets its
415+-- own implementation, it's a little faster.
416+{-# INLINE floorDoubleInteger #-}
417+floorDoubleInteger :: Double -> Integer
418+floorDoubleInteger (D# x) =
419+    case decodeDoubleInteger x of
420+      (# m, e #)
421+        | e <# 0#   ->
422+          case negateInt# e of
423+            s | s ># 52#    -> if m < 0 then (-1) else 0
424+              | otherwise   ->
425+                case TO64 m of
426+                  n -> FROM64 (n `uncheckedIShiftRA64#` s)
427+        | otherwise -> shiftLInteger m e
428+
429+{-# INLINE ceilingDoubleInteger #-}
430+ceilingDoubleInteger :: Double -> Integer
431+ceilingDoubleInteger (D# x) =
432+    negateInteger (floorDoubleInteger (D# (negateDouble# x)))
433+
434+{-# INLINE roundDoubleInteger #-}
435+roundDoubleInteger :: Double -> Integer
436+roundDoubleInteger x = double2Integer (c_rintDouble x)
437+
438+-- Wrappers around double2Int#, int2Double#, float2Int# and int2Float#,
439+-- we need them here, so we move them from GHC.Float and re-export them
440+-- explicitly from there.
441+
442+double2Int :: Double -> Int
443+double2Int (D# x) = I# (double2Int# x)
444+
445+int2Double :: Int -> Double
446+int2Double (I# i) = D# (int2Double# i)
447+
448+float2Int :: Float -> Int
449+float2Int (F# x) = I# (float2Int# x)
450+
451+int2Float :: Int -> Float
452+int2Float (I# i) = F# (int2Float# i)
453+
454+-- Quicker conversions from 'Double' and 'Float' to 'Integer',
455+-- assuming the floating point value is integral.
456+--
457+-- Note: Since the value is integral, the exponent can't be less than
458+-- (-TYP_MANT_DIG), so we need not check the validity of the shift
459+-- distance for the right shfts here.
460+
461+{-# INLINE double2Integer #-}
462+double2Integer :: Double -> Integer
463+double2Integer (D# x) =
464+    case decodeDoubleInteger x of
465+      (# m, e #)
466+        | e <# 0#   ->
467+          case TO64 m of
468+            n -> FROM64 (n `uncheckedIShiftRA64#` negateInt# e)
469+        | otherwise -> shiftLInteger m e
470+
471+{-# INLINE float2Integer #-}
472+float2Integer :: Float -> Integer
473+float2Integer (F# x) =
474+    case decodeFloat_Int# x of
475+      (# m, e #)
476+        | e <# 0#   -> smallInteger (m `uncheckedIShiftRA#` negateInt# e)
477+        | otherwise -> shiftLInteger (smallInteger m) e
478+
479+-- Foreign imports, the rounding is done faster in C when the value
480+-- isn't integral, so we call out for rounding. For values of large
481+-- modulus, calling out to C is slower than staying in Haskell, but
482+-- presumably 'round' is mostly called for values with smaller modulus,
483+-- when calling out to C is a major win.
484+-- For all other functions, calling out to C gives at most a marginal
485+-- speedup for values of small modulus and is much slower than staying
486+-- in Haskell for values of large modulus, so those are done in Haskell.
487+
488+foreign import ccall unsafe "rintDouble"
489+    c_rintDouble :: Double -> Double
490+
491+foreign import ccall unsafe "rintFloat"
492+    c_rintFloat :: Float -> Float
493hunk ./base.cabal 55
494             GHC.Exception,
495             GHC.Exts,
496             GHC.Float,
497+            GHC.Float.RealFracMethods,
498             GHC.ForeignPtr,
499             GHC.MVar,
500             GHC.IO,
501hunk ./cbits/primFloat.c 47
502 };
503 
504 /*
505-
506+
507  To recap, here's the representation of a double precision
508  IEEE floating point number:
509 
510hunk ./cbits/primFloat.c 109
511 
512 /*
513  * Predicates for testing for extreme IEEE fp values.
514- */
515+ */
516 
517 /* In case you don't suppport IEEE, you'll just get dummy defs.. */
518 #ifdef IEEE_FLOATING_POINT
519hunk ./cbits/primFloat.c 118
520 isDoubleNaN(HsDouble d)
521 {
522   union stg_ieee754_dbl u;
523
524+
525   u.d = d;
526 
527   return (
528hunk ./cbits/primFloat.c 144
529 }
530 
531 HsInt
532-isDoubleDenormalized(HsDouble d)
533+isDoubleDenormalized(HsDouble d)
534 {
535     union stg_ieee754_dbl u;
536 
537hunk ./cbits/primFloat.c 157
538         - (don't care about setting of sign bit.)
539 
540     */
541-    return ( 
542+    return (
543        u.ieee.exponent  == 0 &&
544        (u.ieee.mantissa0 != 0 ||
545         u.ieee.mantissa1 != 0)
546hunk ./cbits/primFloat.c 162
547       );
548-       
549+
550 }
551 
552 HsInt
553hunk ./cbits/primFloat.c 166
554-isDoubleNegativeZero(HsDouble d)
555+isDoubleNegativeZero(HsDouble d)
556 {
557     union stg_ieee754_dbl u;
558 
559hunk ./cbits/primFloat.c 210
560 {
561     union stg_ieee754_flt u;
562     u.f = f;
563
564+
565     /* A float is Inf iff exponent is max (all ones),
566        and mantissa is min(all zeros.) */
567     return (
568hunk ./cbits/primFloat.c 237
569 }
570 
571 HsInt
572-isFloatNegativeZero(HsFloat f)
573+isFloatNegativeZero(HsFloat f)
574 {
575     union stg_ieee754_flt u;
576     u.f = f;
577hunk ./cbits/primFloat.c 249
578        u.ieee.mantissa == 0);
579 }
580 
581+/*
582+ There are glibc versions around with buggy rintf or rint, hence we
583+ provide our own. We always round ties to even, so we can be simpler.
584+*/
585+
586+#define FLT_HIDDEN 0x800000
587+#define FLT_POWER2 0x1000000
588+
589+HsFloat
590+rintFloat(HsFloat f)
591+{
592+    union stg_ieee754_flt u;
593+    u.f = f;
594+    /* if real exponent > 22, it's already integral, infinite or nan */
595+    if (u.ieee.exponent > 149)  /* 22 + 127 */
596+    {
597+        return u.f;
598+    }
599+    if (u.ieee.exponent < 126)  /* (-1) + 127, abs(f) < 0.5 */
600+    {
601+        return (u.ieee.negative ? (-0.0) : 0.0);
602+    }
603+    /* 0.5 <= abs(f) < 2^23 */
604+    unsigned int half, mask, mant, frac;
605+    half = 1 << (149 - u.ieee.exponent);    /* bit for 0.5 */
606+    mask = 2*half - 1;                      /* fraction bits */
607+    mant = u.ieee.mantissa | FLT_HIDDEN;    /* add hidden bit */
608+    frac = mant & mask;                     /* get fraction */
609+    mant ^= frac;                           /* truncate mantissa */
610+    if ((frac < half) || ((frac == half) && ((mant & (2*half)) == 0)))
611+    {
612+        /* this means we have to truncate */
613+        if (mant == 0)
614+        {
615+            /* f == ±0.5, return ±0.0 */
616+            return (u.ieee.negative ? (-0.0) : 0.0);
617+        }
618+        else
619+        {
620+            /* remove hidden bit and set mantissa */
621+            u.ieee.mantissa = mant ^ FLT_HIDDEN;
622+            return u.f;
623+        }
624+    }
625+    else
626+    {
627+        /* round away from zero, increment mantissa */
628+        mant += 2*half;
629+        if (mant == FLT_POWER2)
630+        {
631+            /* next power of 2, increase exponent an set mantissa to 0 */
632+            u.ieee.mantissa = 0;
633+            u.ieee.exponent += 1;
634+            return u.f;
635+        }
636+        else
637+        {
638+            /* remove hidden bit and set mantissa */
639+            u.ieee.mantissa = mant ^ FLT_HIDDEN;
640+            return u.f;
641+        }
642+    }
643+}
644+
645+#define DBL_HIDDEN 0x100000
646+#define DBL_POWER2 0x200000
647+#define LTOP_BIT 0x80000000
648+
649+HsDouble
650+rintDouble(HsDouble d)
651+{
652+    union stg_ieee754_dbl u;
653+    u.d = d;
654+    /* if real exponent > 51, it's already integral, infinite or nan */
655+    if (u.ieee.exponent > 1074) /* 51 + 1023 */
656+    {
657+        return u.d;
658+    }
659+    if (u.ieee.exponent < 1022)  /* (-1) + 1023, abs(d) < 0.5 */
660+    {
661+        return (u.ieee.negative ? (-0.0) : 0.0);
662+    }
663+    unsigned int half, mask, mant, frac;
664+    if (u.ieee.exponent < 1043) /* 20 + 1023, real exponent < 20 */
665+    {
666+        /* the fractional part meets the higher part of the mantissa */
667+        half = 1 << (1042 - u.ieee.exponent);   /* bit for 0.5 */
668+        mask = 2*half - 1;                      /* fraction bits */
669+        mant = u.ieee.mantissa0 | DBL_HIDDEN;   /* add hidden bit */
670+        frac = mant & mask;                     /* get fraction */
671+        mant ^= frac;                           /* truncate mantissa */
672+        if ((frac < half) ||
673+            ((frac == half) && (u.ieee.mantissa1 == 0)  /* a tie */
674+                && ((mant & (2*half)) == 0)))
675+        {
676+            /* truncate */
677+            if (mant == 0)
678+            {
679+                /* d = ±0.5, return ±0.0 */
680+                return (u.ieee.negative ? (-0.0) : 0.0);
681+            }
682+            /* remove hidden bit and set mantissa */
683+            u.ieee.mantissa0 = mant ^ DBL_HIDDEN;
684+            u.ieee.mantissa1 = 0;
685+            return u.d;
686+        }
687+        else    /* round away from zero */
688+        {
689+            /* zero low mantissa bits */
690+            u.ieee.mantissa1 = 0;
691+            /* increment integer part of mantissa */
692+            mant += 2*half;
693+            if (mant == DBL_POWER2)
694+            {
695+                /* power of 2, increment exponent and zero mantissa */
696+                u.ieee.mantissa0 = 0;
697+                u.ieee.exponent += 1;
698+                return u.d;
699+            }
700+            /* remove hidden bit */
701+            u.ieee.mantissa0 = mant ^ DBL_HIDDEN;
702+            return u.d;
703+        }
704+    }
705+    else
706+    {
707+        /* 20 <= real exponent < 52, fractional part entirely in mantissa1 */
708+        half = 1 << (1074 - u.ieee.exponent);   /* bit for 0.5 */
709+        mask = 2*half - 1;                      /* fraction bits */
710+        mant = u.ieee.mantissa1;                /* no hidden bit here */
711+        frac = mant & mask;                     /* get fraction */
712+        mant ^= frac;                           /* truncate mantissa */
713+        if ((frac < half) ||
714+            ((frac == half) &&                  /* tie */
715+            (((half == LTOP_BIT) ? (u.ieee.mantissa0 & 1)  /* yuck */
716+                                : (mant & (2*half)))
717+                                        == 0)))
718+        {
719+            /* truncate */
720+            u.ieee.mantissa1 = mant;
721+            return u.d;
722+        }
723+        else
724+        {
725+            /* round away from zero */
726+            /* increment mantissa */
727+            mant += 2*half;
728+            u.ieee.mantissa1 = mant;
729+            if (mant == 0)
730+            {
731+                /* low part of mantissa overflowed */
732+                /* increment high part of mantissa */
733+                mant = u.ieee.mantissa0 + 1;
734+                if (mant == DBL_HIDDEN)
735+                {
736+                    /* hit power of 2 */
737+                    /* zero mantissa */
738+                    u.ieee.mantissa0 = 0;
739+                    /* and increment exponent */
740+                    u.ieee.exponent += 1;
741+                    return u.d;
742+                }
743+                else
744+                {
745+                    u.ieee.mantissa0 = mant;
746+                    return u.d;
747+                }
748+            }
749+            else
750+            {
751+                return u.d;
752+            }
753+        }
754+    }
755+}
756+
757 #else /* ! IEEE_FLOATING_POINT */
758 
759 /* Dummy definitions of predicates - they all return false */
760hunk ./cbits/primFloat.c 437
761 HsInt isFloatDenormalized(f) HsFloat f; { return 0; }
762 HsInt isFloatNegativeZero(f) HsFloat f; { return 0; }
763 
764+
765+/* For exotic floating point formats, we can't do much */
766+/* We suppose the format has not too many bits */
767+/* I hope nobody tries to build GHC where this is wrong */
768+
769+#define FLT_UPP 536870912.0
770+
771+HsFloat
772+rintFloat(HsFloat f)
773+{
774+    if ((f > FLT_UPP) || (f < (-FLT_UPP)))
775+    {
776+        return f;
777+    }
778+    else
779+    {
780+        int i = (int)f;
781+        float g = i;
782+        float d = f - g;
783+        if (d > 0.5)
784+        {
785+            return g + 1.0;
786+        }
787+        if (d == 0.5)
788+        {
789+            return (i & 1) ? (g + 1.0) : g;
790+        }
791+        if (d == -0.5)
792+        {
793+            return (i & 1) ? (g - 1.0) : g;
794+        }
795+        if (d < -0.5)
796+        {
797+            return g - 1.0;
798+        }
799+        return g;
800+    }
801+}
802+
803+#define DBL_UPP 2305843009213693952.0
804+
805+HsDouble
806+rintDouble(HsDouble d)
807+{
808+    if ((d > DBL_UPP) || (d < (-DBL_UPP)))
809+    {
810+        return d;
811+    }
812+    else
813+    {
814+        HsInt64 i = (HsInt64)d;
815+        double e = i;
816+        double r = d - e;
817+        if (r > 0.5)
818+        {
819+            return e + 1.0;
820+        }
821+        if (r == 0.5)
822+        {
823+            return (i & 1) ? (e + 1.0) : e;
824+        }
825+        if (r == -0.5)
826+        {
827+            return (i & 1) ? (e - 1.0) : e;
828+        }
829+        if (r < -0.5)
830+        {
831+            return e - 1.0;
832+        }
833+        return e;
834+    }
835+}
836+
837 #endif /* ! IEEE_FLOATING_POINT */
838}
839
840Context:
841
842[throwTo: mention interruptible foreign calls
843Simon Marlow <marlowsd@gmail.com>**20101014084220
844 Ignore-this: dbc53d85f870cf649f87186c7185465a
845]
846[remove trailing whitespace
847Simon Marlow <marlowsd@gmail.com>**20101013101906
848 Ignore-this: b8b424540cacbbb3c6d934242e3af795
849]
850[FIX #4381
851Simon Marlow <marlowsd@gmail.com>**20101013101849
852 Ignore-this: f0daa4845eeb444231451b975b71d055
853 Fix scaleFloat by clamping the scaling parameter so that
854 exponent + scale doesn't overflow.
855 
856 Patch by: Daniel Fischer <daniel.is.fischer@web.de>
857]
858[Replaced some throws to throwIOs where the type is IO
859Bas van Dijk <v.dijk.bas@gmail.com>**20100924221340
860 Ignore-this: e74191e4527ae6f7551c95fd41063335
861]
862[Added initial .authorspellings
863Bas van Dijk <v.dijk.bas@gmail.com>**20101005072701
864 Ignore-this: 63628bcabfdd0b7beda4cd37daeccd89
865]
866[Lazier intersperse
867Daniel Fischer <daniel.is.fischer@web.de>**20101002231201
868 Ignore-this: a0fed65930cf19e68b4363381a5ab576
869 A lazier implementation of intersperse, and consequentially intercalate, to
870 avoid space leaks.
871]
872[FIX #4228 (atanh (-1) returns NaN instead of -Infinity)
873ghc@cainnorris.net**20100816213654
874 Ignore-this: dee89c24493e84a02bea711a1c83a73f
875]
876[Make intersectBy lazier
877Daniel Fischer <daniel.is.fischer@web.de>**20100930191731
878 Ignore-this: ef687bc75923434e85c14b57171576aa
879 Add shortcuts to intersectBy for empty list arguments.
880 In addition to being faster in that case, more inputs yield defined results.
881 Treats ticket #4323
882]
883[doc tweak for Directory file type: file names are '\0'-separated
884Simon Marlow <marlowsd@gmail.com>**20100922113811
885 Ignore-this: 96b7b004bd6e5bc3e958ad55bf238ba1
886]
887[documentation for IODeviceType (#4317, edited by me)
888Simon Marlow <marlowsd@gmail.com>**20100915131341
889 Ignore-this: 21c50ca7a189eebcf299523b6e942bae
890]
891[Allow Data.HashTable construction with user-supplied size
892**20100722210726
893 Ignore-this: bd54880bb16a106a992f03b040dc4164
894 
895 This avoids some resizing for users who know they will be inserting a
896 lot of data.
897 
898 http://hackage.haskell.org/trac/ghc/ticket/4193
899]
900[some fixes for hGetBufSome
901Simon Marlow <marlowsd@gmail.com>**20100916113732
902 Ignore-this: 3e596a606c180dc4859ea8f4c9132ca1
903  - fix one case where it was blocking when it shouldn't
904  - a couple of error-message tweaks
905]
906[Windows: map ERROR_NO_DATA to EPIPE, rather than EINVAL
907Simon Marlow <marlowsd@gmail.com>**20100915142618
908 Ignore-this: 9023e5f0542419f225aef26cb6b1d88d
909 WriteFile() returns ERROR_NO_DATA when writing to a pipe that is
910 "closing", however by default the write() wrapper in the CRT maps this
911 to EINVAL so we get confusing things like
912 
913   hPutChar: invalid argument (Invalid Argumnet)
914 
915 when piping the output of a Haskell program into something that closes
916 the pipe early.  This was happening in the testsuite in a few place.
917 
918 The solution is to map ERROR_NO_DATA to EPIPE correctly, as we
919 explicitly check for EPIPE on stdout (in GHC.TopHandler) so we can
920 exit without an error in this case.
921]
922[tighten up parsing of numbers (#1579)
923Simon Marlow <marlowsd@gmail.com>**20100913214733
924 Ignore-this: 3411bf3d2e98cfacb9e0afd11d79e722
925]
926[Add absentError. 
927simonpj@microsoft.com**20100914134639
928 Ignore-this: d0eef5a87e1def4cdbde92a55241c8c4
929 
930 This patch accompanies the HEAD patch:
931 
932   Tue Sep 14 12:38:27 BST 2010  simonpj@microsoft.com
933     * Make absent-arg wrappers work for unlifted types (fix Trac #4306)
934     
935     Previously we were simply passing arguments of unlifted
936     type to a wrapper, even if they were absent, which was
937     stupid.
938     
939     See Note [Absent error Id] in WwLib.
940]
941[Add missing import, fixes build on windows
942simonpj@microsoft.com**20100914122750
943 Ignore-this: 12ece15ef94982ddfbf5f9f7900619da
944]
945[Add a suitable Show instance for TextEncoding (#4273)
946Simon Marlow <marlowsd@gmail.com>**20100913154459
947 Ignore-this: 77f2235460895debd2827f34c42c3435
948]
949[don't fill a finalized handle with an error (see comment)
950Simon Marlow <marlowsd@gmail.com>**20100913153350
951 Ignore-this: c72cdb6898dffa88eca1d781171b2943
952]
953[deriving (Eq, Ord, Read, Show) for Newline and NewlineMode
954Simon Marlow <marlowsd@gmail.com>**20100913153031
955 Ignore-this: 9b9b29bfb7abf5550cfbfa7788f81bf
956]
957[fix warning on Windows
958Simon Marlow <marlowsd@gmail.com>**20100913111536
959 Ignore-this: dacc5448c452daad60ed37a1a5ed096e
960]
961[Put the state-token argument on fill, done, adjust on the RHS
962simonpj@microsoft.com**20100913101832
963 Ignore-this: d228b492de7d4635c026ed24cbc17e34
964 
965 This is so that the functions will inline when
966 applied to their normal (non-state-token) aguments.
967 
968 I forget why I did this, but it seems like the right thing anyway.
969]
970[avoid Foreign.unsafePerformIO
971Ross Paterson <ross@soi.city.ac.uk>**20100909125521
972 Ignore-this: b698101119ffd1bc6311cce0736f745d
973]
974[Remove debugging code accidentally left in
975Simon Marlow <marlowsd@gmail.com>**20100909113331
976 Ignore-this: 906a14176dd37030b8203782a687936b
977]
978[Fix Windows build; patches frmo ezyang
979Ian Lynagh <igloo@earth.li>**20100908123037
980 Ignore-this: 2f02986087edd7da8382221012c27cd0
981]
982[More accurate isatty test for MinGW.
983Edward Z. Yang <ezyang@mit.edu>**20100907154144
984 Ignore-this: 93bdc2b2a8e65a7c4c7d3906bdda01db
985]
986[Fix the build when HAVE_KQUEUE but not HAVE_KEVENT64
987Ian Lynagh <igloo@earth.li>**20100904223703]
988[Fix warnings
989benl@ouroborus.net**20100830044741
990 Ignore-this: 8397aaec7c36046c9ace403e65f32d32
991]
992[fix cache variable name used by FP_SEARCH_LIBS_PROTO
993Ross Paterson <ross@soi.city.ac.uk>**20100819204858
994 Ignore-this: b8113cb3c6f0e03c507297c99d3d82b7
995]
996[Add a missing castPtr (only shows up in -DDEBUG)
997simonpj@microsoft.com**20100815145127
998 Ignore-this: 30b9c42cd3ce7837bdabd254fe66078d
999]
1000[Fixed a rounding error in threadDelay
1001Johan Tibell <johan.tibell@gmail.com>**20100813124043
1002 Ignore-this: 1cb77d0852233ffffb144b134064ee3c
1003]
1004[export allocaBytesAligned; make allocaArray use the correct alignment (#2917)
1005Simon Marlow <marlowsd@gmail.com>**20100812105524
1006 Ignore-this: deb6495f7b7b84deaf02b88927a5ba8c
1007]
1008[deprecate unGetChan and isEmptyChan (see #4154)
1009Simon Marlow <marlowsd@gmail.com>**20100705125952
1010 Ignore-this: b4e769959f131b2d0001eb7202bc1b92
1011]
1012[Add type signatures to cope with lack of local generalisation
1013simonpj@microsoft.com**20100728124847
1014 Ignore-this: d3af9a47c2821c6081bde05a135a92fb
1015]
1016[Add type signature in local where
1017simonpj@microsoft.com**20100727151532
1018 Ignore-this: 1c57063ad32d13e0d1ec8daf968bf055
1019]
1020[Integrated new I/O manager
1021Simon Marlow <marlowsd@gmail.com>**20100810082248
1022 Ignore-this: ed70a9066ac9b676a446fe99978fef7a
1023 (patch originally by Johan Tibell <johan.tibell@gmail.com>, minor merging by me)
1024]
1025[Add mfilter to Control.Monad
1026jon.fairbairn@cl.cam.ac.uk**20090917145616
1027 Ignore-this: de4240b60684f3065b29378df3ea98f2
1028 
1029 Straightforward MonadPlus version of List.filter. I would
1030 prefer to call it filter, but the current naming scheme for
1031 Control.Monad implies mfilter.
1032 
1033]
1034[move Monad and MonadFix instances for Either from mtl (proposal #4159)
1035Ross Paterson <ross@soi.city.ac.uk>**20100729122449
1036 Ignore-this: b0f8cd8643679948d1da43bd7c08c5aa
1037 
1038 The Monad and MonadFix instances for Either (formerly in the mtl
1039 package) are moved to Control.Monad.Instances and Control.Monad.Fix
1040 respectively.  The Monad instance is still an orphan, to retain Haskell
1041 98 compatibility, but the MonadFix instance is together with its class.
1042 The Error constraint is removed from both instances, and the default
1043 definition of fail is used.
1044]
1045[Remove egregious ghc-ish from Foreign.Marshal
1046Malcolm.Wallace@me.com**20100722075449]
1047[add numSparks :: IO Int (#4167)
1048Simon Marlow <marlowsd@gmail.com>**20100720153858
1049 Ignore-this: 4543f57a7f137f8cae1c3efc5c023a9b
1050]
1051[add unsafeLocalState from Haskell 2010, and docs
1052Simon Marlow <marlowsd@gmail.com>**20100720082819
1053 Ignore-this: dcd79fb546ebe29ddff4df279ec2f38
1054]
1055[docs: mention that Foreign.unsafePerformIO is deprecated
1056Simon Marlow <marlowsd@gmail.com>**20100720082804
1057 Ignore-this: 4cfebb8f2a1cddc7d15e94e31b2befa4
1058 We can't actually deprecate it without introducing a name clash
1059 between Foreign.unsafePerformIO and System.IO.Unsafe.unsafePerformIO
1060]
1061[doc formatting fix
1062Simon Marlow <marlowsd@gmail.com>**20100714151347
1063 Ignore-this: 255edef607dcd290e198015240b5d125
1064]
1065[add module intro from Haskell 2010
1066Simon Marlow <marlowsd@gmail.com>**20100714115853
1067 Ignore-this: 59b5a07507a059ccccdff2dfb6490a27
1068]
1069[document exception-overriding behaviour in withFile
1070Simon Marlow <marlowsd@gmail.com>**20100714104107
1071 Ignore-this: f99e641ea2f46d872cb7420a62fa50dc
1072]
1073[doc: use "finalizer" consistently
1074Simon Marlow <marlowsd@gmail.com>**20100714103649
1075 Ignore-this: bdfea40f31dc5045fdbc6e12266dda93
1076]
1077[clarify meaning of bit
1078Simon Marlow <marlowsd@gmail.com>**20100714103310
1079 Ignore-this: 521b031f1e83ef34ca03d9aa9273df8a
1080]
1081[note shortcutting behaviour of any/all/elem
1082Simon Marlow <marlowsd@gmail.com>**20100714103304
1083 Ignore-this: 1605f362ba0712ad1cea1309636f3ea1
1084]
1085[add cast{C,U}CharToChar and castCharTo{C,U}Char, from Haskell 2010
1086Simon Marlow <marlowsd@gmail.com>**20100713132515
1087 Ignore-this: 9b1da827016c7b08668078b45964e9de
1088]
1089[mention that IntPtr and WordPtr can be marshalled to/from intptr_t and uintptr_t
1090Simon Marlow <marlowsd@gmail.com>**20100713132403
1091 Ignore-this: dcc112a72746ba117a84fa29e71b6800
1092]
1093[Partial fix for Trac #4136
1094simonpj@microsoft.com**20100707135725
1095 Ignore-this: 9548eeb3187d9779d4e5c858a0f35354
1096 
1097 In 'choose' (which is a library function designed specifically
1098 to support derived instances of Read), we must match Symbol
1099 as well as Ident, for nullary constructors that (wierdly) are
1100 symbols.
1101]
1102[Fix typo in documentation
1103Simon Hengel <simon.hengel@wiktory.org>**20100711141648
1104 Ignore-this: c052dd8a681832ef598a323ad55eae3a
1105]
1106[Remove duplicated word in documentation
1107Simon Hengel <simon.hengel@wiktory.org>**20100711072703
1108 Ignore-this: fb3732dc57be55f14168792f923433
1109]
1110[Allow nhc98 to cope with recent changes to Control.Exception.
1111Malcolm.Wallace@me.com**20100710170940]
1112[ New asynchronous exception control API (base parts)
1113Simon Marlow <marlowsd@gmail.com>**20100708152735
1114 Ignore-this: 71a4811804f04259f1fe739f8863beaf
1115   
1116 As discussed on the libraries/haskell-cafe mailing lists
1117   http://www.haskell.org/pipermail/libraries/2010-April/013420.html
1118 
1119 This is a replacement for block/unblock in the asychronous exceptions
1120 API to fix a problem whereby a function could unblock asynchronous
1121 exceptions even if called within a blocked context.
1122 
1123 The new terminology is "mask" rather than "block" (to avoid confusion
1124 due to overloaded meanings of the latter).
1125 
1126 The following is the new API; the old API is deprecated but still
1127 available for the time being.
1128 
1129 Control.Exception
1130 -----------------
1131 
1132 mask  :: ((forall a. IO a -> IO a) -> IO b) -> IO b
1133 mask_ :: IO a -> IO a
1134 
1135 uninterruptibleMask :: ((forall a. IO a -> IO a) -> IO b) -> IO b
1136 uninterruptibleMask_ :: IO a -> IO
1137 
1138 getMaskingState :: IO MaskingState
1139 
1140 data MaskingState
1141   = Unmasked
1142   | MaskedInterruptible
1143   | MaskedUninterruptible
1144 
1145 
1146 Control.Concurrent
1147 ------------------
1148 
1149 forkIOUnmasked :: IO () -> IO ThreadId
1150]
1151[Async-exception safety, and avoid space leaks
1152Simon Marlow <marlowsd@gmail.com>**20100708145819
1153 Ignore-this: dbfd0e61551e9e7b4fc1c6fe9b9a83de
1154 Patch submitted by: Bas van Dijk <v.dijk.bas@gmail.com>
1155 Modified slightly by me to remove non-functional changes.
1156]
1157[Async-exception safety, and avoid space leaks
1158Simon Marlow <marlowsd@gmail.com>**20100708103154
1159 Ignore-this: 190c3ac8f6633231624da8cf1316588
1160 Patch submitted by: Bas van Dijk <v.dijk.bas@gmail.com>
1161 Modified slightly by me to remove non-functional changes.
1162]
1163[Fix a few places where we forgot to close the text codecs (#4029)
1164Simon Marlow <marlowsd@gmail.com>**20100702130210
1165 Ignore-this: 2e81a4b4cb343181cef34b0f9e2ded47
1166 Each time you invoke :load in GHCi it resets the CAFs, including
1167 stdin/stdout/stderr, and each of these was allocating a new iconv_t.
1168]
1169[remove docs from Monad that belonged on the instance for MonadPlus IO
1170Simon Marlow <marlowsd@gmail.com>**20100701154203
1171 Ignore-this: 59df02542a7ac9421552a2155d848d27
1172]
1173[docs: unqualify Prelude.IO
1174Simon Marlow <marlowsd@gmail.com>**20100701153817
1175 Ignore-this: 73b0202876c827e7a5b4a5ce74e724c4
1176]
1177[unqualify Float and Double
1178Simon Marlow <marlowsd@gmail.com>**20100701142727
1179 Ignore-this: cbe89d31a00bf49996a33933324fca17
1180]
1181[extract information about Data.Time from docs for CTime
1182Simon Marlow <marlowsd@gmail.com>**20100701142415
1183 Ignore-this: c48c9609b8d36e43e033a7bea81d6f17
1184]
1185[doc typo
1186Simon Marlow <marlowsd@gmail.com>**20100701142354
1187 Ignore-this: 17a1fd703831c888975ff63fbfa3a9b2
1188]
1189[peekArray docs: remove mentions of "this version" and "previous version"
1190Simon Marlow <marlowsd@gmail.com>**20100701125333
1191 Ignore-this: 39a744874258670bd935ba9e38390939
1192]
1193[doc typo
1194Simon Marlow <marlowsd@gmail.com>**20100701124154
1195 Ignore-this: 98f5c286e38c2c34c96b05d5e8bc5ad9
1196]
1197[doc typo
1198Simon Marlow <marlowsd@gmail.com>**20100701124128
1199 Ignore-this: 10a4314ec7aed336701fc616fb574ebc
1200]
1201[doc typo
1202Simon Marlow <marlowsd@gmail.com>**20100701123715
1203 Ignore-this: c4909a7bf7163460ee5d32f58812041e
1204]
1205[doc wibble: Haskell 98 I/O Error -> 'IOError'
1206Simon Marlow <marlowsd@gmail.com>**20100701123612
1207 Ignore-this: bf373df781acbc575e4ffe3b7e6059ae
1208]
1209[doc typo
1210Simon Marlow <marlowsd@gmail.com>**20100701123014
1211 Ignore-this: 16aaccae48ef3101adf78ea5b0d5a8fd
1212]
1213[Haddock hacks to fix whitespace consistency
1214Simon Marlow <marlowsd@gmail.com>**20100701121631
1215 Ignore-this: 61c58dec52a31fd2d3f331a87d2f903f
1216]
1217[use '==' consistently rather than '->' in examples
1218Simon Marlow <marlowsd@gmail.com>**20100701121616
1219 Ignore-this: 472b0a05a85d34d9712186040e1636d9
1220]
1221[doc wibble: remove confusing mention of "Prelude"
1222Simon Marlow <marlowsd@gmail.com>**20100701113308
1223 Ignore-this: 232283d0096d01cd45e9b3c5c1e63a6d
1224]
1225[doc wibble: nonstrict -> non-strict
1226Simon Marlow <marlowsd@gmail.com>**20100701113253
1227 Ignore-this: 4264f0ab23a0835fc13c6e8601d6b743
1228]
1229[doc whitespace
1230Simon Marlow <marlowsd@gmail.com>**20100701112242
1231 Ignore-this: 777a95b1d1140c61d3ab95d5eb5809e7
1232]
1233[move the doc for 'Char' to its new home in ghc-prim:GHC.Types
1234Simon Marlow <marlowsd@gmail.com>**20100629134150
1235 Ignore-this: 7687db0077a29498349bfb4b44983985
1236]
1237[doc wibble
1238Simon Marlow <marlowsd@gmail.com>**20100629122608
1239 Ignore-this: 9a909e5d015332dc445bd9592e6e386d
1240]
1241[doc updates in System.IO
1242Simon Marlow <marlowsd@gmail.com>**20100629122118
1243 Ignore-this: 2257ec1cc4cdb8b7804cfa1f3cf32753
1244]
1245[doc wibble
1246Simon Marlow <marlowsd@gmail.com>**20100625134858
1247 Ignore-this: 64c50f29df6c389273b818918fe7033a
1248]
1249[doc wibbles
1250Simon Marlow <marlowsd@gmail.com>**20100624154614
1251 Ignore-this: b364aad53beea6e741fee2824459b6e8
1252]
1253[Fix haddock formatting
1254Ian Lynagh <igloo@earth.li>**20100625222623]
1255[Give nub's complexity in the haddock docs; fixes #4086
1256Ian Lynagh <igloo@earth.li>**20100625222059]
1257[correct docs for exitWith: only stdout/stderr are flushed, not all Handles
1258Simon Marlow <marlowsd@gmail.com>**20100624130506
1259 Ignore-this: 33a938dad8f0bc061572e2ec571cacc7
1260]
1261[fix docs for isSpace
1262Simon Marlow <marlowsd@gmail.com>**20100624130444
1263 Ignore-this: b35ff080dbb9833176f08e39dbd9ff6d
1264]
1265[make the hGetBuf/hPutBuf family work with non-FD Handles (#4144)
1266Simon Marlow <marlowsd@gmail.com>**20100624130425
1267 Ignore-this: 8200f0208a9b1b1cf4824f343d75819a
1268]
1269[nit in docs for accumArray
1270Simon Marlow <marlowsd@gmail.com>**20100622121131
1271 Ignore-this: c066a456c40907e767df10c3990f35ff
1272]
1273[add doc for the ExitCode type
1274Simon Marlow <marlowsd@gmail.com>**20100622120930
1275 Ignore-this: 99c34332be7f3565da844528b470054a
1276]
1277[remove extraneous info from docs for Array
1278Simon Marlow <marlowsd@gmail.com>**20100622120921
1279 Ignore-this: e2a3f5e84fc23eb7bae911f0680e805e
1280]
1281[add an INLINE to the list version of traverse, to enable fusion
1282Simon Marlow <marlowsd@gmail.com>**20100608082531
1283 Ignore-this: ea98cdc3308b406bb04c0f7a38c4424b
1284]
1285[Don't define the C localeEncoding on Windows
1286Ian Lynagh <igloo@earth.li>**20100620202342
1287 Ignore-this: c4992f6832a391b0cccc5a9b7d643976
1288 (it causes warnings, and isn't used)
1289]
1290[add Applicative instance for Either (proposal #4095)
1291Ross Paterson <ross@soi.city.ac.uk>**20100617225110
1292 Ignore-this: 50262ec4700dc16efec5755be5b308c5
1293 
1294 This is not the only possible instance for Either, but this one is
1295 compatible with the usual Monad instance.
1296]
1297[Use libcharset instead of nl_langinfo(CODESET) if possible.
1298pho@cielonegro.org**20100519013112
1299 Ignore-this: 4c1e278e022a3d276848afc1dcba4425
1300 
1301 nl_langinfo(CODESET) doesn't always return standardized variations of the encoding names. Use libcharset if possible, which is shipped together with GNU libiconv.
1302]
1303[Add a note about the interruptibility of throwTo.
1304Simon Marlow <marlowsd@gmail.com>**20100615112720
1305 Ignore-this: ae9fabe95310d7c364e95f7784793485
1306]
1307[docs: note that hGetBufNonBlocking isn't non-blocking on Windows
1308Simon Marlow <marlowsd@gmail.com>**20100615112547
1309 Ignore-this: 4f3e5213e142149affe08c5123d6efea
1310]
1311[don't depend on Prelude (#4122)
1312Simon Marlow <marlowsd@gmail.com>**20100615105631
1313 Ignore-this: 1a3fd49b103fe31cbb453f302c18767f
1314]
1315[Don't depend on Prelude (#4123)
1316Simon Marlow <marlowsd@gmail.com>**20100615105401
1317 Ignore-this: cc7616d85a1637bc7621b4f2bc181c0e
1318]
1319[bump version to 4.3.0.0, added instance MonadPlus STM
1320Simon Marlow <marlowsd@gmail.com>**20100601144831
1321 Ignore-this: 7c3cf7574499c4267372493f2636dc0
1322]
1323[Moved MonadPlus instance for STM from Control.Monad.STM to GHC.Conc to avoid an orphaned instance
1324Bas van Dijk <v.dijk.bas@gmail.com>**20100516160651
1325 Ignore-this: 651b852942b2fae2b93f996e39239b8f
1326]
1327[Added Applicative and Alternative instances for STM
1328Bas van Dijk <v.dijk.bas@gmail.com>**20100516171756
1329 Ignore-this: 567003bc4040bc97105cda4d31ebf04a
1330]
1331[expand Foldable instance for Array
1332Ross Paterson <ross@soi.city.ac.uk>**20100602212154
1333 Ignore-this: 9bd9e9666a9400431eb92352244fe7e7
1334]
1335[doc comment illustrating Foldable(foldr)
1336Ross Paterson <ross@soi.city.ac.uk>**20100527150833
1337 Ignore-this: 8f27d889379803f3ba86d6e928428f3c
1338]
1339[fix syntax in doc comments
1340Ross Paterson <ross@soi.city.ac.uk>**20100527150757
1341 Ignore-this: cb78da51d60ff6863dc395f1a892c103
1342]
1343[export hGetBufSome (#4046)
1344Simon Marlow <marlowsd@gmail.com>**20100520093538
1345 Ignore-this: f467fad9722e27edfad6b3dd75290e7b
1346]
1347[hWaitForInput: don't try to read from the device (#4078)
1348Simon Marlow <marlowsd@gmail.com>**20100517133741
1349 Ignore-this: 55ec33b03397380259b91e4ca62207a6
1350 readTextDeviceNonBlocking is not non-blocking on Windows
1351]
1352[hSetEncoding: change the encoding on both read and write sides (#4066)
1353Simon Marlow <marlowsd@gmail.com>**20100514124628
1354 Ignore-this: 5b9e9caef06356d0296c584159709ebb
1355]
1356[Correct haddock formatting.
1357Adam Vogt <vogt.adam@gmail.com>**20100423022103
1358 Ignore-this: d2622339302048fda48080f7d5ce4a2f
1359]
1360[Fix for hGetBufSome
1361Simon Marlow <marlowsd@gmail.com>**20100505135637
1362 Ignore-this: 2019680f8fb223956cacfcf0d046f133
1363]
1364[improve the documentation for throwTo and killThread (#3884)
1365Simon Marlow <marlowsd@gmail.com>**20100505135600
1366 Ignore-this: ce881d96ddb729acb6ca09c779975e7d
1367]
1368[elaborate the docs for unsafePerformIO a bit
1369Simon Marlow <marlowsd@gmail.com>**20100505101249
1370 Ignore-this: 1cec3f67560b672c64c5a0dcf9a79eb7
1371]
1372[add Typeable instance
1373Simon Marlow <marlowsd@gmail.com>**20100504152815
1374 Ignore-this: 6d9cf9d62f0ef17fa459bf213a04098
1375]
1376[Add hGetBufSome, like hGetBuf but can return short reads
1377Simon Marlow <marlowsd@gmail.com>**20100504152759
1378 Ignore-this: 195c905b43f8d9505029364e2c5b18e
1379]
1380[Add swap (#3298)
1381Simon Marlow <marlowsd@gmail.com>**20100504095339
1382 Ignore-this: 13b007dc4594ce252997ec6fa0bbd976
1383]
1384[inline allocaArray0, to fix withCString benchmark
1385Simon Marlow <marlowsd@gmail.com>**20100423124729
1386 Ignore-this: 35c96816acc2f3aaf9dd29f7995fa6f0
1387]
1388[raise asynchronous exceptions asynchronously (#3997)
1389Simon Marlow <marlowsd@gmail.com>**20100421094932
1390 Ignore-this: 6d987d93d382c0f69c68c326312abd6b
1391]
1392[add NOINLINE pragmas for stdin/stdout/stderr
1393Simon Marlow <marlowsd@gmail.com>**20100421082041
1394 Ignore-this: 3fc130268ec786f28d945858d6690986
1395]
1396[INLINE alloca and malloc
1397Simon Marlow <marlowsd@gmail.com>**20100419135333
1398 Ignore-this: b218bd611f18721b1505a8c0b9e6a16a
1399 See discussion on glasgow-haskell-users:
1400   http://www.haskell.org/pipermail/glasgow-haskell-users/2010-April/018740.html
1401]
1402[Move comment closer to the offending line
1403Matthias Kilian <kili@outback.escape.de>**20100419155421
1404 Ignore-this: b34a1d7affd66f67d210df2377b585d9
1405]
1406[Ignore the return code of c_fcntl_write again
1407Matthias Kilian <kili@outback.escape.de>**20100415140452
1408 Ignore-this: 266d8ba02cc3cb79c85629b3528261c9
1409 
1410 The return code has been ignored in the past on purpose, because
1411 O_NONBLOCK will fail on BSDs for some special files. This fixes the
1412 problem mentioned in
1413 http://www.haskell.org/pipermail/glasgow-haskell-users/2010-April/018698.html
1414 
1415]
1416[Fix bitrot in IO debugging code
1417Ian Lynagh <igloo@earth.li>**20100413134339
1418 Also switched to using Haskell Bools (rather than CPP) to en/disable it,
1419 so it shouldn't break again in the future.
1420]
1421[Tiny code tidy-up
1422Ian Lynagh <igloo@earth.li>**20100413011147]
1423[remove old/wrong comment
1424Simon Marlow <marlowsd@gmail.com>**20100325161403
1425 Ignore-this: e6e377d44af48c4162d17d55bdf3f821
1426]
1427[withThread: block asynchronous exceptions before installing exception handler.
1428Bas van Dijk <v.dijk.bas@gmail.com>**20100329131624
1429 Ignore-this: be5aeb47dbd73807b5f94df11afbb81c
1430 Note that I don't unblock the given io computation. Because AFAICS
1431 withThread is only called with 'waitFd' which only performs an FFI
1432 call which can't receive asynchronous exceptions anyway.
1433]
1434[runInUnboundThread: block asynchronous exceptions before installing exception handler
1435Bas van Dijk <v.dijk.bas@gmail.com>**20100329131549
1436 Ignore-this: a00c5e32fe3981ff87bedd367a69051e
1437]
1438[fix the deprecation message (GHC.IO.Handle.Base -> GHC.IO.Handle)
1439Simon Marlow <marlowsd@gmail.com>**20100330121137
1440 Ignore-this: 4ca8500a01ac93454507aa8f9dd001f9
1441]
1442[Make SampleVar an abstract newtype
1443Bas van Dijk <v.dijk.bas@gmail.com>**20100318200349
1444 Ignore-this: 27939e2a064b75e71cb146117346be30
1445]
1446[Fix bugs regarding asynchronous exceptions and laziness in Control.Concurrent.SampleVar
1447Bas van Dijk <v.dijk.bas@gmail.com>**20100318200104
1448 Ignore-this: 7376b2a3afe155daf233a8f1ddc0a7a
1449  - Block asynchronous exceptions at the right places
1450  - Force thunks before putting them in a MVar
1451]
1452[Write the thunk 'next' to the MVar
1453Bas van Dijk <v.dijk.bas@gmail.com>**20100319125951
1454 Ignore-this: dd25636cf220131385ff2fd32493d456
1455]
1456[change to use STM, fixing 4 things
1457Simon Marlow <marlowsd@gmail.com>**20100318104436
1458 Ignore-this: 551d30280a7941c08f5c3b14576bdd70
1459   1. there was no async exception protection
1460   2. there was a space leak (now new value is strict)
1461   3. using atomicModifyIORef would be slightly quicker, but can
1462      suffer from adverse scheduling issues (see #3838)
1463   4. also, the STM version is faster.
1464]
1465[Tweak docs
1466Ian Lynagh <igloo@earth.li>**20100312214129]
1467[Fixed dead links in documentation of forkIO
1468Bas van Dijk <v.dijk.bas@gmail.com>**20100308222415
1469 Ignore-this: 7deb8fd064c867fbede2a6b2e9da4f15
1470]
1471[Documentation fixes in Control.Exception
1472Bas van Dijk <v.dijk.bas@gmail.com>**20100301220442
1473 Ignore-this: 761fcba401cbd1f47276ddfc9b5b80f2
1474]
1475[Plug two race conditions that could lead to deadlocks in the IO manager
1476Simon Marlow <marlowsd@gmail.com>**20100225120255
1477 Ignore-this: e6983d6b953104d370278ab3e4617e8b
1478]
1479[FIX #3866: improve documentation of Data.Data.Constr
1480jpm@cs.uu.nl**20100224125506
1481 Ignore-this: 3818c5d8fee012a3cf322fb455b6e5dc
1482]
1483[UNDO: Handle NaN, -Infinity and Infinity in the toRational for Float/Double (#3676)
1484Simon Marlow <marlowsd@gmail.com>**20100223101603
1485 Ignore-this: 78becb2d39b3cd9a1a473a5811ca7d92
1486]
1487[Put the complexity in the length docs. Fixes trac #3680
1488Ian Lynagh <igloo@earth.li>**20100221191425]
1489[nhc98 should build Data.Functor.
1490Malcolm.Wallace@cs.york.ac.uk**20100221163218]
1491[Update the exitWith docs
1492Ian Lynagh <igloo@earth.li>**20100213140004
1493 Error pointed out by Volker Wysk <vw@volker-wysk.de>
1494]
1495[Handle NaN, -Infinity and Infinity in the toRational for Float/Double (#3676)
1496Simon Marlow <marlowsd@gmail.com>**20100211101955
1497 Ignore-this: 261415363303efca265e80290eac5f28
1498]
1499[For nhc98, import unsafeInterleaveIO rather than defining it here.
1500Malcolm.Wallace@cs.york.ac.uk**20100204171021]
1501[Stifle warning about unused return value
1502benl@cse.unsw.edu.au**20100203025537]
1503[fix #3832: use the locale encoding in openTempFile
1504Simon Marlow <marlowsd@gmail.com>**20100120211830
1505 Ignore-this: df4f778cc5fefb32290c798db722632c
1506 Also while I was here fix an XXX: the Handle contained an
1507 uninformative string like <fd: 4> for error messages rather than the
1508 real file path.
1509]
1510[Fix the build: export void, so it doesn't give an unused binding warning
1511Ian Lynagh <igloo@earth.li>**20100116174451]
1512[hIsEOF: don't do any decoding (#3808)
1513Simon Marlow <marlowsd@gmail.com>**20100112230317
1514 Ignore-this: 6a384dd2d547ffe3ad3762920e5c1671
1515]
1516[Control.Monad: +void :: f a -> f ()
1517gwern0@gmail.com**20100108214455
1518 Ignore-this: 4dc07452315f2d1b4941903ff42fc45f
1519 See http://hackage.haskell.org/trac/ghc/ticket/3292
1520 Turns m a -> m (). Lets one call functions for their side-effects without
1521 having to get rid of their return values with '>> return ()'. Very useful
1522 in many contexts (parsing, IO etc.); particularly good for 'forkIO' and 'forM_',
1523 as they demand return types of 'IO ()' though most interesting IO functions
1524 return non-().
1525]
1526[Replace the implementation of mergesort with a 2x faster one.
1527Malcolm.Wallace@cs.york.ac.uk**20091224152014
1528 See ticket http://hackage.haskell.org/trac/ghc/ticket/2143.
1529]
1530[Restore previous Data.Typeable.typeOf*Default implementations for non-ghc.
1531Malcolm.Wallace@cs.york.ac.uk**20091223142625
1532 Not all compilers have ScopedTypeVariables.
1533]
1534[Add comments about double bounds-checking, and fast paths for rectangular arrays
1535simonpj@microsoft.com**20091218165655
1536 Ignore-this: ea0849419dc00927aba4bd410b1cc58d
1537 
1538 See Note [Double bounds-checking of index values] for the details.
1539 
1540 The fast paths omit the doubled checks for cases we know about
1541]
1542[Fix Trac #3245: memoising typeOf
1543simonpj@microsoft.com**20091218155117
1544 Ignore-this: 5a178a7f2222293c5ee0c3c43bd1b625
1545 
1546 The performance bug in #3245 was caused by computing the typeRep
1547 once for each call of typeOf, rather than once for each dictionary
1548 contruction.  (Computing TypeReps is reasonably expensive, because
1549 of the hash-consing machinery.)
1550 
1551 This is readily fixed by putting the TypeRep construction outside
1552 the lambda.  (Arguably GHC might have worked that out itself,
1553 but it involves floating something between a type lambda and a
1554 value lambda, which GHC doesn't currently do. If it happens a lot
1555 we could fix that.)
1556]
1557[Mark 'index' as INLINE in GHC.Arr
1558simonpj@microsoft.com**20091216170441
1559 Ignore-this: a4df9d8acf496c8e0e9ce5a520509a2a
1560 
1561 This makes indexing much faster. See Trac #1216
1562]
1563[Comment the remaining orphan instance modules
1564Ian Lynagh <igloo@earth.li>**20091206125021]
1565[De-orphan Eq/Ord Float/Double
1566Ian Lynagh <igloo@earth.li>**20091205181238]
1567[Add comments to "OPTIONS_GHC -fno-warn-orphans" pragmas
1568Ian Lynagh <igloo@earth.li>**20091205165854]
1569[Data.Either.partitionEithers was insufficiently lazy.
1570Malcolm.Wallace@cs.york.ac.uk**20091202032807
1571 Ignore-this: 77e1b3288f66608c71458d8a91bcbe12
1572 Spotted by Daniel Fischer.
1573]
1574[fix the docs regarding finalizer guarantees
1575Simon Marlow <marlowsd@gmail.com>**20091130144409
1576 Ignore-this: d1ab9532c74a002b8075ff60febcbe2d
1577]
1578[x86_64 requires more stack
1579Malcolm.Wallace@cs.york.ac.uk**20091201033745]
1580[check for size < 0 in mallocForeignPtrBytes and friends (#3514)
1581Simon Marlow <marlowsd@gmail.com>**20091125143822
1582 Ignore-this: 91077d01da2bbe1dfed5155e8b40da9
1583]
1584[hGetContents: close the handle properly on error
1585Simon Marlow <marlowsd@gmail.com>**20091125123435
1586 Ignore-this: bc37ff678acc6e547dc390285e056eb9
1587 
1588 When hGetContents caught an error it was closing the handle and then
1589 throwing the exception, without updating the handle with the new
1590 closed state.  This lead to a double-closed, which was the cause of
1591 
1592 *** glibc detected *** ./Setup: double free or corruption
1593 
1594 when iconv_close was called twice on the decoder.
1595 
1596 See http://hackage.haskell.org/trac/hackage/ticket/609
1597]
1598[Fix arities of mapFB and zipFB
1599Roman Leshchinskiy <rl@cse.unsw.edu.au>**20091126232219
1600 Ignore-this: c4e14cd0a92622549c86e67237a40865
1601]
1602[Remove an unnecessary -fno-warn-orphans flag
1603Ian Lynagh <igloo@earth.li>**20091126123404]
1604[Tweak layout to work with alternative layout rule
1605Ian Lynagh <igloo@earth.li>**20091125232349]
1606[Tweak layout to be accepted by the alternative layout rul
1607Ian Lynagh <igloo@earth.li>**20091125194147]
1608[Make sure zipWithFB has arity 2
1609Roman Leshchinskiy <rl@cse.unsw.edu.au>**20091125010003
1610 Ignore-this: 4cf60c55666f03d22a9f5a6e07f52d36
1611 
1612 It gets 2 arguments in the "zipWith" rule but its arity was higher and the new
1613 inliner didn't inline it sometimes, for instance here:
1614 
1615 mpp ::  [Double] -> [Double] -> [Double] -> [Double] -> [Double]
1616 mpp as bs cs ds = zipWith (*) (zipWith (+) as bs) (zipWith (+) cs ds)
1617 
1618 This was a regression vs. 6.10.
1619]
1620[Remove an old comment
1621Ian Lynagh <igloo@earth.li>**20091124134647]
1622[De-orphan the Eq/Ord Integer instances
1623Ian Lynagh <igloo@earth.li>**20091124133639]
1624[Whitespace only
1625Ian Lynagh <igloo@earth.li>**20091124133421]
1626[Derive some more instances, rather than writing them by hand
1627Ian Lynagh <igloo@earth.li>**20091124011747]
1628[We can now derive Ord ()
1629Ian Lynagh <igloo@earth.li>**20091124011416]
1630[De-orphan tuple Eq/Ord instances
1631Ian Lynagh <igloo@earth.li>**20091123233343]
1632[Control.Exception.Base no longer has any orphans
1633Ian Lynagh <igloo@earth.li>**20091123224905]
1634[De-orphan the MonadFix ST instance for GHC
1635Ian Lynagh <igloo@earth.li>**20091123223544]
1636[Rearrange the contents of Control.Monad.ST; no functionality changes
1637Ian Lynagh <igloo@earth.li>**20091123222702]
1638[De-orphan the Eq/Ord [a] instances
1639Ian Lynagh <igloo@earth.li>**20091123215635]
1640[De-orphan the Eq/Ord Char instances
1641Ian Lynagh <igloo@earth.li>**20091123202253]
1642[De-orphan the Eq/Ord Bool instances
1643Ian Lynagh <igloo@earth.li>**20091123201817]
1644[Move Eq/Ord Ordering instances to de-orphan them
1645Ian Lynagh <igloo@earth.li>**20091123194310]
1646[Remove ffi warnings for nhc98.
1647Malcolm.Wallace@cs.york.ac.uk**20091123063743]
1648[Second attempt to fix #1185 (forkProcess and -threaded)
1649Simon Marlow <marlowsd@gmail.com>**20091111151915
1650 Ignore-this: fa5f5d5e4e080d4b612a37244f937f9c
1651 
1652 Patch 2/2: first patch is to ghc
1653 
1654 This time without dynamic linker hacks, instead I've expanded the
1655 existing rts/Globals.c to cache more CAFs, specifically those in
1656 GHC.Conc.  We were already using this trick for signal handlers, I
1657 should have realised before.
1658 
1659 It's still quite unsavoury, but we can do away with rts/Globals.c in
1660 the future when we switch to a dynamically-linked GHCi.
1661]
1662[Rollback #1185 fix
1663Simon Marlow <marlowsd@gmail.com>**20091106140629
1664 Ignore-this: cd5667e8474e37e01ba26a1984274811
1665 
1666 rolling back:
1667 
1668 Tue Nov  3 16:05:40 GMT 2009  Simon Marlow <marlowsd@gmail.com>
1669   * Fix #1185: restart the IO manager after fork()
1670   
1671   This is the libraries/base part of the patch; there is a corresponding
1672   patch to GHC itself.
1673   
1674   The main change is that we now keep track of the IO manager's ThreadId
1675   in a top-level MVar, and ensureIOManagerIsRunning checks whether a
1676   previous IO manager thread is alive before starting one.  In the child
1677   of fork(), we can hence call ensureIOManagerIsRunning to restart the
1678   IO manager.
1679 
1680     M ./GHC/Conc.lhs -46 +44
1681 
1682 Wed Nov  4 17:49:45 GMT 2009  Ian Lynagh <igloo@earth.li>
1683   * Fix the build on Windows
1684 
1685     M ./GHC/Conc.lhs -6 +4
1686]
1687[Fix the build on Windows
1688Ian Lynagh <igloo@earth.li>**20091104174945]
1689[Fix #1185: restart the IO manager after fork()
1690Simon Marlow <marlowsd@gmail.com>**20091103160540
1691 Ignore-this: 6dc05464f1500104554637f4759738cc
1692 
1693 This is the libraries/base part of the patch; there is a corresponding
1694 patch to GHC itself.
1695 
1696 The main change is that we now keep track of the IO manager's ThreadId
1697 in a top-level MVar, and ensureIOManagerIsRunning checks whether a
1698 previous IO manager thread is alive before starting one.  In the child
1699 of fork(), we can hence call ensureIOManagerIsRunning to restart the
1700 IO manager.
1701]
1702[improve the documentation for throwErrnoIfRetry
1703Simon Marlow <marlowsd@gmail.com>**20091016112404
1704 Ignore-this: b77275cacf730e15757946027168f63e
1705]
1706[Don't inline unpackFoldrCString ever
1707simonpj@microsoft.com**20091029135350
1708 Ignore-this: 85d672649b1b776efc7e97500b05d4f9
1709]
1710[Inline more default methods
1711simonpj@microsoft.com**20091029135330
1712 Ignore-this: 289c44b0afd6d5631c2a4e0664275ca9
1713 
1714 Namely Monad: (>>)
1715        Eq:    (==), (/=)
1716        Num:   (-), negate
1717        Real:  quot, rem, div, mod, recip, (/), truncate
1718        Float: (**), logBase, sqrt, tan, tanh
1719]
1720[Move error messages out of INLINEd default methods
1721simonpj@microsoft.com**20091029135118
1722 Ignore-this: 9e35dc947f94827a3529eb53a41575fd
1723 
1724 No need to duplicate the error generation!
1725]
1726[Exploit now-working default-method INLINE pragmas for Data.Bits
1727simonpj@microsoft.com**20091029135041
1728 Ignore-this: 8adf225f31ca7a3181ee087e9e4fe535
1729 
1730 * Add INLINE pragmas to default methods for class Bits
1731 
1732 * Remove redundant instance methods elsewhere, now that
1733   the default method will do the job
1734]
1735[Tidy up and comment imports
1736simonpj@microsoft.com**20091029134414
1737 Ignore-this: bf2be31035de975d8995e988933cc940
1738]
1739[Inline foldr and (.) when applied to two arguments not three
1740simonpj@microsoft.com**20091029134335
1741 Ignore-this: fccb6f3e90e15f44cb465814be85ede2
1742 
1743 The new INLINE story is (by design) arity-sensitive, so we must
1744 put fewer argument on the LHS for foldr and (.)
1745]
1746[dirUtils.c no longer available
1747Malcolm.Wallace@cs.york.ac.uk**20091013093833]
1748[Make hGetContents throw an exception if an error is encountered
1749Simon Marlow <marlowsd@gmail.com>**20091012152955
1750 Ignore-this: 9f7a7176193eab25c9daaacd9261f2de
1751 
1752 Strictly speaking this breaks Haskell 98 compatibility, which requires
1753 hGetContents to just end the lazy stream silently if an error is
1754 encountered.  However, for a few reasons we think it will make
1755 everyone's life a bit easier if we make this change
1756 
1757  1. Errors will be a lot more common in GHC 6.12.1, in the form
1758     of Unicode decoding errors.
1759 
1760  2. When Haskell 98 was designed, we didn't know how to throw
1761     exceptions from inside lazy I/O, but now we do.
1762 
1763  3. If anyone is actually relying on the previous behaviour, their
1764     code is arguably broken.
1765]
1766[Re-instate System.Console.Getopt for nhc98 builds.
1767Malcolm.Wallace@cs.york.ac.uk**20091013092843
1768 Although it was split out of base a while back, that change was
1769 reverted for ghc soon afterwards, but nhc98 never noticed.
1770]
1771[Roll back "Another instance of nhc98's strange import semantics."
1772Ian Lynagh <igloo@earth.li>**20091009185618
1773 Fri Oct  9 14:50:51 BST 2009  Malcolm.Wallace@cs.york.ac.uk
1774 GHC (correctly) warns about the unused import, which breaks the validate
1775 build.
1776]
1777[Roll back "Cope with nhc98's (occasionally-strange) import semantics"
1778Ian Lynagh <igloo@earth.li>**20091009184704
1779 Fri Oct  9 14:43:51 BST 2009  Malcolm.Wallace@cs.york.ac.uk
1780 GHC (correctly) warns about the unused import, which breaks the validate
1781 build.
1782]
1783[It seems that nhc98 needs defaulting in Data.Fixed.
1784Malcolm.Wallace@cs.york.ac.uk**20091009135242]
1785[Another instance of nhc98's strange import semantics.
1786Malcolm.Wallace@cs.york.ac.uk**20091009135051]
1787[Make Data.Functor compatible with non-GHC compilers.
1788Malcolm.Wallace@cs.york.ac.uk**20091009134821]
1789[Cope with nhc98's (occasionally-strange) import semantics.
1790Malcolm.Wallace@cs.york.ac.uk**20091009134351]
1791[Fix gratuitous breakage of nhc98 in System.IO.
1792Malcolm.Wallace@cs.york.ac.uk**20091009134001]
1793[Fix gratuitous breakage of nhc98 in Control.Exception.Base.
1794Malcolm.Wallace@cs.york.ac.uk**20091009133615]
1795[Fix gratuitous breakage of non-GHC in Data.Fixed.
1796Malcolm.Wallace@cs.york.ac.uk**20091009133330]
1797[Fix gratuitous breakage for non-GHC in Data.Bits.
1798Malcolm.Wallace@cs.york.ac.uk**20091009133257]
1799[Use UTF-32LE instead of UTF32LE
1800Simon Marlow <marlowsd@gmail.com>**20091006100207
1801 Ignore-this: 7f881e36543d250ef848c9f60d67655a
1802 The latter is not recognised by some iconv implementations.
1803]
1804[Strip any Byte Order Mark (BOM) from the front of decoded streams.
1805Ben.Lippmeier@anu.edu.au*-20090930084229
1806 Ignore-this: d0d0c3ae87b31d71ef1627c8e1786445
1807 When decoding to UTF-32, Solaris iconv inserts a BOM at the front
1808 of the stream, but Linux iconv doesn't.
1809]
1810[use UTF32BE/UTF32LE instead of UCS-4/UCS-4LE
1811Simon Marlow <marlowsd@gmail.com>**20091005101554
1812 Ignore-this: 2aef5e9bec421e714953b7aa1bdfc1b3
1813]
1814[Strip any Byte Order Mark (BOM) from the front of decoded streams.
1815Ben.Lippmeier@anu.edu.au**20090930084229
1816 Ignore-this: d0d0c3ae87b31d71ef1627c8e1786445
1817 When decoding to UTF-32, Solaris iconv inserts a BOM at the front
1818 of the stream, but Linux iconv doesn't.
1819]
1820[Add traceEvent :: String -> IO ()
1821Simon Marlow <marlowsd@gmail.com>**20090925141257
1822 Ignore-this: 8b1888bbf9682ffba13f815b6000e4b1
1823 For emitting an event via the RTS tracing framework
1824]
1825[Fix the error message when flushing the read buffer of a non-seekable Handle
1826Simon Marlow <marlowsd@gmail.com>**20090923090536
1827 Ignore-this: 4342026df93759d99480f4e13f80a492
1828]
1829[Fix #3534: No need to flush the byte buffer when setting binary mode
1830Simon Marlow <marlowsd@gmail.com>**20090923090445
1831 Ignore-this: 625817ed7ae2c12291eb993a99dc640a
1832]
1833[Use let !y = x in .. x .. instead of seq in $! and evaluate (#2273)
1834Simon Marlow <marlowsd@gmail.com>**20090916140454]
1835[make some Applicative functions into methods, and split off Data.Functor (proposal #3335)
1836Ross Paterson <ross@soi.city.ac.uk>**20090915173109
1837 Ignore-this: a0cff4de6dfdbcbd56a66101bc4855a9
1838 
1839 The following functions
1840 
1841     (<$) :: Functor f => a -> f b -> f a
1842     (*>) :: Applicative f => f a -> f b -> f b
1843     (<*) :: Applicative f => f a -> f b -> f a
1844     some :: Alternative f => f a -> f [a]
1845     many :: Alternative f => f a -> f [a]
1846 
1847 are moved into the corresponding classes, with the existing implementations
1848 as default definitions.  This gives people creating instances the option of
1849 defining specialized implementations of these functions, though they should
1850 be equivalent to the default definitions.
1851 
1852 Although (<$) is now a method of the Functor class, it is hidden in the
1853 re-export by the Prelude, Control.Monad and Monad.  The new module
1854 Data.Functor exposes the full class, plus the function (<$>).  These are
1855 also re-exported by Control.Applicative.
1856]
1857[On Windows, use the console code page for text file encoding/decoding.
1858Judah Jacobson <judah.jacobson@gmail.com>**20090913022126
1859 Ignore-this: 86c2f2db8ef92b751599795d3195187b
1860 
1861 We keep all of the code page tables in the module
1862 GHC.IO.Encoding.CodePage.Table.  That file was generated automatically
1863 by running codepages/MakeTable.hs; more details are in the comments at the
1864 start of that script.
1865 
1866 Storing the lookup tables adds about 40KB to each statically linked executable;
1867 this only increases the size of a "hello world" program by about 7%.
1868 
1869 Currently we do not support double-byte encodings (Chinese/Japanese/Korean), since
1870 including those codepages would increase the table size to 400KB.  It will be
1871 straightforward to implement them once the work on library DLLs is finished.
1872]
1873[Fix "init" docs: the input list need not be finite. Fixes trac #3465
1874Ian Lynagh <igloo@earth.li>**20090911210437]
1875[Bump base version to 4.2.0.0
1876Ian Lynagh <igloo@earth.li>**20090911153913]
1877[Address #3310
1878Simon Marlow <marlowsd@gmail.com>**20090830152850
1879 Ignore-this: 40c7f7c171ee299a83092fd360a952b7
1880 
1881  - Rename BlockedOnDeadMVar   -> BlockedIndefinitelyOnMVar
1882  - Rename BlockedIndefinitely -> BlockedIndefinitelyOnSTM
1883  - instance Show BlockedIndefinitelyOnMVar is now
1884      "blocked indefinitely in an MVar operation"
1885  - instance Show BlockedIndefinitelyOnSTM is now
1886      "blocked indefinitely in an STM transaction"
1887 
1888 clients using Control.OldException will be unaffected (the new
1889 exceptions are mapped to the old names).  However, for base4-compat
1890 we'll need to make a version of catch/try that does a similar
1891 mapping.
1892]
1893[Fix unicode conversion for MSB architectures
1894Ben.Lippmeier@anu.edu.au**20090830130028
1895 This fixes the SPARC/Solaris build.
1896]
1897[Fix #3441: detect errors in partial sequences
1898Simon Marlow <marlowsd@gmail.com>**20090830075909
1899 Ignore-this: d12a75d95e0cae5eb1555266810ec281
1900]
1901[Fix hWaitForInput
1902Simon Marlow <marlowsd@gmail.com>**20090827152116
1903 Ignore-this: 2550e911f1a4d4357a5aa8d1764238ce
1904 It was erroneously waiting when there were bytes to decode waiting in
1905 the byte buffer.
1906]
1907[fix debugging code
1908Simon Marlow <marlowsd@gmail.com>**20090827150628
1909 Ignore-this: e1c82fdc19a22e247cd69ff6fa11921d
1910]
1911[Allow for configurable iconv include and library locations.
1912Matthias Kilian <kili@outback.escape.de>**20090826154406
1913 Ignore-this: be95fab611a5534cf184b508964ed498
1914 This should help to fix the build on OpenBSD.
1915]
1916[typo in comment
1917Simon Marlow <marlowsd@gmail.com>**20090826085252
1918 Ignore-this: 1903ee0f354157a6ed3871c100f6b1b9
1919]
1920[un-hide some modules from the Haddock docs
1921Simon Marlow <marlowsd@gmail.com>**20090825152457
1922 Ignore-this: dce6606f93cf977fb24ebe99082dfa62
1923]
1924[Apply fix for #1548, from squadette@gmail.com
1925Simon Marlow <marlowsd@gmail.com>**20090819120700
1926 Ignore-this: 31c237c46a6445f588ed4b8c51bb6231
1927]
1928[improvements to Data.Fixed: instances for Typeable and Data, more predefined types
1929Ashley Yakeley <ashley@semantic.org>**20090812055058
1930 Ignore-this: feeece36d5632f02a05d137d2a39ab78
1931]
1932[Fix "Cabal check" warnings
1933Ian Lynagh <igloo@earth.li>**20090811215856]
1934[Add a GHC.Constants module; fixes trac #3094
1935Ian Lynagh <igloo@earth.li>**20090809183252]
1936[Apply proposal #3393
1937Ian Lynagh <igloo@earth.li>**20090809134717
1938 Add openTempFileWithDefaultPermissions and
1939 openBinaryTempFileWithDefaultPermissions.
1940]
1941[Add some more C wrappers; patch from Krister Walfridsson
1942Ian Lynagh <igloo@earth.li>**20090807200631
1943 Fixes 21 testsuite errors on NetBSD 5.99.
1944]
1945[Fixing configure for autoconf 2.64
1946Alexander Dunlap <alexander.dunlap@gmail.com>**20090805060748
1947 Ignore-this: 992ab91ae3d68c12dbb265776e33e243
1948]
1949[add INLINE toList
1950Ross Paterson <ross@soi.city.ac.uk>**20090806142853
1951 Ignore-this: aba16aabb17d5dca44f15d188945680e
1952 
1953 In anticipation of the fixing of #2353.
1954]
1955[fix a copyright
1956Simon Marlow <marlowsd@gmail.com>**20090805134045
1957 Ignore-this: b0ffbdd38fbba121e8bcba37c4082a60
1958]
1959[Tweak the BufferedIO class to enable a memory-mapped file implementation
1960Simon Marlow <marlowsd@gmail.com>**20090805134036
1961 Ignore-this: ec67d7a0a6d977438deaa342503f77e0
1962 We have to eliminate the assumption that an empty write buffer can be
1963 constructed by setting the buffer pointers to zero: this isn't
1964 necessarily the case when the buffer corresponds to a memory-mapped
1965 file, or other in-memory device implementation.
1966]
1967[Deprecate Control.OldException
1968Ian Lynagh <igloo@earth.li>**20090804143910]
1969[Windows build fix, following RTS tidyup
1970Simon Marlow <marlowsd@gmail.com>**20090803131121
1971 Ignore-this: ce862fb91c2b234211a8757f98690778
1972]
1973[Updates to follow the RTS tidyup
1974Simon Marlow <marlowsd@gmail.com>**20090801220743
1975 Ignore-this: 6e92412df93a66c12d75344053d5634
1976 C functions like isDoubleNaN moved here (primFloat.c)
1977]
1978[Add integer-simple as a build option
1979Ian Lynagh <igloo@earth.li>**20090722013151]
1980[Use shift[LR]Integer in the Bits Integer instance
1981Ian Lynagh <igloo@earth.li>**20090721222440]
1982[depend directly on integer-gmp, rather than indirecting through integer
1983Ian Lynagh <igloo@earth.li>**20090721185228]
1984[Move the instances of Functor and Monad IO to GHC.Base, to avoid orphans
1985Simon Marlow <marlowsd@gmail.com>**20090722102130
1986 Ignore-this: a7d85ac0025d559674249de0108dbcf4
1987]
1988[move "instance Exception Dynamic" so it isn't an orphan
1989Simon Marlow <marlowsd@gmail.com>**20090721093854
1990 Ignore-this: 5ede91ecfec2112c91b699d4de87cd02
1991]
1992[Improve the index checking for array accesses; fixes #2120 #2669
1993Ian Lynagh <igloo@earth.li>**20090719153228
1994 As well as checking that offset we are reading is actually inside the
1995 array, we now also check that it is "in range" as defined by the Ix
1996 instance. This fixes confusing behaviour (#2120) and improves some error
1997 messages (#2669).
1998]
1999[Make chr say what its argument was, if it's a bad argument
2000Ian Lynagh <igloo@earth.li>**20090718151049]
2001[remove unused warning
2002Simon Marlow <marlowsd@gmail.com>**20090715124416
2003 Ignore-this: 31f613654089d0f4a44363946087b41e
2004]
2005[warning fix: -fno-implicit-prelude -> -XNoImplicitPrelude
2006Simon Marlow <marlowsd@gmail.com>**20090715122839
2007 Ignore-this: dc8957249731d5bcb71c01899e5adf2b
2008]
2009[Add hGetEncoding :: Handle -> IO (Maybe TextEncoding)
2010Simon Marlow <marlowsd@gmail.com>**20090715122519
2011 Ignore-this: 14c3eff996db062da1199739781e4708
2012 as suggested during the discussion on the libraries list
2013]
2014[Add more documentation to mkTextEncoding
2015Simon Marlow <marlowsd@gmail.com>**20090715122414
2016 Ignore-this: 97253b2624267df3a246a18121e8ea81
2017 noting that "//IGNORE" and "//TRANSLIT" suffixes can be used with GNU
2018 iconv.
2019]
2020[Add the utf8_bom codec
2021Simon Marlow <marlowsd@gmail.com>**20090715122257
2022 Ignore-this: 1c9396cd805201fe873a39382ced79c7
2023 as suggested during the discussion on the libraries list.
2024]
2025[Export Unicode and newline functionality from System.IO; update Haddock docs
2026Simon Marlow <marlowsd@gmail.com>**20090713113104
2027 Ignore-this: c3f017a555335aa55d106253393f72e2
2028]
2029[add a comment about the non-workingness of CHARBUF_UTF16
2030Simon Marlow <marlowsd@gmail.com>**20090707124406
2031 Ignore-this: 98d00411b68d688b3b4cffc9507b1f35
2032]
2033[Fix build on Windows
2034Ian Lynagh <igloo@earth.li>**20090711004351]
2035[Fix some "warn-unused-do-bind" warnings where we want to ignore the value
2036Ian Lynagh <igloo@earth.li>**20090710204513]
2037[Use throwErrnoIfMinus1_ when calling getrusage
2038Ian Lynagh <igloo@earth.li>**20090710204221]
2039[Remove an unused import
2040Ian Lynagh <igloo@earth.li>**20090710153345]
2041[reportStackOverflow now returns IO ()
2042Ian Lynagh <igloo@earth.li>**20090710153257
2043 It used to do "return undefined" to return IO a.
2044]
2045[GHC.Conc.reportError now returns IO ()
2046Ian Lynagh <igloo@earth.li>**20090710152646
2047 It used to return IO a, by "return undefined".
2048]
2049[Fix some "warn-unused-do-bind" warnings where we want to ignore the value
2050Ian Lynagh <igloo@earth.li>**20090710152526]
2051[Minor SampleVar refactoring
2052Ian Lynagh <igloo@earth.li>**20090710151438]
2053[Fix "warn-unused-do-bind" warnings in GHC/IO/Handle/Text.hs
2054Ian Lynagh <igloo@earth.li>**20090710122905]
2055[Fix some "warn-unused-do-bind" warnings where we just want to ignore the result
2056Ian Lynagh <igloo@earth.li>**20090710005638]
2057[Use the result of writeCharBuf in GHC/IO/Encoding/Latin1.hs too
2058Ian Lynagh <igloo@earth.li>**20090710004032]
2059[Minor code tidyups in GHC.Conc
2060Ian Lynagh <igloo@earth.li>**20090710003801]
2061[Fix "warn-unused-do-bind" warning in GHC.Conc
2062Ian Lynagh <igloo@earth.li>**20090710003530
2063 If we fail to communicate with the IO manager then we print a warning
2064 using debugErrLn from the ghc-prim package.
2065]
2066[Fix "warn-unused-do-bind" warnings in System.Posix.Internals
2067Ian Lynagh <igloo@earth.li>**20090709164546]
2068[Fix "warn-unused-do-bind" warnings where we really do want to ignore the result
2069Ian Lynagh <igloo@earth.li>**20090709163912]
2070[Add back imports needed on Windows
2071Ian Lynagh <igloo@earth.li>**20090707181924]
2072[Remove unused imports
2073Ian Lynagh <igloo@earth.li>**20090707115810]
2074[Remove unused imports from base
2075simonpj@microsoft.com**20090706111842
2076 Ignore-this: f9b5f353e3bb820f787c56d615b28765
2077 
2078 These unused imports are detected by the new unused-import code
2079 
2080]
2081[Use the result of writeCharBuf
2082Simon Marlow <marlowsd@gmail.com>**20090706133303
2083 Ignore-this: 52288dd559bf4c4f313df6197091d935
2084   
2085 This only makes a difference when CHARBUF_UTF16 is in use, which it
2086 normally isn't.  I suspect CHARBUF_UTF16 doesn't currently work for
2087 other reasons (CHARBUF_UTF16 was an experiment before I wrote the
2088 GHC.IO.Encoding.UTF* codecs), but this patch at least makes it
2089 slightly closer to working.
2090]
2091[Remove some cruft from Data.HashTable
2092Ian Lynagh <igloo@earth.li>**20090706181630]
2093[Add 'eof' to Text.ParserCombinators.ReadP
2094simonpj@microsoft.com**20090706111801
2095 Ignore-this: 2aea7b848e00c894761bc4011adaa95d
2096 
2097 Add a ReadP parser that succeeds at the end of input. Very useful!
2098 
2099]
2100[Don't export CLDouble for GHC; fixes trac #2793
2101Ian Lynagh <igloo@earth.li>**20090705155120
2102 We never really supported CLDouble (it was a plain old double underneath),
2103 and pretending that we do does more harm than good.
2104]
2105[a byte between 0x80 and 0xBF is illegal immediately (#3341)
2106Simon Marlow <marlowsd@gmail.com>**20090702081415
2107 Ignore-this: dc19ef59a1a21118d5a7dd38aa2f611c
2108]
2109[avoid a warning
2110Simon Marlow <marlowsd@gmail.com>**20090630084134
2111 Ignore-this: c92a45ee216faf01327feae9fe06d6e2
2112]
2113[Add a wrapper for libiconv.
2114Matthias Kilian <kili@outback.escape.de>**20090629183634
2115 Ignore-this: 23c6047c0d71b745b495cc223574a47f
2116]
2117[#include <sys/times.h> if we have it (should fix build problems)
2118Simon Marlow <marlowsd@gmail.com>**20090629085351
2119 Ignore-this: a35e93b37ca9595c73460243180f4b9d
2120]
2121[set binary mode for existing FDs on Windows (fixes some GHCi test failures)
2122Simon Marlow <marlowsd@gmail.com>**20090626120522
2123 Ignore-this: 580cf636e9c77d8427aff6861d089481
2124]
2125[Move directory-related stuff to the unix package
2126Simon Marlow <marlowsd@gmail.com>**20090625120325
2127 Ignore-this: b997b3cbce0a46ca87ad825bbdc0a411
2128 now that it isn't used on Windows any more.
2129]
2130[TAG 2009-06-25
2131Ian Lynagh <igloo@earth.li>**20090625160056]
2132Patch bundle hash:
213353f1b830cac56109b52409dc3c0b14eb78d3908b