Mon Dec 22 17:57:36 GMT 2008  tora@zonetora.co.uk
  * Stack library for explicit call stack transform

New patches:

[Stack library for explicit call stack transform
tora@zonetora.co.uk**20081222175736] {
adddir ./GHC/ExplicitCallStack
addfile ./GHC/ExplicitCallStack/Stack.hs
hunk ./GHC/ExplicitCallStack/Stack.hs 1
+{-# LANGUAGE BangPatterns, ScopedTypeVariables #-}
+{-# OPTIONS -fno-warn-name-shadowing #-}
+module GHC.ExplicitCallStack.Stack
+( throwStack
+, pushStack
+, emptyStack
+, StackElement()
+, Stack()
+, mkKnownStackElem
+, mkUnknownStackElem
+) where
+
+import Control.Exception
+import Control.Monad
+import Control.Concurrent.MVar
+import Data.HashTable (HashTable)
+import Data.Int
+import Data.Unique
+import GHC.Base
+import GHC.Show
+import Data.Maybe
+import qualified Data.HashTable as HashTable
+import System.IO.Unsafe
+
+hashSE :: StackElement -> Int32
+hashSE = fromIntegral . f . elementID
+  where
+    f (SEID x y) = x + 0xdeadbeef * y
+{- Invariant, each StackElement occurs at most once in the Stack -}
+
+data Stack = Empty         { stackDetails :: !StackDetails }
+{- read these like: (stackDetails, _stackElement) `Then` _restOfStack -}
+           | Then          { _stackElement :: !StackElement
+                           , stackDetails :: !StackDetails
+                           , _restOfStack  :: !Stack
+                           }
+           | RecursionThen { _stackElement :: !StackElement
+                           , stackDetails :: !StackDetails
+                           , _restOfStack :: !Stack
+                           }
+
+instance Eq Stack where
+  Empty {} == Empty {}                       = True
+  s1@Then {} == s2@Then {}                   = (stackDetails s1) == (stackDetails s2)
+  s1@RecursionThen {} == s2@RecursionThen {} = (stackDetails s1) == (stackDetails s2)
+  _ == _ = False
+
+instance Eq StackDetails where
+  s1 == s2 = (stackUnique s1) == (stackUnique s2)
+
+data StackElems = Stop
+                | !StackElement `SEThen` !StackElems
+                | !StackElement `SERecursionThen` !StackElems
+
+data StackDetails = StackDetails { stackUnique :: !Unique
+                                 , stackTable :: !(MVar (HashTable StackElement Stack))
+                                 } 
+
+data StackElement 
+  = KnownLocation { elementID         :: !StackElementID
+                  , _lineNo           :: Int
+                  , _colNo            :: Int
+                  , _file             :: String
+                  , enclosingVarName  :: String
+                  }
+  | UnknownLocation { elementID        :: !StackElementID
+                    , enclosingVarName :: String
+                    }
+
+instance Eq StackElement where
+  a == b = elementID a == elementID b
+
+instance Ord StackElement where
+  a `compare` b = elementID a `compare` elementID b
+
+data StackElementID = SEID { moduleKey   :: !Int
+                           , localUnique :: !Int
+                           }
+  deriving (Eq, Ord, Show)
+
+instance Show Stack where
+  show Empty {} = ""
+  show (Then se _ Empty {}) = show se
+  show (Then se _ rest) = show se ++ "\n" ++ show rest
+  show (RecursionThen se _ Empty {}) = show se ++ "\n..."
+  show (RecursionThen se _ rest) = show se ++ "\n...\n" ++ show rest
+
+instance Show StackElement where
+  show (UnknownLocation{ enclosingVarName = enclosingVarName }) 
+    = concat ["in ", enclosingVarName, ", ", "<unknown location>"]
+  show k@(KnownLocation { enclosingVarName = enclosingVarName
+                        , _file = file})  
+    = concat ["in ", enclosingVarName, ", ", file, ":", lineNo, ",", colNo]
+    where
+      lineNo = show $ _lineNo k
+      colNo = show $ _colNo k
+
+throwStack :: forall e a . Exception e => (Stack -> e) -> a
+throwStack f = throw (f emptyStack)
+
+{-# NOINLINE emptyStack #-}
+emptyStack :: Stack
+emptyStack = unsafePerformIO $ do
+  stackDetails <- newStackDetails 
+  return $ Empty { stackDetails = stackDetails }
+
+mkKnownStackElem   :: Int -> Int -> String -> FilePath -> Int -> Int -> StackElement
+mkKnownStackElem modKey unq evn fp line col 
+  = KnownLocation { elementID = SEID { moduleKey = modKey
+                                     , localUnique = unq
+                                     }
+                  , _lineNo = line
+                  , _colNo = col
+                  , _file = fp
+                  , enclosingVarName = evn
+                  }
+
+mkUnknownStackElem :: Int -> Int -> String -> StackElement
+mkUnknownStackElem modKey unq evn 
+  = UnknownLocation { elementID = SEID { moduleKey = modKey
+                                       , localUnique = unq
+                                       }
+                    , enclosingVarName = evn
+                    }
+
+pushStack :: Stack -> StackElement -> Stack
+pushStack stack elem = unsafePerformIO $ do
+  mstack <- memoPush stack elem
+  case mstack of
+    Just stack' -> return stack'
+    Nothing -> do
+      maybe (createPush elem stack) 
+            (uncurry (assemble elem))
+            (stack `breakAt` elem) 
+  where  
+    assemble :: StackElement -> Stack -> StackElems -> IO Stack
+    assemble elem bottom Stop = createPush elem =<< createPush elem bottom
+    assemble elem bottom (se `SEThen` elems) = createPush elem =<< assemble se bottom elems
+    assemble elem bottom (se `SERecursionThen` elems) = createPush elem =<< 
+                                                        createPush se =<< 
+                                                        assemble se bottom elems
+
+{- push that only looks at the current stack's memo table -}
+memoPush :: Stack -> StackElement -> IO (Maybe Stack)
+memoPush stack elem = withMVar mvht (flip HashTable.lookup elem)
+  where
+    mvht = stackTable . stackDetails $ stack
+
+{- push that may create a new stack if not memoizied -}
+{- if not memoizied it only checks the top of the stack to
+   see if it is the same as the element being pushed,
+   doesn't take the stack apart -}
+createPush :: StackElement -> Stack -> IO Stack
+createPush elem stack = do
+  mstack <- memoPush stack elem
+  case mstack of
+    Just stack' -> return stack'
+    Nothing -> do
+      newDetails <- newStackDetails
+
+      if (hasStackElement stack && _stackElement stack == elem)
+        {- invariant, if we are here and the top element == elem, 
+         - then the stack isn't of the form [elem, ..., ] as we would 
+         - have found it in the memo table that we initialize below with this rule -}
+        then do
+          let newStack = RecursionThen  { stackDetails  = newDetails
+                                        , _stackElement = elem
+                                        , _restOfStack  = _restOfStack stack
+                                        }
+
+          stackTableInsert (stackDetails $ stack) elem newStack
+          stackTableInsert newDetails elem newStack -- this maintains the above invariant
+          return newStack
+        else do
+          let newStack = Then { stackDetails  = newDetails
+                              , _stackElement = elem
+                              , _restOfStack  = stack
+                              }
+
+          stackTableInsert (stackDetails $ stack) elem newStack
+          return newStack
+
+newStackDetails :: IO StackDetails
+newStackDetails = do
+          newStackUnique <- newUnique
+          mvar <- newMVar =<< HashTable.new (==) hashSE
+
+          return $ StackDetails { stackUnique = newStackUnique
+                                , stackTable  = mvar
+                                }
+
+stackTableInsert :: StackDetails -> StackElement -> Stack -> IO ()
+stackTableInsert details key val = do
+  modifyMVar_ (stackTable details)
+              (\ht -> HashTable.insert ht key val >> return ht) 
+
+breakAt :: Stack -> StackElement -> Maybe (Stack, StackElems)
+(Empty _) `breakAt` _ = Nothing
+(Then elem _ stack) `breakAt` splitElem
+  | elem == splitElem = return (stack, Stop)
+  | otherwise = do
+      (bottom, top) <- stack `breakAt` splitElem
+      return (bottom, elem `SEThen` top)
+(RecursionThen elem _ stack) `breakAt` splitElem
+  | elem == splitElem = return (stack, Stop)
+  | otherwise = do
+      (bottom, top) <- stack `breakAt` splitElem
+      return (bottom, elem `SERecursionThen` top)
+
+hasStackElement :: Stack -> Bool
+hasStackElement Empty {} = False
+hasStackElement _ = True
hunk ./base.cabal 60
             GHC.Weak,
             GHC.Word,
             System.Timeout
+            GHC.ExplicitCallStack.Stack
         extensions: MagicHash, ExistentialQuantification, Rank2Types,
                     ScopedTypeVariables, UnboxedTuples,
                     ForeignFunctionInterface, UnliftedFFITypes,
}

Context:

[Fix build when we have HTYPE_TCFLAG_T
Ian Lynagh <igloo@earth.li>**20090105102020] 
[Fix the build on Windows
Ian Lynagh <igloo@earth.li>**20090105014625] 
[Add errno to the IOError type
Ian Lynagh <igloo@earth.li>**20090104173018] 
[Fix typo (reqwests -> requests); trac #2908, spotted by bancroft
Ian Lynagh <igloo@earth.li>**20090104154405] 
[More compact error messages for record selectors
simonpj@microsoft.com**20090102145325
 
 Make recSelError generate the standard part of the record selector
 error message (i.e. "No match in record selector") rather than have
 that string duplicated for every record selector.
 
] 
[extra dependencies for the new build system
Simon Marlow <marlowsd@gmail.com>**20081217104655] 
[warning fix: don't use -XPatternSignatures in GHC >= 6.10
Simon Marlow <marlowsd@gmail.com>**20081217104637] 
[Rollback INLINE patches
Simon Marlow <marlowsd@gmail.com>**20081216104143
 
 rolling back:
 
 Fri Dec  5 17:00:15 GMT 2008  simonpj@microsoft.com
   * Update INLINE pragmas for new INLINE story
   
   - (.) and foldr should inline when applied to only two arguments
   - Make unpackCString# NOINLINE; it inlines too much (with little gain)
   
 
     M ./GHC/Base.lhs -10 +31
] 
[FIX #1364: added support for C finalizers that run as soon as the value is no longer reachable.
Ivan Tomac <tomac@pacific.net.au>**20081210150510
 
 Patch amended by Simon Marlow:
   - mkWeakFinalizer# commoned up with mkWeakFinalizerEnv#
] 
[Fix #2760: deprecate mkNorepType, add mkNoRepType
Jose Pedro Magalhaes <jpm@cs.uu.nl>**20081121141905] 
[Update INLINE pragmas for new INLINE story
simonpj@microsoft.com**20081205170015
 
 - (.) and foldr should inline when applied to only two arguments
 - Make unpackCString# NOINLINE; it inlines too much (with little gain)
 
] 
[Fix #2750: change Prelude.(,) to Prelude.(,,)
Jose Pedro Magalhaes <jpm@cs.uu.nl>**20081201113411] 
[Fix typo (or out of date reference) in throwTo documentation.
shelarcy <shelarcy@gmail.com>**20081129024639] 
[Add more description of what "round" does, from the H98 report
Ian Lynagh <igloo@earth.li>**20081119143131] 
[re-instate the gcd/Integer and lcm/Integer RULES
Simon Marlow <marlowsd@gmail.com>**20081120101826
 Fixes a performance regression between 6.8.3 and 6.10.1
] 
[Change an "undefined" into a more informative error; trac #2782
Ian Lynagh <igloo@earth.li>**20081116160228] 
[updating Haddock documentation
jpm@cs.uu.nl**20081111095023
 
 Fixed the broken link from Data.Generics to Data.Data.
] 
[add GHC.Conc.runSparks (required by GHC patch "Run sparks in batches")
Simon Marlow <marlowsd@gmail.com>**20081106095419] 
[FIX #2722: update RULES for the Category/Arrow split
Ross Paterson <ross@soi.city.ac.uk>**20081104144515
 
 The rule
 
 	arr id = id
 
 interacts unpleasantly with the advice to define
 
 	id = arr id
 
 in instances of Category that are also instances of Arrow (#2722).
 
 Also changed a couple of >>>'s to .'s in later rules.
] 
[Add AnnotationWrapper type so GHC can capture annotation dictionaries during compilation
Max Bolingbroke <batterseapower@hotmail.com>**20081016122608] 
[docs about how exceptions are handled by forkIO'd threads (#2651)
Simon Marlow <marlowsd@gmail.com>**20081016100410] 
[Import n_capabilities via import symbol when linking dynamically
Clemens Fruhwirth <clemens@endorphin.org>**20081013161220] 
[add link to the new syb wiki
jpm@cs.uu.nl**20081013111605] 
[changing haddock links
jpm@cs.uu.nl**20081010095434] 
[add readTVarIO :: TVar a -> IO a
Simon Marlow <marlowsd@gmail.com>**20081010113835] 
[removed (->) instance from Data.Data
jpm@cs.uu.nl**20081006075254] 
[non-GHC: delete unnecessary imports
Ross Paterson <ross@soi.city.ac.uk>**20081007134809] 
[added new module Data.Data
'Jose Pedro Magalhaes <jpm@cs.uu.nl>'**20081002140535
 
 The new Data.Data module contains all of Data.Generics.Basics 
 and most of Data.Generics.Instances. The missing instances were 
 deemed dubious and moved to the syb package.
] 
[add new Data.Data module
'Jose Pedro Magalhaes <jpm@cs.uu.nl>'**20081002082735] 
[restore Complex's derived Data instance
'Jose Pedro Magalhaes <jpm@cs.uu.nl>'**20081002082655] 
[update Data.Generics import
'Jose Pedro Magalhaes <jpm@cs.uu.nl>'**20081002082604] 
[Don't use ^(2::Int) in Data.Complex.magnitude; partially fixes trac #2450
Ian Lynagh <igloo@earth.li>**20081004142651
 We still might want to make a RULE for this, so the bug is not fully fixed.
] 
[Restore the Haskell 98 behaviour of Show Ratio (#1920)
Simon Marlow <simonmarhaskell@gmail.com>**20080923134949] 
[Pad version number to 4.0.0.0
Ian Lynagh <igloo@earth.li>**20080920155801] 
[TAG 6.10 branch has been forked
Ian Lynagh <igloo@earth.li>**20080919123437] 
[In nhc98, Word is a type synonym, so class instance is not possible.
Malcolm.Wallace@cs.york.ac.uk**20080917075326] 
[Fix bugs in Text.Printf (#1548)
Simon Marlow <marlowsd@gmail.com>**20080916133505] 
[We should be including Rts.h here, not Stg.h
Simon Marlow <marlowsd@gmail.com>**20080912134901
 Stg.h is for .hc files only, and it sets up various global register
 variables.
] 
[Generic functions that take integral arguments should work the same way as their prelude counterparts
**20080822022755
 
 The Prelude functions drop, take, and splitAt are unfailing (never call error). This patch changes the Data.List generic versions to behave the same way. At present, they call error on negative arguments.
 
] 
[Don't define __hscore_s_issock on Windows
Ian Lynagh <igloo@earth.li>**20080904202845] 
[Unbreak the GHC build with older versions of gcc
Ian Lynagh <igloo@earth.li>**20080904185122
 Patch from kili@outback.escape.de, who says:
   Stg.h must be included before HsBase.h, because the latter contains
   function definitions causing older versions of gcc (3.3.5 in my
   case) to bail out with "error: global register variable follows a
   function definition" on Regs.h, which is included by Stg.h.
] 
[Don't make S_ISSOCK use conditional
Ian Lynagh <igloo@earth.li>**20080904164234
 We were conditionally defining the C wrapper, but unconditionally using
 it. So if it didn't exist then things would have broken anyway.
] 
[Add missing files
Ian Lynagh <igloo@earth.li>**20080904100951] 
[Remerge concurrent,unique,timeout,st,getopt into base
Ian Lynagh <igloo@earth.li>**20080903201908] 
[remove 'pure' method from Arrow class (#2517)
Ross Paterson <ross@soi.city.ac.uk>**20080903144436] 
[make Typeable instances for larger tuples available to non-GHC
Ross Paterson <ross@soi.city.ac.uk>**20080903113543] 
[Don't look for actual OldException.Exception exceptions
Ian Lynagh <igloo@earth.li>**20080902224730
 We don't actually throw them (we throw the new Exception equivalents
 instead), and looking for them was causing an infinite loop
] 
[add include/CTypes.h to extra-source-files
Ross Paterson <ross@soi.city.ac.uk>**20080902153029] 
[avoid relying on the implementation of SomeException
Ross Paterson <ross@soi.city.ac.uk>**20080902080113
 
 This is because Hugs uses a different implementation.
 No semantic change.
] 
[non-GHC: leave out Belch functions
Ross Paterson <ross@soi.city.ac.uk>**20080831180227] 
[non-GHC: add Typeable instance for ForeignPtr
Ross Paterson <ross@soi.city.ac.uk>**20080831180048] 
[docs: mention that killThread on a completed thread is a no-op
Simon Marlow <marlowsd@gmail.com>**20080902093126] 
[#2528: reverse the order of args to (==) in nubBy to match nub
Simon Marlow <marlowsd@gmail.com>**20080902092950
 This only makes a difference when the (==) definition is not
 reflexive, but strictly speaking it does violate the report definition
 of nubBy, so we should fix it.
] 
[System.Timeout is no longer part of base
Malcolm.Wallace@cs.york.ac.uk**20080901145738] 
[getopt is no longer part of base
Malcolm.Wallace@cs.york.ac.uk**20080827145336] 
[Split syb off into its own package
Ian Lynagh <igloo@earth.li>**20080825214144
 I've also moved the Data (Complex a) instance into it, and made it
 portable rather than GHC-only in the process.
] 
[add extra-source-files field
Ross Paterson <ross@soi.city.ac.uk>**20080825231317] 
[Fix warnings in PrelIOUtils.c
Ian Lynagh <igloo@earth.li>**20080825141841] 
[Windows-only fixes for moving concurrent out of base
Ian Lynagh <igloo@earth.li>**20080824164146] 
[Split off the concurrent hierarchy (concurrent, unique, timeout)
Ian Lynagh <igloo@earth.li>**20080824123956] 
[Split getopt off into its own package
Ian Lynagh <igloo@earth.li>**20080824020213] 
[Remove ST stuff that is now in the new st package
Ian Lynagh <igloo@earth.li>**20080823223014] 
[Fix Windows-only warnings
Ian Lynagh <igloo@earth.li>**20080823002249] 
[Fix Windows-only warnings in GHC.Conc
Ian Lynagh <igloo@earth.li>**20080822234837] 
[Suppress some warnings that are hard to fix because of ifdefs
Ian Lynagh <igloo@earth.li>**20080822233951] 
[Provide blockedOnDeadMVar, blockedIndefinitely for the RTS
Ian Lynagh <igloo@earth.li>**20080821110723] 
[Fix more warnings
Ian Lynagh <igloo@earth.li>**20080820233958] 
[Suppress a couple of warnings in GHC.PArr
Ian Lynagh <igloo@earth.li>**20080820232018
 The fix isn't immediately obvious to me
] 
[Fix more warnings
Ian Lynagh <igloo@earth.li>**20080820231937] 
[Fix warnings in Data.Generics.*
Ian Lynagh <igloo@earth.li>**20080820230437] 
[Fix some more warnings
Ian Lynagh <igloo@earth.li>**20080820223252] 
[Ignore some orphan warnings
Ian Lynagh <igloo@earth.li>**20080820211901] 
[remove some functions that aren't used in base
Simon Marlow <marlowsd@gmail.com>**20080821142339] 
[remove __hscore_renameFile, it is no longer uesd
Simon Marlow <marlowsd@gmail.com>**20080818155950
 System.Directory implements renameFile using unix/Win32 now.
] 
[Rewrite the documentation for forkOS again
Simon Marlow <marlowsd@gmail.com>**20080818132856
 Try to make it clearer that forkOS is only necessary when calling
 foreing libraries that use thread-local state, and it has nothing to
 do with scheduling behaviour between Haskell threads.  I also added
 something about the performance impact of forkOS, and mentioned that
 the main thread is a bound thread.
] 
[nhc only: expose Foldable and Traversable instances of Array
Ross Paterson <ross@soi.city.ac.uk>**20080817002719
 
 These were turned off as a side-effect of a previous nhc-only fix for
 #2176 that is no longer needed.  They should be fine for nhc now.
] 
[Fix hReady (trac #1063)
Ian Lynagh <igloo@earth.li>**20080816182715
 We now throw an EOF exception when appropriate
] 
[Fix oversight in Control.OldException
Bertram Felgenhauer <int-e@gmx.de>**20080816132631
 The NonTermination constructor slipped through in the Exception instance.
] 
[Eliminate orphan rules and instances in the array package
Ian Lynagh <igloo@earth.li>**20080816122253] 
[Control.OldException: Map exceptions to old exceptions and back properly.
Ian Lynagh <igloo@earth.li>**20080814210219
   * Control.OldException: Map exceptions to old exceptions and back properly.
     
 It's really necessary to map them back as well, or the RTS and base library
 will not recognize exceptions that got caught and rethrown. (See #2508)
 
 Patch from Bertram Felgenhauer <int-e@gmx.de>
] 
[add Traversable generalizations of mapAccumL and mapAccumR (#2461)
Ross Paterson <ross@soi.city.ac.uk>**20080814162617] 
[simplify definition of Prelude.catch
Ross Paterson <ross@soi.city.ac.uk>**20080814143650] 
[remove returns from void functions
Ross Paterson <ross@soi.city.ac.uk>**20080814110841] 
[No reason for Handler and catches to exclude nhc98.
Malcolm.Wallace@cs.york.ac.uk**20080813125850] 
[Must import ExitCode for its instance to be re-exported.
Malcolm.Wallace@cs.york.ac.uk**20080813125710
 The Cabal library depends on "instance Exception ExitCode", and expects
 to import it from Control.Exception, not Control.Exception.Base.
] 
[use New.catch instead of catchException in OldException
Ross Paterson <ross@soi.city.ac.uk>**20080813071307] 
[use the Haskell 98 module Control.Exception.Base in the Concurrent modules
Ross Paterson <ross@soi.city.ac.uk>**20080813000219] 
[export Control.Exception.Base
Ross Paterson <ross@soi.city.ac.uk>**20080812233640] 
[use dummy implementation of timeout for all non-GHCs
Ross Paterson <ross@soi.city.ac.uk>**20080812151602] 
[Hugs only: fix imports
Ross Paterson <ross@soi.city.ac.uk>**20080812145654] 
[non-GHC: hide Prelude.catch
Ross Paterson <ross@soi.city.ac.uk>**20080812145622] 
[add Control.Exception.Base to nhc98 build
Malcolm.Wallace@cs.york.ac.uk**20080812174300] 
[bump to version 4.0
Simon Marlow <marlowsd@gmail.com>**20080805153354] 
[Hugs only: don't import exception types -- their instances are now in Control.Exception.Base
Ross Paterson <ross@soi.city.ac.uk>**20080812140433] 
[split most of Control.Exception into new Control.Exception.Base
Ross Paterson <ross@soi.city.ac.uk>**20080812124912
 
 Move everything but catches/Handler into a new internal module.
 This was needed to get the new exceptions working with Hugs, because Hugs
 has the constraint that all Haskell 98 library modules, and everything
 they include, must be Haskell 98.  This also involves a different
 representation of SomeException for Hugs, so that type is exported
 opaquely for Hugs.  Then Control.Exception.Base is Haskell 98 as far as
 Hugs is concerned, but Control.Exception needs the extensions turned on.
 
 Control.Exception re-exports everything from Control.Exception.Base
 except the functions used by the GHC runtime.
] 
[remove kludges, now that Control.Exception is imported
Ross Paterson <ross@soi.city.ac.uk>**20080811180328] 
[threadDelay and friends are GHC-only
Ross Paterson <ross@soi.city.ac.uk>**20080811175039] 
[fix imports for non-GHC
Malcolm.Wallace@cs.york.ac.uk**20080808092017] 
[Eq and Ord have moved into GHC.Classes
Ian Lynagh <igloo@earth.li>**20080807095352] 
[Use the proper CInt type in GHC.Unicode
Ian Lynagh <igloo@earth.li>**20080806232948] 
[Import wibbles
Ian Lynagh <igloo@earth.li>**20080806232055] 
[Remove unnecessary Data/Dynamic.hs-boot
Ian Lynagh <igloo@earth.li>**20080806230623] 
[Remove more redundant GHC.Float imports
Ian Lynagh <igloo@earth.li>**20080806225411] 
[Remove an unnecessary import
Ian Lynagh <igloo@earth.li>**20080806224742] 
[Move Int, Float and Double into ghc-prim:GHC.Types
Ian Lynagh <igloo@earth.li>**20080806191554] 
[Put some explicit import lists in Data.Typeable
Ian Lynagh <igloo@earth.li>**20080806190353] 
[Fix a couple of imports
Ian Lynagh <igloo@earth.li>**20080806165549] 
[Remove unused conditional import
Ian Lynagh <igloo@earth.li>**20080806124930] 
[Swap imports around to get GHC.ForeignPtr out of the base knot
Ian Lynagh <igloo@earth.li>**20080806121313] 
[Move some bits around to stop Data.Either being in the base import knot
Ian Lynagh <igloo@earth.li>**20080806120504] 
[Tweak an import
Ian Lynagh <igloo@earth.li>**20080806000440] 
[Remove the DynIOError constructor of IOErrorType
Ian Lynagh <igloo@earth.li>**20080805234720
 As far as I can see it is never used or exported
] 
[Move some internals around to simplify the import graph a bit
Ian Lynagh <igloo@earth.li>**20080805221341] 
[Move the Char datatype into ghc-prim
Ian Lynagh <igloo@earth.li>**20080805204009] 
[Remove an unnecessary import
Ian Lynagh <igloo@earth.li>**20080805182336] 
[The [] definition has moved to ghc-prim
Ian Lynagh <igloo@earth.li>**20080805182332] 
[Fix warnings
Ian Lynagh <igloo@earth.li>**20080805150250] 
[Add a missing case to Show AsyncException
Ian Lynagh <igloo@earth.li>**20080805142811] 
[Remove GHC.Dotnet
Ian Lynagh <igloo@earth.li>**20080804215840] 
[Hide standalone deriving clauses from haddock
Ian Lynagh <igloo@earth.li>**20080804211617] 
[Control.Exception doesn't need to export assertError
Ian Lynagh <igloo@earth.li>**20080804161838] 
[Generalise the type of mapException; pointed out by Isaac Dupree
Ian Lynagh <igloo@earth.li>**20080804160941] 
[Remove some unnecessary Data.Tuple imports
Ian Lynagh <igloo@earth.li>**20080804155956] 
[The tuple datatype definitions have moved to ghc-prim
Ian Lynagh <igloo@earth.li>**20080804155420] 
[make ExitCode an instance of Exception for nhc98
Malcolm.Wallace@cs.york.ac.uk**20080805160330] 
[poke and peek come from Foreign.Storable
Malcolm.Wallace@cs.york.ac.uk**20080804160616] 
[zipWithM_ comes from Control.Monad
Malcolm.Wallace@cs.york.ac.uk**20080804160319] 
[Fix nhc98 code variations to use the extensible exception API.
Malcolm.Wallace@cs.york.ac.uk**20080804155842
 There is still only one real exception type in nhc98, so it is not truly
 extensible.  But this is enough to get the base package building again.
] 
[nhc98 needs the Prelude for this module
Malcolm.Wallace@cs.york.ac.uk**20080804133853] 
[Change some imports and derive Show (Either a b)
Ian Lynagh <igloo@earth.li>**20080804004147
 rather than writing it by hand in GHC.Show
] 
[Windows fixes
Ian Lynagh <igloo@earth.li>**20080803180345] 
[Remove the duplicate definition of throwTo in Control.Exception
Ian Lynagh <igloo@earth.li>**20080803141703
 It now imports GHC.Conc, so it is no longer necessary
] 
[Remove the only import of GHC.Exts
Ian Lynagh <igloo@earth.li>**20080803141944] 
[Move assertError into GHC.IOBase
Ian Lynagh <igloo@earth.li>**20080803141040] 
[Use onException rather than catchAny
Ian Lynagh <igloo@earth.li>**20080803114104] 
[Generalise the type of onException
Ian Lynagh <igloo@earth.li>**20080803003001
 The type of the thing to do on an exception is now
     IO b
 rather than
     IO ()
 which better matches functions like bracket.
] 
[Remove the dangerous Exception functions
Ian Lynagh <igloo@earth.li>**20080802231358
 Removed: catchAny, handleAny, ignoreExceptions
 These make it easy to eat /any/ exception, which is rarely what you want.
 Normally you either want to:
 * only catch exceptions in a certain part of the hierarchy, e.g.
   "file not found", in which case you should only catch exceptions
   of the appropriate type,
 or
 * you want to do some cleanup when an exception happens, and then rethrow
   the exception, in which case you should use onException, or one of the
   bracketing functions.
] 
[Remove an unused import
Ian Lynagh <igloo@earth.li>**20080801230343] 
[Remove unused imports
Ian Lynagh <igloo@earth.li>**20080801230059] 
[Remove unused imports in Control.Exception
Ian Lynagh <igloo@earth.li>**20080801225847] 
[Get rid of some duplicate imports
Ian Lynagh <igloo@earth.li>**20080801214933] 
[Remove the now-unused GHC/Conc.lhs-boot
Ian Lynagh <igloo@earth.li>**20080801214707] 
[Make some more imports non-recursive
Ian Lynagh <igloo@earth.li>**20080801214546] 
[Rejig some code so Control.Exception and GHC.Conc don't need recursive imports
Ian Lynagh <igloo@earth.li>**20080801214208] 
[Remove the now-unused GHC/TopHandler.lhs-boot
Ian Lynagh <igloo@earth.li>**20080801212105] 
[Reshuffle GHC.Conc/GHC.TopHandler a bit to remove a recursive import
Ian Lynagh <igloo@earth.li>**20080801211801] 
[Don't import Control.Concurrent.MVar in GHC.TopHandler
Ian Lynagh <igloo@earth.li>**20080801200123] 
[Export assertError from Control.Exception to make GHC happy
Ian Lynagh <igloo@earth.li>**20080801111716
 It's a wired-in name in GHC. We should possibly move it to another module.
] 
[TopHandler now uses the new extensible exceptions
Ian Lynagh <igloo@earth.li>**20080731153553] 
[Comment wibble
Ian Lynagh <igloo@earth.li>**20080730202127] 
[Make numericEnumFrom more efficient
Ian Lynagh <igloo@earth.li>**20080730202049] 
[Put in some parens to clarify how things parse
Ian Lynagh <igloo@earth.li>**20080730201934] 
[applied patches to make enumFrom and friends strict in arguments as per the Report; closes ticket #1997
Bart Massey <bart@cs.pdx.edu>**20080726080444] 
[Don't use "deriving Typeable" (for portability reasons)
Ian Lynagh <igloo@earth.li>**20080730194434] 
[Add onException
Ian Lynagh <igloo@earth.li>**20080730172014] 
[Fix whitespace
Ian Lynagh <igloo@earth.li>**20080730171951
 The space after "\begin{code}" was confusing haddock
] 
[Re-add blocked; it got lost in the extensible exceptions patches
Ian Lynagh <igloo@earth.li>**20080730145614] 
[Start to actually use extensible exceptions
Ian Lynagh <igloo@earth.li>**20080730145115] 
[Rejig the extensible exceptions so there is less circular importing
Ian Lynagh <igloo@earth.li>**20080730122539] 
[Define nonTermination for the RTS to use
Ian Lynagh <igloo@earth.li>**20080621144420
 We'll probably need to do the same for some other exceptions too
] 
[Use extensible exceptions at the lowest level
Ian Lynagh <igloo@earth.li>**20080621121501
 Everything above is largely unchanged; just the type of catch and throw.
] 
[add comment
Simon Marlow <marlowsd@gmail.com>**20080730114559] 
[add some big warnings to the docs for unsafeIOToSTM (#2401)
Simon Marlow <marlowsd@gmail.com>**20080730114554] 
[FIX #2376: inline shiftR
Simon Marlow <marlowsd@gmail.com>**20080730103539
 Duplicating the default definition for shiftR doesn't seem quite right
 to me, but it gets the right results when compiling the example
 program, and I couldn't find a better way to do it.
] 
[Add instance Show Control.Exception.Exception for nhc98.
Malcolm.Wallace@cs.york.ac.uk**20080728164537] 
[Extend nhc98's Exception type to resemble ghc's more closely
Malcolm.Wallace@cs.york.ac.uk**20080728163445] 
[fix dummy async implementations for non-GHC
Ross Paterson <ross@soi.city.ac.uk>**20080715125521] 
[Fix haddocking with older haddocks
Ian Lynagh <igloo@earth.li>**20080710190855] 
[Add threadStatus :: ThreadId -> IO ThreadStatus
Simon Marlow <marlowsd@gmail.com>**20080710151711
 
 -- | The current status of a thread
 data ThreadStatus
   = ThreadRunning
         -- ^the thread is currently runnable or running
   | ThreadFinished
         -- ^the thread has finished
   | ThreadBlocked  BlockReason
         -- ^the thread is blocked on some resource
   | ThreadDied
         -- ^the thread received an uncaught exception
   deriving (Eq,Ord,Show)
 
 data BlockReason
   = BlockedOnMVar
         -- ^blocked on on 'MVar'
   | BlockedOnBlackHole
         -- ^blocked on a computation in progress by another thread
   | BlockedOnException
         -- ^blocked in 'throwTo'
   | BlockedOnSTM
         -- ^blocked in 'retry' in an STM transaction
   | BlockedOnForeignCall
         -- ^currently in a foreign call
   | BlockedOnOther
         -- ^blocked on some other resource.  Without @-threaded@,
         -- I/O and 'threadDelay' show up as 'BlockedOnOther', with @-threaded@
         -- they show up as 'BlockedOnMVar'.
   deriving (Eq,Ord,Show)
 
 This is useful for concurrency debugging.  I've left threadStatus in
 GHC.Conc for now, since the ThreadStatus type is somewhat GHC-specific.
] 
[forkOS: start the new thread in blocked mode iff the parent was (#1048)
Simon Marlow <marlowsd@gmail.com>**20080709135558
 This matches the behaviour of forkIO
] 
[Add Control.Exception.blocked :: IO Bool
Simon Marlow <marlowsd@gmail.com>**20080709133139
 Tells you whether async exceptions are currently blocked or not.
] 
[FIX BUILD (on Windows)
Simon Marlow <marlowsd@gmail.com>**20080709123110] 
[check CONST_SIGINT
Simon Marlow <marlowsd@gmail.com>**20080709122527] 
[Make threadWaitRead/threadWaitWrite partially useable on Windows
Simon Marlow <marlowsd@gmail.com>**20080709111008
 
 They work with -threaded by calling fdReady() in a separate thread.
 
 "threadWaitRead 0" also works without -threaded (because we happen to
 know it's virtually equivalent to "hWaitForInput stdin (-1)").
] 
[FIX #1198: hWaitForInput on Windows
Simon Marlow <marlowsd@gmail.com>**20080708134254
 Now we do the appropriate magic in fdReady() to detect when there is
 real input available, as opposed to uninteresting console events.
] 
[FIX part of #2301
Simon Marlow <marlowsd@gmail.com>**20080709094437
   
 Control-C now causes the new exception (AsyncException UserInterrupt)
 to be raised in the main thread.  The signal handler is set up by
 GHC.TopHandler.runMainIO, and can be overriden in the usual way by
 installing a new signal handler.  The advantage is that now all
 programs will get a chance to clean up on ^C.
 
 When UserInterrupt is caught by the topmost handler, we now exit the
 program via kill(getpid(),SIGINT), which tells the parent process that
 we exited as a result of ^C, so the parent can take appropriate action
 (it might want to exit too, for example).
 
 One subtlety is that we have to use a weak reference to the ThreadId
 for the main thread, so that the signal handler doesn't prevent the
 main thread from being subject to deadlock detection.
] 
[() has moved to ghc-prim:GHC.Unit, and the Eq and Ord instances to Data.Tuple
Ian Lynagh <igloo@earth.li>**20080624144932] 
[Add GHC.Exts.maxTupleSize :: Int, the size of the largest tuple supported
Ian Lynagh <igloo@earth.li>**20080622141559] 
[Remove code for older GHC versions
Ian Lynagh <igloo@earth.li>**20080620194521] 
[Make the macros in Typeable.h add type signatures
Ian Lynagh <igloo@earth.li>**20080619235808] 
[Fix #2363: getChar cannot be interrupted with -threaded
Simon Marlow <marlowsd@gmail.com>**20080619141911
 Now in -threaded mode, instead of just making a blocking call to
 read(), we call select() first to make sure the read() won't block,
 and if it would block, then we use threadWaitRead.
 
 The idea is that the current thread must be interruptible while it
 blocks.  This is a little slower than before, but the overhead only
 applies to blocking Handles (stdin/stdout/stderr, and those created by
 System.Process).
] 
[Remove -fglasgow-exts from pragmas and comments
Ian Lynagh <igloo@earth.li>**20080616230727] 
[Avoid using deprecated flags
Ian Lynagh <igloo@earth.li>**20080616145207] 
[delete __hscore_{mkstemp,getrlimit,setrlimit} (moved to unix)
Ross Paterson <ross@soi.city.ac.uk>**20080615224413] 
[Update WCsubst.c for Unicode 5.1.0, and add a README.Unicode
Ian Lynagh <igloo@earth.li>**20080613201754
 README.Unicode describes how to do updates in the future.
] 
[Fix ubconfc
Ian Lynagh <igloo@earth.li>**20080613201456
 The current code doesn't seem to be what was used to generate WCsubst.c,
 so I'm not sure if it never worked, or if my tools work slightly
 differently to those of the previous user.
] 
['permutations' is now more lazy and also faster
Twan van Laarhoven <twanvl@gmail.com>**20080102231712] 
['subsequences' is now more lazy and also faster
Twan van Laarhoven <twanvl@gmail.com>**20080102231629] 
[Add 'subsequences' and 'permutations' to Data.List
Twan van Laarhoven <twanvl@gmail.com>**20071218154950] 
[Tweak the definition of (^) again
Ian Lynagh <igloo@earth.li>**20080601120759
 This fixes trac #2306 (do the minimum number of (*)s), and also means
 that we don't use the value of (1 :: a) which causes problems if the
 Num a definition isn't complete.
] 
[note about evaluation affecting StableNames
Simon Marlow <marlowsd@gmail.com>**20080527110549] 
[TAG 2008-05-28
Ian Lynagh <igloo@earth.li>**20080528003830] 
Patch bundle hash:
1d823cc4b8ae45366eb7d23a4083401b6a5d0256
