summaryrefslogtreecommitdiff
path: root/libraries/template-haskell
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 /libraries/template-haskell
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 'libraries/template-haskell')
-rw-r--r--libraries/template-haskell/Language/Haskell/TH/Lib.hs4
-rw-r--r--libraries/template-haskell/Language/Haskell/TH/Lib/Internal.hs4
-rw-r--r--libraries/template-haskell/Language/Haskell/TH/Syntax.hs4
3 files changed, 6 insertions, 6 deletions
diff --git a/libraries/template-haskell/Language/Haskell/TH/Lib.hs b/libraries/template-haskell/Language/Haskell/TH/Lib.hs
index 8e8e41df2f..e052818c0b 100644
--- a/libraries/template-haskell/Language/Haskell/TH/Lib.hs
+++ b/libraries/template-haskell/Language/Haskell/TH/Lib.hs
@@ -178,10 +178,10 @@ import Language.Haskell.TH.Lib.Internal hiding
import qualified Language.Haskell.TH.Lib.Internal as Internal
import Language.Haskell.TH.Syntax
-import Control.Applicative ( liftA2 )
+import Control.Applicative (Applicative(..))
import Foreign.ForeignPtr
import Data.Word
-import Prelude
+import Prelude hiding (Applicative(..))
-- All definitions below represent the "old" API, since their definitions are
-- different in Language.Haskell.TH.Lib.Internal. Please think carefully before
diff --git a/libraries/template-haskell/Language/Haskell/TH/Lib/Internal.hs b/libraries/template-haskell/Language/Haskell/TH/Lib/Internal.hs
index 5d2a32d761..e95a449e1d 100644
--- a/libraries/template-haskell/Language/Haskell/TH/Lib/Internal.hs
+++ b/libraries/template-haskell/Language/Haskell/TH/Lib/Internal.hs
@@ -20,12 +20,12 @@ module Language.Haskell.TH.Lib.Internal where
import Language.Haskell.TH.Syntax hiding (Role, InjectivityAnn)
import qualified Language.Haskell.TH.Syntax as TH
-import Control.Applicative(liftA, liftA2)
+import Control.Applicative(liftA, Applicative(..))
import qualified Data.Kind as Kind (Type)
import Data.Word( Word8 )
import Data.List.NonEmpty ( NonEmpty(..) )
import GHC.Exts (TYPE)
-import Prelude
+import Prelude hiding (Applicative(..))
----------------------------------------------------------
-- * Type synonyms
diff --git a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs b/libraries/template-haskell/Language/Haskell/TH/Syntax.hs
index 48db744f72..c719541074 100644
--- a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs
+++ b/libraries/template-haskell/Language/Haskell/TH/Syntax.hs
@@ -39,7 +39,7 @@ import GHC.IO.Unsafe ( unsafeDupableInterleaveIO )
import Control.Monad (liftM)
import Control.Monad.IO.Class (MonadIO (..))
import Control.Monad.Fix (MonadFix (..))
-import Control.Applicative (liftA2)
+import Control.Applicative (Applicative(..))
import Control.Exception (BlockedIndefinitelyOnMVar (..), catch, throwIO)
import Control.Exception.Base (FixIOException (..))
import Control.Concurrent.MVar (newEmptyMVar, readMVar, putMVar)
@@ -60,7 +60,7 @@ import GHC.Lexeme ( startsVarSym, startsVarId )
import GHC.ForeignSrcLang.Type
import Language.Haskell.TH.LanguageExtensions
import Numeric.Natural
-import Prelude
+import Prelude hiding (Applicative(..))
import Foreign.ForeignPtr
import Foreign.C.String
import Foreign.C.Types