diff --git a/Control/Monad.hs b/Control/Monad.hs
--- a/Control/Monad.hs
+++ b/Control/Monad.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP, PackageImports #-}
 #if __GLASGOW_HASKELL__ >= 701
 {-# LANGUAGE Safe #-}
 #endif
@@ -43,7 +44,7 @@
     , mapAndUnzipM  -- :: (Monad m) => (a -> m (b,c)) -> [a] -> m ([b], [c])
     , zipWithM      -- :: (Monad m) => (a -> b -> m c) -> [a] -> [b] -> m [c]
     , zipWithM_     -- :: (Monad m) => (a -> b -> m c) -> [a] -> [b] -> m ()
-    , foldM         -- :: (Monad m) => (a -> b -> m a) -> a -> [b] -> m a 
+    , foldM         -- :: (Monad m) => (a -> b -> m a) -> a -> [b] -> m a
     , foldM_        -- :: (Monad m) => (a -> b -> m a) -> a -> [b] -> m ()
     , replicateM    -- :: (Monad m) => Int -> m a -> m [a]
     , replicateM_   -- :: (Monad m) => Int -> m a -> m ()
@@ -69,23 +70,23 @@
 
 {- $naming
 
-The functions in this library use the following naming conventions: 
+The functions in this library use the following naming conventions:
 
 * A postfix \'@M@\' always stands for a function in the Kleisli category:
   The monad type constructor @m@ is added to function results
-  (modulo currying) and nowhere else.  So, for example, 
+  (modulo currying) and nowhere else.  So, for example,
 
 >  filter  ::              (a ->   Bool) -> [a] ->   [a]
 >  filterM :: (Monad m) => (a -> m Bool) -> [a] -> m [a]
 
 * A postfix \'@_@\' changes the result type from @(m a)@ to @(m ())@.
-  Thus, for example: 
+  Thus, for example:
 
->  sequence  :: Monad m => [m a] -> m [a] 
->  sequence_ :: Monad m => [m a] -> m () 
+>  sequence  :: Monad m => [m a] -> m [a]
+>  sequence_ :: Monad m => [m a] -> m ()
 
 * A prefix \'@m@\' generalizes an existing function to a monadic form.
-  Thus, for example: 
+  Thus, for example:
 
 >  sum  :: Num a       => [a]   -> a
 >  msum :: MonadPlus m => [m a] -> m a
diff --git a/Data/Array.hs b/Data/Array.hs
--- a/Data/Array.hs
+++ b/Data/Array.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP, PackageImports #-}
 #if __GLASGOW_HASKELL__ >= 701
 {-# LANGUAGE Trustworthy #-}
 #endif
@@ -5,7 +6,7 @@
 module Data.Array (
     -- * Immutable non-strict arrays
     -- $intro
-      module Data.Ix            -- export all of Ix 
+      module Data.Ix            -- export all of Ix
     , Array                     -- Array type is abstract
 
     -- * Array construction
@@ -101,18 +102,18 @@
 (//) = (Array.//)
 
 {- $code
-> module  Array ( 
+> module  Array (
 >     module Data.Ix,  -- export all of Data.Ix
->     Array, array, listArray, (!), bounds, indices, elems, assocs, 
+>     Array, array, listArray, (!), bounds, indices, elems, assocs,
 >     accumArray, (//), accum, ixmap ) where
-> 
+>
 > import Data.Ix
 > import Data.List( (\\) )
-> 
+>
 > infixl 9  !, //
-> 
+>
 > data (Ix a) => Array a b = MkArray (a,a) (a -> b) deriving ()
-> 
+>
 > array       :: (Ix a) => (a,a) -> [(a,b)] -> Array a b
 > array b ivs
 >   | any (not . inRange b. fst) ivs
@@ -124,66 +125,66 @@
 >               [v]   -> v
 >               []    -> error "Data.Array.!: undefined array element"
 >               _     -> error "Data.Array.!: multiply defined array element"
-> 
+>
 > listArray             :: (Ix a) => (a,a) -> [b] -> Array a b
 > listArray b vs        =  array b (zipWith (\ a b -> (a,b)) (range b) vs)
-> 
+>
 > (!)                   :: (Ix a) => Array a b -> a -> b
 > (!) (MkArray _ f)     =  f
-> 
+>
 > bounds                :: (Ix a) => Array a b -> (a,a)
 > bounds (MkArray b _)  =  b
-> 
+>
 > indices               :: (Ix a) => Array a b -> [a]
 > indices               =  range . bounds
-> 
+>
 > elems                 :: (Ix a) => Array a b -> [b]
 > elems a               =  [a!i | i <- indices a]
-> 
+>
 > assocs                :: (Ix a) => Array a b -> [(a,b)]
 > assocs a              =  [(i, a!i) | i <- indices a]
-> 
+>
 > (//)                  :: (Ix a) => Array a b -> [(a,b)] -> Array a b
 > a // new_ivs          = array (bounds a) (old_ivs ++ new_ivs)
 >                       where
 >                         old_ivs = [(i,a!i) | i <- indices a,
 >                                              i `notElem` new_is]
 >                         new_is  = [i | (i,_) <- new_ivs]
-> 
+>
 > accum                 :: (Ix a) => (b -> c -> b) -> Array a b -> [(a,c)]
 >                                    -> Array a b
 > accum f               =  foldl (\a (i,v) -> a // [(i,f (a!i) v)])
-> 
+>
 > accumArray            :: (Ix a) => (b -> c -> b) -> b -> (a,a) -> [(a,c)]
 >                                    -> Array a b
 > accumArray f z b      =  accum f (array b [(i,z) | i <- range b])
-> 
+>
 > ixmap                 :: (Ix a, Ix b) => (a,a) -> (a -> b) -> Array b c
 >                                          -> Array a c
 > ixmap b f a           = array b [(i, a ! f i) | i <- range b]
-> 
+>
 > instance  (Ix a)          => Functor (Array a) where
->     fmap fn (MkArray b f) =  MkArray b (fn . f) 
-> 
+>     fmap fn (MkArray b f) =  MkArray b (fn . f)
+>
 > instance  (Ix a, Eq b)  => Eq (Array a b)  where
 >     a == a' =  assocs a == assocs a'
-> 
+>
 > instance  (Ix a, Ord b) => Ord (Array a b)  where
 >     a <= a' =  assocs a <= assocs a'
-> 
+>
 > instance  (Ix a, Show a, Show b) => Show (Array a b)  where
 >     showsPrec p a = showParen (p > arrPrec) (
 >                     showString "array " .
 >                     showsPrec (arrPrec+1) (bounds a) . showChar ' ' .
 >                     showsPrec (arrPrec+1) (assocs a)                  )
-> 
+>
 > instance  (Ix a, Read a, Read b) => Read (Array a b)  where
 >     readsPrec p = readParen (p > arrPrec)
->            (\r -> [ (array b as, u) 
+>            (\r -> [ (array b as, u)
 >                   | ("array",s) <- lex r,
 >                     (b,t)       <- readsPrec (arrPrec+1) s,
 >                     (as,u)      <- readsPrec (arrPrec+1) t ])
-> 
+>
 > -- Precedence of the 'array' function is that of application itself
 > arrPrec = 10
 -}
diff --git a/Data/Bits.hs b/Data/Bits.hs
--- a/Data/Bits.hs
+++ b/Data/Bits.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP, PackageImports #-}
 #if __GLASGOW_HASKELL__ >= 701
 {-# LANGUAGE Safe #-}
 #endif
diff --git a/Data/Char.hs b/Data/Char.hs
--- a/Data/Char.hs
+++ b/Data/Char.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP, PackageImports #-}
 #if __GLASGOW_HASKELL__ >= 701
 {-# LANGUAGE Safe #-}
 #endif
@@ -38,6 +39,6 @@
     -- * String representations
     , showLitChar       -- :: Char -> ShowS
     , lexLitChar        -- :: ReadS String
-    , readLitChar       -- :: ReadS Char 
+    , readLitChar       -- :: ReadS Char
   ) where
 import "base" Data.Char
diff --git a/Data/Complex.hs b/Data/Complex.hs
--- a/Data/Complex.hs
+++ b/Data/Complex.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP, PackageImports #-}
 #if __GLASGOW_HASKELL__ >= 701
 {-# LANGUAGE Safe #-}
 #endif
@@ -26,39 +27,39 @@
 {- $code
 > module Data.Complex(Complex((:+)), realPart, imagPart, conjugate, mkPolar,
 >                     cis, polar, magnitude, phase)  where
-> 
+>
 > infix  6  :+
-> 
+>
 > data  (RealFloat a)     => Complex a = !a :+ !a  deriving (Eq,Read,Show)
-> 
-> 
+>
+>
 > realPart, imagPart :: (RealFloat a) => Complex a -> a
 > realPart (x:+y)        =  x
 > imagPart (x:+y)        =  y
-> 
+>
 > conjugate      :: (RealFloat a) => Complex a -> Complex a
 > conjugate (x:+y) =  x :+ (-y)
-> 
+>
 > mkPolar                :: (RealFloat a) => a -> a -> Complex a
 > mkPolar r theta        =  r * cos theta :+ r * sin theta
-> 
+>
 > cis            :: (RealFloat a) => a -> Complex a
 > cis theta      =  cos theta :+ sin theta
-> 
+>
 > polar          :: (RealFloat a) => Complex a -> (a,a)
 > polar z                =  (magnitude z, phase z)
-> 
+>
 > magnitude :: (RealFloat a) => Complex a -> a
 > magnitude (x:+y) =  scaleFloat k
 >                    (sqrt ((scaleFloat mk x)^2 + (scaleFloat mk y)^2))
 >                   where k  = max (exponent x) (exponent y)
 >                         mk = - k
-> 
+>
 > phase :: (RealFloat a) => Complex a -> a
 > phase (0 :+ 0) = 0
 > phase (x :+ y) = atan2 y x
-> 
-> 
+>
+>
 > instance  (RealFloat a) => Num (Complex a)  where
 >     (x:+y) + (x':+y') =  (x+x') :+ (y+y')
 >     (x:+y) - (x':+y') =  (x-x') :+ (y-y')
@@ -68,7 +69,7 @@
 >     signum 0          =  0
 >     signum z@(x:+y)   =  x/r :+ y/r  where r = magnitude z
 >     fromInteger n     =  fromInteger n :+ 0
-> 
+>
 > instance  (RealFloat a) => Fractional (Complex a)  where
 >     (x:+y) / (x':+y') =  (x*x''+y*y'') / d :+ (y*x''-x*y'') / d
 >                          where x'' = scaleFloat k x'
@@ -77,19 +78,19 @@
 >                                d   = x'*x'' + y'*y''
 >
 >     fromRational a    =  fromRational a :+ 0
-> 
+>
 > instance  (RealFloat a) => Floating (Complex a)       where
 >     pi             =  pi :+ 0
 >     exp (x:+y)     =  expx * cos y :+ expx * sin y
 >                       where expx = exp x
 >     log z          =  log (magnitude z) :+ phase z
-> 
+>
 >     sqrt 0         =  0
 >     sqrt z@(x:+y)  =  u :+ (if y < 0 then -v else v)
 >                       where (u,v) = if x < 0 then (v',u') else (u',v')
 >                             v'    = abs y / (u'*2)
 >                             u'    = sqrt ((magnitude z + abs x) / 2)
-> 
+>
 >     sin (x:+y)     =  sin x * cosh y :+ cos x * sinh y
 >     cos (x:+y)     =  cos x * cosh y :+ (- sin x * sinh y)
 >     tan (x:+y)     =  (sinx*coshy:+cosx*sinhy)/(cosx*coshy:+(-sinx*sinhy))
@@ -97,7 +98,7 @@
 >                             cosx  = cos x
 >                             sinhy = sinh y
 >                             coshy = cosh y
-> 
+>
 >     sinh (x:+y)    =  cos y * sinh x :+ sin  y * cosh x
 >     cosh (x:+y)    =  cos y * cosh x :+ sin y * sinh x
 >     tanh (x:+y)    =  (cosy*sinhx:+siny*coshx)/(cosy*coshx:+siny*sinhx)
@@ -105,7 +106,7 @@
 >                             cosy  = cos y
 >                             sinhx = sinh x
 >                             coshx = cosh x
-> 
+>
 >     asin z@(x:+y)  =  y':+(-x')
 >                       where  (x':+y') = log (((-y):+x) + sqrt (1 - z*z))
 >     acos z@(x:+y)  =  y'':+(-x'')
@@ -113,7 +114,7 @@
 >                             (x':+y')   = sqrt (1 - z*z)
 >     atan z@(x:+y)  =  y':+(-x')
 >                       where (x':+y') = log (((1-y):+x) / sqrt (1+z*z))
-> 
+>
 >     asinh z        =  log (z + sqrt (1+z*z))
 >     acosh z        =  log (z + (z+1) * sqrt ((z-1)/(z+1)))
 >     atanh z        =  log ((1+z) / sqrt (1-z*z))
diff --git a/Data/Int.hs b/Data/Int.hs
--- a/Data/Int.hs
+++ b/Data/Int.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP, PackageImports #-}
 #if __GLASGOW_HASKELL__ >= 701
 {-# LANGUAGE Safe #-}
 #endif
diff --git a/Data/Ix.hs b/Data/Ix.hs
--- a/Data/Ix.hs
+++ b/Data/Ix.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP, PackageImports #-}
 #if __GLASGOW_HASKELL__ >= 701
 {-# LANGUAGE Safe #-}
 #endif
@@ -12,7 +13,7 @@
           )
 
     -- * Deriving Instances of @Ix@
-    
+
     -- $derived
   ) where
 import "base" Data.Ix
@@ -49,7 +50,7 @@
 >                 =  index (l,u) i * rangeSize (l',u') + index (l',u') i'
 >         inRange ((l,l'),(u,u')) (i,i')
 >                 = inRange (l,u) i && inRange (l',u') i'
-> 
+>
 > -- Instances for other tuples are obtained from this scheme:
 > --
 > --  instance  (Ix a1, Ix a2, ... , Ix ak) => Ix (a1,a2,...,ak)  where
diff --git a/Data/List.hs b/Data/List.hs
--- a/Data/List.hs
+++ b/Data/List.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP, PackageImports #-}
 #if __GLASGOW_HASKELL__ >= 701
 {-# LANGUAGE Safe #-}
 #endif
@@ -20,7 +21,7 @@
    , intersperse       -- :: a -> [a] -> [a]
    , intercalate       -- :: [a] -> [[a]] -> [a]
    , transpose         -- :: [[a]] -> [[a]]
-   
+
    , subsequences      -- :: [a] -> [[a]]
    , permutations      -- :: [a] -> [[a]]
 
diff --git a/Data/Maybe.hs b/Data/Maybe.hs
--- a/Data/Maybe.hs
+++ b/Data/Maybe.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP, PackageImports #-}
 #if __GLASGOW_HASKELL__ >= 701
 {-# LANGUAGE Safe #-}
 #endif
@@ -20,7 +21,7 @@
    , mapMaybe           -- :: (a -> Maybe b) -> [a] -> [b]
 
    -- * Specification
-   
+
    -- $code
 
   ) where
@@ -34,37 +35,37 @@
 >     catMaybes, mapMaybe,
 >     maybe
 >   ) where
-> 
+>
 > maybe                  :: b -> (a -> b) -> Maybe a -> b
 > maybe n _ Nothing      =  n
 > maybe _ f (Just x)     =  f x
-> 
+>
 > isJust                 :: Maybe a -> Bool
 > isJust (Just a)        =  True
 > isJust Nothing         =  False
-> 
+>
 > isNothing              :: Maybe a -> Bool
 > isNothing              =  not . isJust
-> 
+>
 > fromJust               :: Maybe a -> a
 > fromJust (Just a)      =  a
 > fromJust Nothing       =  error "Maybe.fromJust: Nothing"
-> 
+>
 > fromMaybe              :: a -> Maybe a -> a
 > fromMaybe d Nothing    =  d
 > fromMaybe d (Just a)   =  a
-> 
+>
 > maybeToList            :: Maybe a -> [a]
 > maybeToList Nothing    =  []
 > maybeToList (Just a)   =  [a]
-> 
+>
 > listToMaybe            :: [a] -> Maybe a
 > listToMaybe []         =  Nothing
 > listToMaybe (a:_)      =  Just a
->  
+>
 > catMaybes              :: [Maybe a] -> [a]
 > catMaybes ms           =  [ m | Just m <- ms ]
-> 
+>
 > mapMaybe               :: (a -> Maybe b) -> [a] -> [b]
 > mapMaybe f             =  catMaybes . map f
 -}
diff --git a/Data/Ratio.hs b/Data/Ratio.hs
--- a/Data/Ratio.hs
+++ b/Data/Ratio.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP, PackageImports #-}
 #if __GLASGOW_HASKELL__ >= 701
 {-# LANGUAGE Safe #-}
 #endif
@@ -19,41 +20,41 @@
 {- $code
 > module  Data.Ratio (
 >     Ratio, Rational, (%), numerator, denominator, approxRational ) where
-> 
+>
 > infixl 7  %
-> 
+>
 > ratPrec = 7 :: Int
-> 
+>
 > data  (Integral a)      => Ratio a = !a :% !a  deriving (Eq)
 > type  Rational          =  Ratio Integer
-> 
+>
 > (%)                     :: (Integral a) => a -> a -> Ratio a
 > numerator, denominator  :: (Integral a) => Ratio a -> a
 > approxRational          :: (RealFrac a) => a -> a -> Rational
-> 
-> 
+>
+>
 > -- "reduce" is a subsidiary function used only in this module.
 > -- It normalises a ratio by dividing both numerator
 > -- and denominator by their greatest common divisor.
 > --
 > -- E.g., 12 `reduce` 8    ==  3 :%   2
 > --       12 `reduce` (-8) ==  3 :% (-2)
-> 
+>
 > reduce _ 0              =  error "Data.Ratio.% : zero denominator"
 > reduce x y              =  (x `quot` d) :% (y `quot` d)
 >                            where d = gcd x y
-> 
+>
 > x % y                   =  reduce (x * signum y) (abs y)
-> 
+>
 > numerator (x :% _)      =  x
-> 
+>
 > denominator (_ :% y)    =  y
-> 
-> 
+>
+>
 > instance  (Integral a)  => Ord (Ratio a)  where
 >     (x:%y) <= (x':%y')  =  x * y' <= x' * y
 >     (x:%y) <  (x':%y')  =  x * y' <  x' * y
-> 
+>
 > instance  (Integral a)  => Num (Ratio a)  where
 >     (x:%y) + (x':%y')   =  reduce (x*y' + x'*y) (y*y')
 >     (x:%y) * (x':%y')   =  reduce (x * x') (y * y')
@@ -61,19 +62,19 @@
 >     abs (x:%y)          =  abs x :% y
 >     signum (x:%y)       =  signum x :% 1
 >     fromInteger x       =  fromInteger x :% 1
-> 
+>
 > instance  (Integral a)  => Real (Ratio a)  where
 >     toRational (x:%y)   =  toInteger x :% toInteger y
-> 
+>
 > instance  (Integral a)  => Fractional (Ratio a)  where
 >     (x:%y) / (x':%y')   =  (x*y') % (y*x')
 >     recip (x:%y)        =  y % x
 >     fromRational (x:%y) =  fromInteger x :% fromInteger y
-> 
+>
 > instance  (Integral a)  => RealFrac (Ratio a)  where
 >     properFraction (x:%y) = (fromIntegral q, r:%y)
 >                             where (q,r) = quotRem x y
-> 
+>
 > instance  (Integral a)  => Enum (Ratio a)  where
 >     succ x           =  x+1
 >     pred x           =  x-1
@@ -83,21 +84,21 @@
 >     enumFromThen     =  numericEnumFromThen   -- are as defined in Prelude.hs
 >     enumFromTo       =  numericEnumFromTo     -- but not exported from it!
 >     enumFromThenTo   =  numericEnumFromThenTo
-> 
+>
 > instance  (Read a, Integral a)  => Read (Ratio a)  where
 >     readsPrec p  =  readParen (p > ratPrec)
 >                               (\r -> [(x%y,u) | (x,s)   <- readsPrec (ratPrec+1) r,
 >                                                 ("%",t) <- lex s,
 >                                                 (y,u)   <- readsPrec (ratPrec+1) t ])
-> 
+>
 > instance  (Integral a)  => Show (Ratio a)  where
 >     showsPrec p (x:%y)  =  showParen (p > ratPrec)
->                               showsPrec (ratPrec+1) x . 
->                               showString " % " . 
+>                               showsPrec (ratPrec+1) x .
+>                               showString " % " .
 >                               showsPrec (ratPrec+1) y)
-> 
-> 
-> 
+>
+>
+>
 > approxRational x eps    =  simplest (x-eps) (x+eps)
 >         where simplest x y | y < x      =  simplest y x
 >                            | x == y     =  xr
@@ -106,7 +107,7 @@
 >                            | otherwise  =  0 :% 1
 >                                         where xr@(n:%d) = toRational x
 >                                               (n':%d')  = toRational y
-> 
+>
 >               simplest' n d n' d'       -- assumes 0 < n%d < n'%d'
 >                         | r == 0     =  q :% 1
 >                         | q /= q'    =  (q+1) :% 1
diff --git a/Data/Word.hs b/Data/Word.hs
--- a/Data/Word.hs
+++ b/Data/Word.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP, PackageImports #-}
 #if __GLASGOW_HASKELL__ >= 701
 {-# LANGUAGE Safe #-}
 #endif
diff --git a/Foreign.hs b/Foreign.hs
--- a/Foreign.hs
+++ b/Foreign.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE PackageImports #-}
+
 module Foreign (
         -- | The module @Foreign@ combines the interfaces of all
         -- modules providing language-independent marshalling support,
diff --git a/Foreign/C.hs b/Foreign/C.hs
--- a/Foreign/C.hs
+++ b/Foreign/C.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP, PackageImports #-}
 #if __GLASGOW_HASKELL__ >= 701
 {-# LANGUAGE Safe #-}
 #endif
diff --git a/Foreign/C/Error.hs b/Foreign/C/Error.hs
--- a/Foreign/C/Error.hs
+++ b/Foreign/C/Error.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP, PackageImports #-}
 #if __GLASGOW_HASKELL__ >= 701
 {-# LANGUAGE Safe #-}
 #endif
@@ -15,19 +16,19 @@
   -- different values of @errno@.  This module defines the common values,
   -- but due to the open definition of 'Errno' users may add definitions
   -- which are not predefined.
-  eOK, e2BIG, eACCES, eADDRINUSE, eADDRNOTAVAIL, eADV, eAFNOSUPPORT, eAGAIN, 
-  eALREADY, eBADF, eBADMSG, eBADRPC, eBUSY, eCHILD, eCOMM, eCONNABORTED, 
-  eCONNREFUSED, eCONNRESET, eDEADLK, eDESTADDRREQ, eDIRTY, eDOM, eDQUOT, 
-  eEXIST, eFAULT, eFBIG, eFTYPE, eHOSTDOWN, eHOSTUNREACH, eIDRM, eILSEQ, 
-  eINPROGRESS, eINTR, eINVAL, eIO, eISCONN, eISDIR, eLOOP, eMFILE, eMLINK, 
-  eMSGSIZE, eMULTIHOP, eNAMETOOLONG, eNETDOWN, eNETRESET, eNETUNREACH, 
-  eNFILE, eNOBUFS, eNODATA, eNODEV, eNOENT, eNOEXEC, eNOLCK, eNOLINK, 
-  eNOMEM, eNOMSG, eNONET, eNOPROTOOPT, eNOSPC, eNOSR, eNOSTR, eNOSYS, 
-  eNOTBLK, eNOTCONN, eNOTDIR, eNOTEMPTY, eNOTSOCK, eNOTTY, eNXIO, 
-  eOPNOTSUPP, ePERM, ePFNOSUPPORT, ePIPE, ePROCLIM, ePROCUNAVAIL, 
-  ePROGMISMATCH, ePROGUNAVAIL, ePROTO, ePROTONOSUPPORT, ePROTOTYPE, 
-  eRANGE, eREMCHG, eREMOTE, eROFS, eRPCMISMATCH, eRREMOTE, eSHUTDOWN, 
-  eSOCKTNOSUPPORT, eSPIPE, eSRCH, eSRMNT, eSTALE, eTIME, eTIMEDOUT, 
+  eOK, e2BIG, eACCES, eADDRINUSE, eADDRNOTAVAIL, eADV, eAFNOSUPPORT, eAGAIN,
+  eALREADY, eBADF, eBADMSG, eBADRPC, eBUSY, eCHILD, eCOMM, eCONNABORTED,
+  eCONNREFUSED, eCONNRESET, eDEADLK, eDESTADDRREQ, eDIRTY, eDOM, eDQUOT,
+  eEXIST, eFAULT, eFBIG, eFTYPE, eHOSTDOWN, eHOSTUNREACH, eIDRM, eILSEQ,
+  eINPROGRESS, eINTR, eINVAL, eIO, eISCONN, eISDIR, eLOOP, eMFILE, eMLINK,
+  eMSGSIZE, eMULTIHOP, eNAMETOOLONG, eNETDOWN, eNETRESET, eNETUNREACH,
+  eNFILE, eNOBUFS, eNODATA, eNODEV, eNOENT, eNOEXEC, eNOLCK, eNOLINK,
+  eNOMEM, eNOMSG, eNONET, eNOPROTOOPT, eNOSPC, eNOSR, eNOSTR, eNOSYS,
+  eNOTBLK, eNOTCONN, eNOTDIR, eNOTEMPTY, eNOTSOCK, eNOTTY, eNXIO,
+  eOPNOTSUPP, ePERM, ePFNOSUPPORT, ePIPE, ePROCLIM, ePROCUNAVAIL,
+  ePROGMISMATCH, ePROGUNAVAIL, ePROTO, ePROTONOSUPPORT, ePROTOTYPE,
+  eRANGE, eREMCHG, eREMOTE, eROFS, eRPCMISMATCH, eRREMOTE, eSHUTDOWN,
+  eSOCKTNOSUPPORT, eSPIPE, eSRCH, eSRMNT, eSTALE, eTIME, eTIMEDOUT,
   eTOOMANYREFS, eTXTBSY, eUSERS, eWOULDBLOCK, eXDEV,
 
   -- ** 'Errno' functions
@@ -57,23 +58,23 @@
   throwErrnoIf_,        -- :: (a -> Bool) -> String -> IO a       -> IO ()
   throwErrnoIfRetry,    -- :: (a -> Bool) -> String -> IO a       -> IO a
   throwErrnoIfRetry_,   -- :: (a -> Bool) -> String -> IO a       -> IO ()
-  throwErrnoIfMinus1,   -- :: Num a 
+  throwErrnoIfMinus1,   -- :: Num a
                         -- =>                String -> IO a       -> IO a
-  throwErrnoIfMinus1_,  -- :: Num a 
+  throwErrnoIfMinus1_,  -- :: Num a
                         -- =>                String -> IO a       -> IO ()
   throwErrnoIfMinus1Retry,
-                        -- :: Num a 
+                        -- :: Num a
                         -- =>                String -> IO a       -> IO a
-  throwErrnoIfMinus1Retry_,  
-                        -- :: Num a 
+  throwErrnoIfMinus1Retry_,
+                        -- :: Num a
                         -- =>                String -> IO a       -> IO ()
   throwErrnoIfNull,     -- ::                String -> IO (Ptr a) -> IO (Ptr a)
   throwErrnoIfNullRetry,-- ::                String -> IO (Ptr a) -> IO (Ptr a)
 
-  throwErrnoIfRetryMayBlock, 
+  throwErrnoIfRetryMayBlock,
   throwErrnoIfRetryMayBlock_,
   throwErrnoIfMinus1RetryMayBlock,
-  throwErrnoIfMinus1RetryMayBlock_,  
+  throwErrnoIfMinus1RetryMayBlock_,
   throwErrnoIfNullRetryMayBlock,
 
   throwErrnoPath,
diff --git a/Foreign/C/String.hs b/Foreign/C/String.hs
--- a/Foreign/C/String.hs
+++ b/Foreign/C/String.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP, PackageImports #-}
 #if __GLASGOW_HASKELL__ >= 701
 {-# LANGUAGE Safe #-}
 #endif
diff --git a/Foreign/C/Types.hs b/Foreign/C/Types.hs
--- a/Foreign/C/Types.hs
+++ b/Foreign/C/Types.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP, PackageImports #-}
 #if __GLASGOW_HASKELL__ >= 701
 {-# LANGUAGE Safe #-}
 #endif
diff --git a/Foreign/ForeignPtr.hs b/Foreign/ForeignPtr.hs
--- a/Foreign/ForeignPtr.hs
+++ b/Foreign/ForeignPtr.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE PackageImports #-}
+
 module Foreign.ForeignPtr (
         -- * Finalised data pointers
           ForeignPtr
@@ -27,6 +29,7 @@
 
 import qualified "base" Foreign.ForeignPtr as Base
 import "base" Foreign.ForeignPtr hiding (mallocForeignPtr, touchForeignPtr)
+import "base" Foreign.ForeignPtr.Unsafe
 import "base" Foreign (Storable)
 
 -- SDM: local copy of the docs for mallocForeignPtr, to omit the
@@ -39,7 +42,7 @@
 -- 'mallocForeignPtr' is equivalent to
 --
 -- >    do { p <- malloc; newForeignPtr finalizerFree p }
--- 
+--
 -- although it may be implemented differently internally: you may not
 -- assume that the memory returned by 'mallocForeignPtr' has been
 -- allocated with 'Foreign.Marshal.Alloc.malloc'.
@@ -54,7 +57,7 @@
 -- actions. In particular 'Foreign.ForeignPtr.withForeignPtr'
 -- does a 'touchForeignPtr' after it
 -- executes the user action.
--- 
+--
 -- Note that this function should not be used to express dependencies
 -- between finalizers on 'ForeignPtr's.  For example, if the finalizer
 -- for a 'ForeignPtr' @F1@ calls 'touchForeignPtr' on a second
diff --git a/Foreign/Marshal.hs b/Foreign/Marshal.hs
--- a/Foreign/Marshal.hs
+++ b/Foreign/Marshal.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE PackageImports #-}
+
 module Foreign.Marshal (
          -- | The module "Foreign.Marshal" re-exports the other modules in the
          -- @Foreign.Marshal@ hierarchy:
@@ -25,7 +27,7 @@
 Sometimes an external entity is a pure function, except that it passes
 arguments and/or results via pointers.  The function
 @unsafeLocalState@ permits the packaging of such entities as pure
-functions.  
+functions.
 
 The only IO operations allowed in the IO action passed to
 @unsafeLocalState@ are (a) local allocation (@alloca@, @allocaBytes@
diff --git a/Foreign/Marshal/Alloc.hs b/Foreign/Marshal/Alloc.hs
--- a/Foreign/Marshal/Alloc.hs
+++ b/Foreign/Marshal/Alloc.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP, PackageImports #-}
 #if __GLASGOW_HASKELL__ >= 701
 {-# LANGUAGE Safe #-}
 #endif
diff --git a/Foreign/Marshal/Array.hs b/Foreign/Marshal/Array.hs
--- a/Foreign/Marshal/Array.hs
+++ b/Foreign/Marshal/Array.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP, PackageImports #-}
 #if __GLASGOW_HASKELL__ >= 701
 {-# LANGUAGE Safe #-}
 #endif
diff --git a/Foreign/Marshal/Error.hs b/Foreign/Marshal/Error.hs
--- a/Foreign/Marshal/Error.hs
+++ b/Foreign/Marshal/Error.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE CPP #-}
+{-# LANGUAGE CPP, PackageImports #-}
 #if __GLASGOW_HASKELL__ >= 701
 {-# LANGUAGE Safe #-}
 #endif
@@ -6,7 +6,7 @@
 module Foreign.Marshal.Error (
   throwIf,       -- :: (a -> Bool) -> (a -> String) -> IO a       -> IO a
   throwIf_,      -- :: (a -> Bool) -> (a -> String) -> IO a       -> IO ()
-  throwIfNeg,    -- :: (Ord a, Num a) 
+  throwIfNeg,    -- :: (Ord a, Num a)
                  -- =>                (a -> String) -> IO a       -> IO a
   throwIfNeg_,   -- :: (Ord a, Num a)
                  -- =>                (a -> String) -> IO a       -> IO ()
diff --git a/Foreign/Marshal/Utils.hs b/Foreign/Marshal/Utils.hs
--- a/Foreign/Marshal/Utils.hs
+++ b/Foreign/Marshal/Utils.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP, PackageImports #-}
 #if __GLASGOW_HASKELL__ >= 701
 {-# LANGUAGE Safe #-}
 #endif
diff --git a/Foreign/Ptr.hs b/Foreign/Ptr.hs
--- a/Foreign/Ptr.hs
+++ b/Foreign/Ptr.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP, PackageImports #-}
 #if __GLASGOW_HASKELL__ >= 701
 {-# LANGUAGE Safe #-}
 #endif
diff --git a/Foreign/StablePtr.hs b/Foreign/StablePtr.hs
--- a/Foreign/StablePtr.hs
+++ b/Foreign/StablePtr.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP, PackageImports #-}
 #if __GLASGOW_HASKELL__ >= 701
 {-# LANGUAGE Safe #-}
 #endif
diff --git a/Foreign/Storable.hs b/Foreign/Storable.hs
--- a/Foreign/Storable.hs
+++ b/Foreign/Storable.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP, PackageImports #-}
 #if __GLASGOW_HASKELL__ >= 701
 {-# LANGUAGE Safe #-}
 #endif
diff --git a/Numeric.hs b/Numeric.hs
--- a/Numeric.hs
+++ b/Numeric.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP, PackageImports #-}
 #if __GLASGOW_HASKELL__ >= 701
 {-# LANGUAGE Safe #-}
 #endif
diff --git a/Prelude.hs b/Prelude.hs
--- a/Prelude.hs
+++ b/Prelude.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE NoImplicitPrelude, BangPatterns #-}
+{-# LANGUAGE BangPatterns, CPP, NoImplicitPrelude, PackageImports #-}
 #if __GLASGOW_HASKELL__ >= 701
 {-# LANGUAGE Trustworthy #-}
 #endif
@@ -27,13 +27,6 @@
     -- *** Tuples
     fst, snd, curry, uncurry,
 
-#if defined(__NHC__)
-    []((:), []),        -- Not legal Haskell 98;
-                        -- ... available through built-in syntax
-    module Data.Tuple,  -- Includes tuple types
-    ()(..),             -- Not legal Haskell 98
-    (->),               -- ... available through built-in syntax
-#endif
 #ifdef __HUGS__
     (:),                -- Not legal Haskell 98
 #endif
@@ -157,7 +150,6 @@
 import qualified GHC.Real ( gcd )
 import GHC.Float
 import GHC.Show
-import GHC.Err   ( undefined )
 #endif
 
 #ifdef __HUGS__
diff --git a/System/Environment.hs b/System/Environment.hs
--- a/System/Environment.hs
+++ b/System/Environment.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP, PackageImports #-}
 #if __GLASGOW_HASKELL__ >= 701
 {-# LANGUAGE Safe #-}
 #endif
diff --git a/System/Exit.hs b/System/Exit.hs
--- a/System/Exit.hs
+++ b/System/Exit.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP, PackageImports #-}
 #if __GLASGOW_HASKELL__ >= 701
 {-# LANGUAGE Safe #-}
 #endif
@@ -30,7 +31,7 @@
 
 {- |
 Computation @'exitWith' code@ terminates the program, returning @code@
-to the program's caller.  
+to the program's caller.
 The caller may interpret the return code as it wishes, but the program
 should return 'ExitSuccess' to mean normal completion, and
 @'ExitFailure' n@ to mean that the program encountered a problem from
diff --git a/System/IO.hs b/System/IO.hs
--- a/System/IO.hs
+++ b/System/IO.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP, PackageImports #-}
 #if __GLASGOW_HASKELL__ >= 701
 {-# LANGUAGE Safe #-}
 #endif
@@ -117,7 +118,7 @@
 
     interact,                  -- :: (String -> String) -> IO ()
     putChar,                   -- :: Char   -> IO ()
-    putStr,                    -- :: String -> IO () 
+    putStr,                    -- :: String -> IO ()
     putStrLn,                  -- :: String -> IO ()
     print,                     -- :: Show a => a -> IO ()
     getChar,                   -- :: IO Char
diff --git a/System/IO/Error.hs b/System/IO/Error.hs
--- a/System/IO/Error.hs
+++ b/System/IO/Error.hs
@@ -1,5 +1,4 @@
-{-# OPTIONS_GHC -fno-warn-unused-imports #-}
--- apparent bug in GHC, reports a bogus warning for the Prelude import below
+{-# LANGUAGE CPP, PackageImports #-}
 #if __GLASGOW_HASKELL__ >= 701
 {-# LANGUAGE Safe #-}
 #endif
@@ -20,9 +19,9 @@
     isAlreadyExistsError,       -- :: IOError -> Bool
     isDoesNotExistError,
     isAlreadyInUseError,
-    isFullError, 
+    isFullError,
     isEOFError,
-    isIllegalOperation, 
+    isIllegalOperation,
     isPermissionError,
     isUserError,
 
@@ -39,7 +38,7 @@
     alreadyInUseErrorType,
     fullErrorType,
     eofErrorType,
-    illegalOperationErrorType, 
+    illegalOperationErrorType,
     permissionErrorType,
     userErrorType,
 
diff --git a/changelog.md b/changelog.md
new file mode 100644
--- /dev/null
+++ b/changelog.md
@@ -0,0 +1,13 @@
+# Changelog for [`haskell2010` package](http://hackage.haskell.org/package/haskell2010)
+
+## 1.1.2.0  *Mar 2014*
+
+  - Bundled with GHC 7.8.1
+
+  - Leaks new `Bits Bool` instance (deviation from H2010)
+
+  - Remove NHC98-specific code
+
+  - Adapt to changes in GHC 7.8's core-libaries
+
+  - Update to Cabal format 1.10
diff --git a/haskell2010.cabal b/haskell2010.cabal
--- a/haskell2010.cabal
+++ b/haskell2010.cabal
@@ -1,68 +1,100 @@
-name:		haskell2010
-version:	1.1.1.0
-license:	BSD3
-license-file:	LICENSE
-maintainer:	libraries@haskell.org
-bug-reports: http://hackage.haskell.org/trac/ghc/newticket?component=libraries/haskell2010
-synopsis:	Compatibility with Haskell 2010
-category:   Haskell2010
-description:
-        This package provides exactly the library modules defined by
-        the Haskell 2010 standard.
-homepage:	http://www.haskell.org/definition/
+name:           haskell2010
+version:        1.1.2.0
+-- GHC 7.6.1 released with 1.1.1.0
+license:        BSD3
+license-file:   LICENSE
+maintainer:     libraries@haskell.org
+bug-reports:    http://ghc.haskell.org/trac/ghc/newticket?component=libraries/haskell2010
+synopsis:       Compatibility with Haskell 2010
+category:       Haskell2010, Prelude
+homepage:       http://www.haskell.org/onlinereport/haskell2010/
 build-type:     Simple
-Cabal-Version: >= 1.6
+Cabal-Version:  >=1.10
+description:
+    This package provides exactly the library modules defined by
+    the <http://www.haskell.org/onlinereport/haskell2010/ Haskell 2010 standard>.
 
+extra-source-files:
+    changelog.md
+
+source-repository head
+    type:     git
+    location: http://git.haskell.org/packages/haskell2010.git
+
+source-repository this
+    type:     git
+    location: http://git.haskell.org/packages/haskell2010.git
+    tag:      haskell2010-1.1.2.0-release
+
 Library
-    build-depends:	base >= 4.3 && < 5, array
+    default-language: Haskell2010
+    other-extensions:
+        BangPatterns
+        CPP
+        NoImplicitPrelude
+        Safe
+        Trustworthy
+    if impl(ghc)
+        other-extensions: Safe, Trustworthy
 
+    build-depends:
+        array >= 0.5 && < 0.6,
+        base  >= 4.7 && < 4.8
+
     -- this hack adds a dependency on ghc-prim for Haddock.  The GHC
     -- build system doesn't seem to track transitive dependencies when
     -- running Haddock, and if we don't do this then Haddock can't
     -- find the docs for things defined in ghc-prim.
-    if impl(ghc) {
-       build-depends: ghc-prim
-    }
+    if impl(ghc)
+        build-depends: ghc-prim >= 0.3.1 && < 0.4
 
+    -- haskell2010 is a "hidden" package
+    exposed: False
+
+    -- The modules below are listed in the order they occur in the
+    -- "Haskell 2010 Language Report" table of contents.
     exposed-modules:
-        Data.Array,
-        Data.Char,
-        Data.Complex,
-        System.IO,
-        System.IO.Error,
-        Data.Ix,
-        Data.List,
-        Data.Maybe,
-        Control.Monad,
-        Data.Ratio,
-        System.Environment,
-        System.Exit,
-        Numeric,
-        Prelude,
+        -- chapter 9 "Standard Prelude"
+        -- http://www.haskell.org/onlinereport/haskell2010/haskellch9.html
+        Prelude
 
-        -- FFI modules
-        Data.Int,
-        Data.Word,
-        Data.Bits,
+        -- Part II "The Haskell 2010 Libraries"
+        -- http://www.haskell.org/onlinereport/haskell2010/haskellpa2.html
+        --
+        -- chapter [13..23]
+        Control.Monad
+        Data.Array
+        Data.Bits
+        Data.Char
+        Data.Complex
+        Data.Int
+        Data.Ix
+        Data.List
+        Data.Maybe
+        Data.Ratio
+        Data.Word
 
-        Foreign,
-        Foreign.Ptr,
-        Foreign.ForeignPtr,
-        Foreign.StablePtr,
-        Foreign.Storable,
-        Foreign.C,
-        Foreign.C.Error,
-        Foreign.C.String,
-        Foreign.C.Types,
-        Foreign.Marshal,
-        Foreign.Marshal.Alloc,
-        Foreign.Marshal.Array,
-        Foreign.Marshal.Error,
+        -- FFI modules, chapter [24..37]
+        Foreign
+        Foreign.C
+        Foreign.C.Error
+        Foreign.C.String
+        Foreign.C.Types
+        Foreign.ForeignPtr
+        Foreign.Marshal
+        Foreign.Marshal.Alloc
+        Foreign.Marshal.Array
+        Foreign.Marshal.Error
         Foreign.Marshal.Utils
-    exposed: False
-    extensions: PackageImports, CPP
+        Foreign.Ptr
+        Foreign.StablePtr
+        Foreign.Storable
 
-source-repository head
-    type:     git
-    location: http://darcs.haskell.org/packages/haskell2010.git/
+        -- chapter [38..42]
+        Numeric
+        System.Environment
+        System.Exit
+        System.IO
+        System.IO.Error
 
+    ghc-options: -Wall
