Skip to content

Commit 1588def

Browse files
committed
Prepare for liftA2 being exposed in the Prelude
Use a private `Prelude` temporarily to deal with warnings arising from the fact that `liftA2` hasn't always been exposed in the `Prelude`. Other approaches seemed to involve too much CPP or required disabling redundant import warnings, which we really don't want.
1 parent d3e17e1 commit 1588def

File tree

10 files changed

+27
-9
lines changed

10 files changed

+27
-9
lines changed

containers-tests/containers-tests.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ library
109109
Utils.NoThunks
110110

111111
other-modules:
112+
Prelude
112113
Utils.Containers.Internal.Coercions
113114
Utils.Containers.Internal.PtrEquality
114115
Utils.Containers.Internal.State

containers/containers.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ Library
7171
Utils.Containers.Internal.StrictPair
7272

7373
other-modules:
74+
Prelude
7475
Utils.Containers.Internal.State
7576
Utils.Containers.Internal.StrictMaybe
7677
Utils.Containers.Internal.PtrEquality

containers/src/Data/Graph.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ import qualified Data.IntSet as Set
107107
import Data.Tree (Tree(Node), Forest)
108108

109109
-- std interfaces
110-
import Control.Applicative
111110
import Data.Foldable as F
112111
import Control.DeepSeq (NFData(rnf))
113112
import Data.Maybe

containers/src/Data/IntMap/Internal.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,6 @@ module Data.IntMap.Internal (
294294
) where
295295

296296
import Data.Functor.Identity (Identity (..))
297-
import Control.Applicative (liftA2)
298297
import Data.Semigroup (Semigroup(stimes))
299298
#if !(MIN_VERSION_base(4,11,0))
300299
import Data.Semigroup (Semigroup((<>)))

containers/src/Data/IntMap/Strict/Internal.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,6 @@ import Data.IntMap.Internal.DeprecatedDebug (showTree, showTreeWith)
345345
import qualified Data.IntSet.Internal as IntSet
346346
import Utils.Containers.Internal.BitUtil
347347
import Utils.Containers.Internal.StrictPair
348-
import Control.Applicative (Applicative (..), liftA2)
349348
import qualified Data.Foldable as Foldable
350349

351350
{--------------------------------------------------------------------

containers/src/Data/Sequence.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,6 @@ import Data.Sequence.Internal.Sorting
250250
import Prelude ()
251251
#ifdef __HADDOCK_VERSION__
252252
import Control.Monad (Monad (..))
253-
import Control.Applicative (Applicative (..))
254253
import Data.Functor (Functor (..))
255254
#endif
256255

containers/src/Data/Sequence/Internal.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,12 +199,12 @@ import Prelude hiding (
199199
#if MIN_VERSION_base(4,11,0)
200200
(<>),
201201
#endif
202-
Applicative, (<$>), foldMap, Monoid,
202+
(<$>), foldMap, Monoid,
203203
null, length, lookup, take, drop, splitAt, foldl, foldl1, foldr, foldr1,
204204
scanl, scanl1, scanr, scanr1, replicate, zip, zipWith, zip3, zipWith3,
205205
unzip, takeWhile, dropWhile, iterate, reverse, filter, mapM, sum, all)
206-
import Control.Applicative (Applicative(..), (<$>), (<**>), Alternative,
207-
liftA2, liftA3)
206+
import Control.Applicative ((<$>), (<**>), Alternative,
207+
liftA3)
208208
import qualified Control.Applicative as Applicative
209209
import Control.DeepSeq (NFData(rnf))
210210
import Control.Monad (MonadPlus(..))

containers/src/Data/Tree.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ module Data.Tree(
5353
) where
5454

5555
import Data.Foldable (toList)
56-
import Control.Applicative (Applicative(..), liftA2)
5756
import Control.Monad (liftM)
5857
import Control.Monad.Fix (MonadFix (..), fix)
5958
import Data.Sequence (Seq, empty, singleton, (<|), (|>), fromList,

containers/src/Prelude.hs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{-# LANGUAGE CPP #-}
2+
{-# LANGUAGE PackageImports #-}
3+
-- | This hideous module lets us avoid dealing with the fact that
4+
-- @liftA2@ wasn't previously exported from the standard prelude.
5+
module Prelude
6+
( module Prel
7+
, Applicative (..)
8+
#if !MIN_VERSION_base(4,10,0)
9+
, liftA2
10+
#endif
11+
)
12+
where
13+
14+
import "base" Prelude as Prel
15+
#if !MIN_VERSION_base(4,18,0)
16+
import Control.Applicative(Applicative(..))
17+
#endif
18+
19+
#if !MIN_VERSION_base(4,10,0)
20+
import Control.Applicative(liftA2)
21+
#endif

containers/src/Utils/Containers/Internal/State.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
module Utils.Containers.Internal.State where
77

88
import Control.Monad (ap, liftM2)
9-
import Control.Applicative (Applicative(..), liftA)
9+
import Control.Applicative (liftA)
1010

1111
newtype State s a = State {runState :: s -> (s, a)}
1212

0 commit comments

Comments
 (0)