summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorGeorgi Lyubenov <georgi.lyubenov@tweag.io>2022-06-14 13:06:38 +0300
committerGeorgi Lyubenov <georgi.lyubenov@tweag.io>2022-09-08 17:14:36 +0300
commit77209ab32aee6f58504b303fdea2df69f5a71027 (patch)
tree4115353be46d258f8b4245072dc84ce06c18f289 /compiler
parent7918265d53db963bfd3dd529b1063fb844549733 (diff)
downloadhaskell-77209ab32aee6f58504b303fdea2df69f5a71027.tar.gz
Export liftA2 from Prelude
Changes: In order to be warning free and compatible, we hide Applicative(..) from Prelude in a few places and instead import it directly from Control.Applicative. Please see the migration guide at https://github.com/haskell/core-libraries-committee/blob/main/guides/export-lifta2-prelude.md for more details. This means that Applicative is now exported in its entirety from Prelude. Motivation: This change is motivated by a few things: * liftA2 is an often used function, even more so than (<*>) for some people. * When implementing Applicative, the compiler will prompt you for either an implementation of (<*>) or of liftA2, but trying to use the latter ends with an error, without further imports. This could be confusing for newbies. * For teaching, it is often times easier to introduce liftA2 first, as it is a natural generalisation of fmap. * This change seems to have been unanimously and enthusiastically accepted by the CLC members, possibly indicating a lot of love for it. * This change causes very limited breakage, see the linked issue below for an investigation on this. See https://github.com/haskell/core-libraries-committee/issues/50 for the surrounding discussion and more details.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/GHC/Hs/Doc.hs4
-rw-r--r--compiler/GHC/Types/SrcLoc.hs4
-rw-r--r--compiler/GHC/Utils/Misc.hs4
-rw-r--r--compiler/GHC/Utils/Monad.hs2
4 files changed, 7 insertions, 7 deletions
diff --git a/compiler/GHC/Hs/Doc.hs b/compiler/GHC/Hs/Doc.hs
index 209f9608eb..39d477be52 100644
--- a/compiler/GHC/Hs/Doc.hs
+++ b/compiler/GHC/Hs/Doc.hs
@@ -26,7 +26,7 @@ module GHC.Hs.Doc
, emptyDocs
) where
-import GHC.Prelude
+import GHC.Prelude hiding (Applicative(..))
import GHC.Utils.Binary
import GHC.Types.Name
@@ -38,7 +38,7 @@ import GHC.Types.Avail
import GHC.Types.Name.Set
import GHC.Driver.Flags
-import Control.Applicative (liftA2)
+import Control.Applicative (Applicative(..))
import Data.Data
import Data.IntMap (IntMap)
import qualified Data.IntMap as IntMap
diff --git a/compiler/GHC/Types/SrcLoc.hs b/compiler/GHC/Types/SrcLoc.hs
index 306fde89fa..3f68db0c30 100644
--- a/compiler/GHC/Types/SrcLoc.hs
+++ b/compiler/GHC/Types/SrcLoc.hs
@@ -115,7 +115,7 @@ module GHC.Types.SrcLoc (
) where
-import GHC.Prelude
+import GHC.Prelude hiding (Applicative(..))
import GHC.Utils.Misc
import GHC.Utils.Json
@@ -125,7 +125,7 @@ import GHC.Data.FastString
import qualified GHC.Data.Strict as Strict
import Control.DeepSeq
-import Control.Applicative (liftA2)
+import Control.Applicative (Applicative(..))
import Data.Data
import Data.List (sortBy, intercalate)
import Data.Function (on)
diff --git a/compiler/GHC/Utils/Misc.hs b/compiler/GHC/Utils/Misc.hs
index 3824f4ad5a..0ddf057ffc 100644
--- a/compiler/GHC/Utils/Misc.hs
+++ b/compiler/GHC/Utils/Misc.hs
@@ -127,7 +127,7 @@ module GHC.Utils.Misc (
HasDebugCallStack,
) where
-import GHC.Prelude
+import GHC.Prelude hiding (Applicative(..))
import GHC.Utils.Exception
import GHC.Utils.Panic.Plain
@@ -141,7 +141,7 @@ import Data.List.NonEmpty ( NonEmpty(..) )
import GHC.Exts
import GHC.Stack (HasCallStack)
-import Control.Applicative ( liftA2 )
+import Control.Applicative (Applicative(..))
import Control.Monad ( liftM, guard )
import Control.Monad.IO.Class ( MonadIO, liftIO )
import System.IO.Error as IO ( isDoesNotExistError )
diff --git a/compiler/GHC/Utils/Monad.hs b/compiler/GHC/Utils/Monad.hs
index 3bf8737990..f9fc02b338 100644
--- a/compiler/GHC/Utils/Monad.hs
+++ b/compiler/GHC/Utils/Monad.hs
@@ -27,7 +27,7 @@ module GHC.Utils.Monad
-- Imports
-------------------------------------------------------------------------------
-import GHC.Prelude
+import GHC.Prelude hiding (Applicative(..))
import Control.Applicative
import Control.Monad