Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Future compat for liftA2 being exported from Prelude #8223

Merged
merged 2 commits into from
Jun 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions Cabal-syntax/src/Distribution/Fields/ParseResult.hs
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,21 @@ module Distribution.Fields.ParseResult (
withoutWarnings,
) where

import Distribution.Compat.Prelude
import Distribution.Parsec.Error (PError (..))
import Distribution.Parsec.Position (Position (..), zeroPos)
import Distribution.Parsec.Warning (PWarnType (..), PWarning (..))
import Distribution.Version (Version)
import Prelude ()

-- liftA2 is not in base <4.10, hence we need to only import it explicitly when we're on >=4.10
--
-- Additionally, since liftA2 will be exported from Prelude starting with ~4.18, we should hide
-- it from Prelude and get it from Control.Applicative to be backwards compatible and avoid warnings
#if MIN_VERSION_base(4,10,0)
import Control.Applicative (Applicative (..))
import Distribution.Compat.Prelude hiding (Applicative(..))
import Control.Applicative (Applicative (..))
#else
import Distribution.Compat.Prelude
#endif

-- | A monad with failure and accumulating errors and warnings.
Expand Down
7 changes: 6 additions & 1 deletion Cabal-syntax/src/Distribution/System.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleContexts #-}
Expand Down Expand Up @@ -42,8 +43,12 @@ module Distribution.System (
) where

import Prelude ()
import Distribution.Compat.Prelude
import Distribution.Compat.Prelude hiding (Applicative(..))
import Control.Applicative (Applicative(..))

#if !MIN_VERSION_base(4,10,0)
import Control.Applicative (liftA2)
#endif

import qualified System.Info (os, arch)
import Distribution.Utils.Generic (lowercase)
Expand Down
2 changes: 1 addition & 1 deletion Cabal-syntax/src/Distribution/Types/VersionInterval.hs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ module Distribution.Types.VersionInterval (

import Control.Applicative (liftA2)
import Control.Exception (assert)
import Distribution.Compat.Prelude
import Distribution.Compat.Prelude hiding (Applicative(..))
import Prelude ()

import Distribution.Types.Version
Expand Down