Ticket #2271: nextRealFrac.dpatch

File nextRealFrac.dpatch, 75.6 KB (added by daniel.is.fischer, 4 years ago)

patch avoiding negative zero

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