diff options
author | Ryan Scott <ryan.gl.scott@gmail.com> | 2018-03-13 13:36:38 -0400 |
---|---|---|
committer | David Feuer <David.Feuer@gmail.com> | 2018-03-13 13:36:39 -0400 |
commit | 152055a19cf368439c8450040b68142f8e7d0346 (patch) | |
tree | a2f0c29eba5ce1552e8769c55b6406134f372499 /libraries/ghc-boot | |
parent | ba5797937e575ce6119de6c07703e90dda2557e8 (diff) | |
download | haskell-152055a19cf368439c8450040b68142f8e7d0346.tar.gz |
Drop GHC 8.0 compatibility
GHC 8.4.1 is out, so now GHC's support window only extends
back to GHC 8.2. This means we can delete gobs of code that were
only used for GHC 8.0 support. Hooray!
Test Plan: ./validate
Reviewers: bgamari, erikd, dfeuer
Reviewed By: bgamari, dfeuer
Subscribers: alexbiehl, dfeuer, rwbarton, thomie, carter
Differential Revision: https://phabricator.haskell.org/D4492
Diffstat (limited to 'libraries/ghc-boot')
-rw-r--r-- | libraries/ghc-boot/GHC/PackageDb.hs | 22 | ||||
-rw-r--r-- | libraries/ghc-boot/GHC/Serialized.hs | 7 |
2 files changed, 2 insertions, 27 deletions
diff --git a/libraries/ghc-boot/GHC/PackageDb.hs b/libraries/ghc-boot/GHC/PackageDb.hs index e2e4694308..0bce7001cd 100644 --- a/libraries/ghc-boot/GHC/PackageDb.hs +++ b/libraries/ghc-boot/GHC/PackageDb.hs @@ -80,9 +80,7 @@ import System.FilePath import System.IO import System.IO.Error import GHC.IO.Exception (IOErrorType(InappropriateType)) -#if MIN_VERSION_base(4,10,0) import GHC.IO.Handle.Lock -#endif import System.Directory @@ -209,12 +207,7 @@ emptyInstalledPackageInfo = } -- | Represents a lock of a package db. -newtype PackageDbLock = PackageDbLock -#if MIN_VERSION_base(4,10,0) - Handle -#else - () -- no locking primitives available in base < 4.10 -#endif +newtype PackageDbLock = PackageDbLock Handle -- | Acquire an exclusive lock related to package DB under given location. lockPackageDb :: FilePath -> IO PackageDbLock @@ -222,8 +215,6 @@ lockPackageDb :: FilePath -> IO PackageDbLock -- | Release the lock related to package DB. unlockPackageDb :: PackageDbLock -> IO () -#if MIN_VERSION_base(4,10,0) - -- | Acquire a lock of given type related to package DB under given location. lockPackageDbWith :: LockMode -> FilePath -> IO PackageDbLock lockPackageDbWith mode file = do @@ -273,15 +264,6 @@ unlockPackageDb (PackageDbLock hnd) = do #endif hClose hnd --- MIN_VERSION_base(4,10,0) -#else - -lockPackageDb _file = return $ PackageDbLock () -unlockPackageDb _lock = return () - --- MIN_VERSION_base(4,10,0) -#endif - -- | Mode to open a package db in. data DbMode = DbReadOnly | DbReadWrite @@ -410,7 +392,7 @@ decodeFromFile file mode decoder = case mode of -- shared lock on non-Windows platform because we update the database with an -- atomic rename, so readers will always see the database in a consistent -- state. -#if MIN_VERSION_base(4,10,0) && defined(mingw32_HOST_OS) +#if defined(mingw32_HOST_OS) bracket (lockPackageDbWith SharedLock file) unlockPackageDb $ \_ -> do #endif (, DbOpenReadOnly) <$> decodeFileContents diff --git a/libraries/ghc-boot/GHC/Serialized.hs b/libraries/ghc-boot/GHC/Serialized.hs index 161bbb31f7..ea5dba7624 100644 --- a/libraries/ghc-boot/GHC/Serialized.hs +++ b/libraries/ghc-boot/GHC/Serialized.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE CPP #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE RankNTypes, ScopedTypeVariables #-} {-# OPTIONS_GHC -fno-warn-name-shadowing #-} @@ -34,16 +33,10 @@ toSerialized serialize what = Serialized (typeOf what) (serialize what) -- | If the 'Serialized' value contains something of the given type, then use the specified deserializer to return @Just@ that. -- Otherwise return @Nothing@. fromSerialized :: forall a. Typeable a => ([Word8] -> a) -> Serialized -> Maybe a -#if MIN_VERSION_base(4,10,0) fromSerialized deserialize (Serialized the_type bytes) | the_type == rep = Just (deserialize bytes) | otherwise = Nothing where rep = typeRep (Proxy :: Proxy a) -#else -fromSerialized deserialize (Serialized the_type bytes) - | the_type == typeOf (undefined :: a) = Just (deserialize bytes) - | otherwise = Nothing -#endif -- | Use a 'Data' instance to implement a serialization scheme dual to that of 'deserializeWithData' serializeWithData :: Data a => a -> [Word8] |