Commit 2f923ce2 authored by Herbert Valerio Riedel's avatar Herbert Valerio Riedel 🕺

Drop pre-AMP compatibility CPP conditionals

Since GHC 8.1/8.2 only needs to be bootstrap-able by GHC 7.10 and
GHC 8.0 (and GHC 8.2), we can now finally drop all that pre-AMP
compatibility CPP-mess for good!

Reviewers: austin, goldfire, bgamari

Subscribers: goldfire, thomie, erikd

Differential Revision: https://phabricator.haskell.org/D1724
parent 0d207378
......@@ -39,9 +39,6 @@ import Type (mkTyConApp)
import Data.Function (on)
import qualified Data.Data as Data
import qualified Data.Typeable
#if __GLASGOW_HASKELL__ <= 708
import Control.Applicative ((<$>))
#endif
{-
************************************************************************
......
......@@ -56,7 +56,6 @@ Of course, datatypes with no constructors cannot have any fields.
-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DeriveFoldable #-}
......@@ -79,11 +78,6 @@ import Binary
import Data.Data
#if __GLASGOW_HASKELL__ < 709
import Data.Foldable ( Foldable )
import Data.Traversable ( Traversable )
#endif
-- | Field labels are just represented as strings;
-- they are not necessarily unique (even within a module)
type FieldLabelString = FastString
......
-- (c) The University of Glasgow, 1992-2006
{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE DeriveFunctor #-}
......@@ -85,10 +84,6 @@ import Util
import Outputable
import FastString
#if __GLASGOW_HASKELL__ < 709
import Data.Foldable ( Foldable )
import Data.Traversable ( Traversable )
#endif
import Data.Bits
import Data.Data
import Data.List
......
......@@ -33,9 +33,7 @@ import Data.Bits
import Data.List (nub)
import Control.Monad (liftM)
#if __GLASGOW_HASKELL__ >= 709
import Prelude hiding ((<*>))
#endif
#include "HsVersions.h"
......
......@@ -5,7 +5,7 @@
-- CmmLint: checking the correctness of Cmm statements and expressions
--
-----------------------------------------------------------------------------
{-# LANGUAGE GADTs, CPP #-}
{-# LANGUAGE GADTs #-}
module CmmLint (
cmmLint, cmmLintGraph
) where
......@@ -22,9 +22,6 @@ import Outputable
import DynFlags
import Control.Monad (liftM, ap)
#if __GLASGOW_HASKELL__ < 709
import Control.Applicative (Applicative(..))
#endif
-- Things to check:
-- - invariant on CmmBlock in CmmExpr (see comment there)
......
......@@ -55,10 +55,6 @@ import Data.Word
import System.IO
import qualified Data.Map as Map
import Control.Monad (liftM, ap)
#if __GLASGOW_HASKELL__ < 709
import Control.Applicative (Applicative(..))
#endif
import qualified Data.Array.Unsafe as U ( castSTUArray )
import Data.Array.ST
......
......@@ -52,9 +52,7 @@ import DynFlags
import Control.Monad
#if __GLASGOW_HASKELL__ >= 709
import Prelude hiding ((<*>))
#endif
------------------------------------------------------------------------
-- Top-level bindings
......
......@@ -50,9 +50,7 @@ import Outputable
import Control.Monad (unless,void)
import Control.Arrow (first)
#if __GLASGOW_HASKELL__ >= 709
import Prelude hiding ((<*>))
#endif
------------------------------------------------------------------------
-- cgExpr: the main function
......
{-# LANGUAGE CPP #-}
-- | Our extended FCode monad.
-- We add a mapping from names to CmmExpr, to support local variable names in
......@@ -54,9 +52,6 @@ import UniqFM
import Unique
import Control.Monad (liftM, ap)
#if __GLASGOW_HASKELL__ < 709
import Control.Applicative (Applicative(..))
#endif
-- | The environment contains variable definitions or blockids.
data Named
......
......@@ -45,11 +45,7 @@ import BasicTypes
import Control.Monad
#if __GLASGOW_HASKELL__ >= 709
import Prelude hiding( succ, (<*>) )
#else
import Prelude hiding( succ )
#endif
-----------------------------------------------------------------------------
-- Code generation for Foreign Calls
......
......@@ -48,9 +48,7 @@ import DynFlags
import FastString( mkFastString, fsLit )
import Panic( sorry )
#if __GLASGOW_HASKELL__ >= 709
import Prelude hiding ((<*>))
#endif
import Control.Monad (when)
import Data.Maybe (isJust)
......
......@@ -25,9 +25,7 @@ module StgCmmLayout (
#include "HsVersions.h"
#if __GLASGOW_HASKELL__ >= 709
import Prelude hiding ((<*>))
#endif
import StgCmmClosure
import StgCmmEnv
......
......@@ -43,9 +43,7 @@ import FastString
import Outputable
import Util
#if __GLASGOW_HASKELL__ >= 709
import Prelude hiding ((<*>))
#endif
import Data.Bits ((.&.), bit)
import Control.Monad (liftM, when)
......
......@@ -61,10 +61,6 @@ import MonadUtils ( mapAccumLM )
import Data.List ( mapAccumL )
import Control.Monad
#if __GLASGOW_HASKELL__ < 710
import Control.Applicative
#endif
{-
-- ---------------------------------------------------------------------------
-- Overview
......
......@@ -80,9 +80,6 @@ import DynFlags
import Data.List
import Data.Char ( ord )
#if __GLASGOW_HASKELL__ < 709
import Data.Word ( Word )
#endif
infixl 4 `mkCoreApp`, `mkCoreApps`
......
......@@ -47,9 +47,6 @@ import qualified GHC.LanguageExtensions as LangExt
import Control.Monad
import Data.Int
#if __GLASGOW_HASKELL__ < 709
import Data.Traversable (traverse)
#endif
import Data.Word
{-
......
......@@ -25,9 +25,6 @@ import SrcLoc
import FastString -- sLit
import VarSet
#if __GLASGOW_HASKELL__ < 709
import Data.Functor ((<$>))
#endif
import Data.Maybe (mapMaybe)
import Data.List (groupBy, sortBy, nubBy)
import Control.Monad.Trans.State.Lazy
......
......@@ -36,9 +36,6 @@ import Util
-- From iserv
import SizedSeq
#if __GLASGOW_HASKELL__ < 709
import Control.Applicative (Applicative(..))
#endif
import Control.Monad
import Control.Monad.ST ( runST )
import Control.Monad.Trans.Class
......
......@@ -47,10 +47,6 @@ import OrdList
import Data.List
import Foreign
#if __GLASGOW_HASKELL__ < 709
import Control.Applicative (Applicative(..))
#endif
import Control.Monad
import Data.Char
......
......@@ -68,15 +68,8 @@ import Data.Array.Base
import Data.Ix
import Data.List
import qualified Data.Sequence as Seq
#if __GLASGOW_HASKELL__ < 709
import Data.Monoid (mappend)
#endif
import Data.Sequence (viewl, ViewL(..))
#if __GLASGOW_HASKELL__ >= 709
import Foreign
#else
import Foreign.Safe
#endif
import System.IO.Unsafe
---------------------------------------------
......
......@@ -6,7 +6,6 @@
This module converts Template Haskell syntax into HsSyn
-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Convert( convertToHsExpr, convertToPat, convertToHsDecls,
......@@ -39,9 +38,6 @@ import MonadUtils ( foldrM )
import qualified Data.ByteString as BS
import Control.Monad( unless, liftM, ap )
#if __GLASGOW_HASKELL__ < 709
import Control.Applicative (Applicative(..))
#endif
import Data.Char ( chr )
import Data.Word ( Word8 )
......
......@@ -13,7 +13,6 @@ Datatype for: @BindGroup@, @Bind@, @Sig@, @Bind@.
{-# LANGUAGE UndecidableInstances #-} -- Note [Pass sensitive types]
-- in module PlaceHolder
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE BangPatterns #-}
module HsBinds where
......@@ -44,11 +43,6 @@ import Data.Data hiding ( Fixity )
import Data.List hiding ( foldr )
import Data.Ord
import Data.Foldable ( Foldable(..) )
#if __GLASGOW_HASKELL__ < 709
import Data.Traversable ( Traversable(..) )
import Data.Monoid ( mappend )
import Control.Applicative hiding (empty)
#endif
{-
************************************************************************
......@@ -1029,8 +1023,6 @@ instance Foldable HsPatSynDetails where
foldr1 f (RecordPatSyn args) =
Data.List.foldr1 f (map (Data.Foldable.foldr1 f) args)
-- TODO: After a few more versions, we should probably use these.
#if __GLASGOW_HASKELL__ >= 709
length (InfixPatSyn _ _) = 2
length (PrefixPatSyn args) = Data.List.length args
length (RecordPatSyn args) = Data.List.length args
......@@ -1042,7 +1034,6 @@ instance Foldable HsPatSynDetails where
toList (InfixPatSyn left right) = [left, right]
toList (PrefixPatSyn args) = args
toList (RecordPatSyn args) = foldMap toList args
#endif
instance Traversable HsPatSynDetails where
traverse f (InfixPatSyn left right) = InfixPatSyn <$> f left <*> f right
......
......@@ -3,7 +3,6 @@
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998
-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveDataTypeable, DeriveFunctor, DeriveFoldable,
DeriveTraversable #-}
{-# LANGUAGE StandaloneDeriving #-}
......@@ -110,10 +109,6 @@ import FastString
import Bag
import Data.Maybe ( fromMaybe )
import Data.Data hiding (TyCon,Fixity)
#if __GLASGOW_HASKELL__ < 709
import Data.Foldable ( Foldable )
import Data.Traversable ( Traversable )
#endif
{-
************************************************************************
......
......@@ -115,11 +115,6 @@ import Data.Either
import Data.Function
import Data.List
#if __GLASGOW_HASKELL__ < 709
import Data.Foldable ( foldMap )
import Data.Monoid ( mempty, mappend )
#endif
{-
************************************************************************
* *
......
......@@ -72,9 +72,6 @@ import ListSetOps
import Data.List
import Control.Monad
import qualified Data.Map as Map
#if __GLASGOW_HASKELL__ < 709
import Data.Traversable ( traverse )
#endif
{-
This module takes
......
......@@ -57,9 +57,6 @@ import ErrUtils
import qualified Stream
import Control.Monad (ap)
#if __GLASGOW_HASKELL__ < 709
import Control.Applicative (Applicative(..))
#endif
-- ----------------------------------------------------------------------------
-- * Some Data Types
......
......@@ -34,10 +34,6 @@ import Util
import Control.Monad.Trans.Class
import Control.Monad.Trans.Writer
#if MIN_VERSION_base(4,8,0)
#else
import Data.Monoid ( Monoid, mappend, mempty )
#endif
#if __GLASGOW_HASKELL__ > 710
import Data.Semigroup ( Semigroup )
import qualified Data.Semigroup as Semigroup
......
......@@ -33,9 +33,6 @@ import Data.Function
import Data.List
import Control.Monad (liftM, ap)
#if __GLASGOW_HASKELL__ < 709
import Control.Applicative (Applicative(..))
#endif
--------------------------------------------------------
-- The Flag and OptKind types
......
......@@ -182,9 +182,7 @@ import Control.Monad
import Control.Monad.Trans.Class
import Control.Monad.Trans.Writer
import Control.Monad.Trans.Reader
#if MIN_VERSION_transformers(0,4,0)
import Control.Monad.Trans.Except
#endif
import Control.Exception (throwIO)
import Data.Bits
......@@ -195,7 +193,6 @@ import Data.Map (Map)
import qualified Data.Map as Map
import Data.Set (Set)
import qualified Data.Set as Set
import Data.Monoid (Monoid)
import Data.Word
import System.FilePath
import System.Directory
......@@ -850,10 +847,8 @@ instance (Monad m, HasDynFlags m) => HasDynFlags (ReaderT a m) where
instance (Monad m, HasDynFlags m) => HasDynFlags (MaybeT m) where
getDynFlags = lift getDynFlags
#if MIN_VERSION_transformers(0,4,0)
instance (Monad m, HasDynFlags m) => HasDynFlags (ExceptT e m) where
getDynFlags = lift getDynFlags
#endif
class ContainsDynFlags t where
extractDynFlags :: t -> DynFlags
......
......@@ -450,12 +450,7 @@ runGhc mb_top_dir ghc = do
-- to this function will create a new session which should not be shared among
-- several threads.
#if __GLASGOW_HASKELL__ < 710
-- Pre-AMP change
runGhcT :: (ExceptionMonad m, Functor m) =>
#else
runGhcT :: (ExceptionMonad m) =>
#endif
runGhcT :: ExceptionMonad m =>
Maybe FilePath -- ^ See argument to 'initGhcMonad'.
-> GhcT m a -- ^ The action to perform.
-> m a
......
......@@ -188,12 +188,7 @@ instance ExceptionMonad m => ExceptionMonad (GhcT m) where
instance MonadIO m => HasDynFlags (GhcT m) where
getDynFlags = GhcT $ \(Session r) -> liftM hsc_dflags (liftIO $ readIORef r)
#if __GLASGOW_HASKELL__ < 710
-- Pre-AMP change
instance (ExceptionMonad m, Functor m) => GhcMonad (GhcT m) where
#else
instance (ExceptionMonad m) => GhcMonad (GhcT m) where
#endif
instance ExceptionMonad m => GhcMonad (GhcT m) where
getSession = GhcT $ \(Session r) -> liftIO $ readIORef r
setSession s' = GhcT $ \(Session r) -> liftIO $ writeIORef r s'
......
......@@ -77,9 +77,6 @@ import Data.Char ( toUpper )
import Data.List as List
import Data.Map (Map)
import Data.Set (Set)
#if __GLASGOW_HASKELL__ < 709
import Data.Monoid hiding ((<>))
#endif
#if __GLASGOW_HASKELL__ > 710
import Data.Semigroup ( Semigroup )
import qualified Data.Semigroup as Semigroup
......
......@@ -84,9 +84,6 @@ import Data.List
import Data.Maybe
import Data.Ord ( comparing )
import Control.Exception
#if __GLASGOW_HASKELL__ < 709
import Control.Applicative (Applicative(..))
#endif
import Control.Monad
import System.IO
......
......@@ -52,9 +52,6 @@ import DynFlags
import Module
import Control.Monad ( liftM, ap )
#if __GLASGOW_HASKELL__ < 709
import Control.Applicative ( Applicative(..) )
#endif
import Compiler.Hoopl ( LabelMap, Label )
......
{-# LANGUAGE UnboxedTuples #-}
{-# LANGUAGE CPP #-}
-- | State monad for the linear register allocator.
......@@ -44,9 +43,6 @@ import Unique
import UniqSupply
import Control.Monad (liftM, ap)
#if __GLASGOW_HASKELL__ < 709
import Control.Applicative (Applicative(..))
#endif
-- | The register allocator monad type.
newtype RegM freeRegs a
......
......@@ -74,9 +74,6 @@ module Lexer (
) where
-- base
#if __GLASGOW_HASKELL__ < 709
import Control.Applicative
#endif
import Control.Monad
#if __GLASGOW_HASKELL__ > 710
import Control.Monad.Fail
......
......@@ -95,11 +95,7 @@ import Data.List
import qualified GHC.LanguageExtensions as LangExt
import MonadUtils
#if __GLASGOW_HASKELL__ < 709
import Control.Applicative ((<$>))
#endif
import Control.Monad
import Text.ParserCombinators.ReadP as ReadP
import Data.Char
......
......@@ -47,11 +47,7 @@ import Platform
import Util
import Coercion (mkUnbranchedAxInstCo,mkSymCo,Role(..))
#if __GLASGOW_HASKELL__ >= 709
import Control.Applicative ( Alternative(..) )
#else
import Control.Applicative ( Applicative(..), Alternative(..) )
#endif
import Control.Monad
#if __GLASGOW_HASKELL__ > 710
......
......@@ -37,9 +37,6 @@ import SrcLoc
import Util
import Control.Monad (liftM, ap)
#if __GLASGOW_HASKELL__ < 709
import Control.Applicative (Applicative(..))
#endif
stgMassageForProfiling
:: DynFlags
......
......@@ -9,8 +9,6 @@ type-synonym declarations; those cannot be done at this stage because
they may be affected by renaming (which isn't fully worked out yet).
-}
{-# LANGUAGE CPP #-}
module RnBinds (
-- Renaming top-level bindings
rnTopBindsLHS, rnTopBindsRHS, rnValBindsRHS,
......@@ -53,9 +51,6 @@ import qualified GHC.LanguageExtensions as LangExt
import Control.Monad
import Data.List ( partition, sort )
#if __GLASGOW_HASKELL__ < 709
import Data.Traversable ( traverse )
#endif
{-
-- ToDo: Put the annotations into the monad, so that they arrive in the proper
......
......@@ -54,9 +54,6 @@ import Control.Monad
import Data.List ( sortBy )
import Maybes( orElse, mapMaybe )
import qualified Data.Set as Set ( difference, fromList, toList, null )
#if __GLASGOW_HASKELL__ < 709
import Data.Traversable (traverse)
#endif
{-
@rnSourceDecl@ `renames' declarations.
......
......@@ -58,10 +58,6 @@ import qualified GHC.LanguageExtensions as LangExt
import Data.List ( (\\), nubBy, partition )
import Control.Monad ( unless, when )
#if __GLASGOW_HASKELL__ < 709
import Data.Monoid ( mappend, mempty, mconcat )
#endif
#include "HsVersions.h"
{-
......
......@@ -36,9 +36,6 @@ import Outputable
import FastString
import State
#if __GLASGOW_HASKELL__ < 709
import Control.Applicative (Applicative(..))
#endif
import Control.Monad
#if __GLASGOW_HASKELL__ > 710
import qualified Control.Monad.Fail as MonadFail
......
......@@ -26,9 +26,6 @@ import Util
import SrcLoc
import Outputable
import FastString
#if __GLASGOW_HASKELL__ < 709
import Control.Applicative ( Applicative(..) )
#endif
import Control.Monad
import Data.Function
......
......@@ -44,11 +44,6 @@ import Control.Monad
import Data.Map (Map)
import qualified Data.Map as Map
#if __GLASGOW_HASKELL__ < 709
import Prelude hiding ( and )
import Data.Foldable ( and )
#endif
#include "HsVersions.h"
{-
......
......@@ -39,12 +39,6 @@ import Data.List ( nubBy )
import Data.Maybe
import Data.Foldable ( fold )
#if __GLASGOW_HASKELL__ < 709
import Prelude hiding ( and )
import Control.Applicative ( (<$>) )
import Data.Foldable ( and )
#endif
{-
************************************************************************
* *
......
......@@ -39,13 +39,7 @@ import Data.List ( zip4, foldl' )