summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsheaf <sam.derbyshire@gmail.com>2021-12-03 12:50:35 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-12-07 13:32:55 -0500
commit427f9c122f5b1f130b0a342047c87ee0420050c9 (patch)
tree074c2d1449fa7d2706a875840818371ef6a62b52
parent7eb5606441bf11ba2ebd5f8904918dc82a2a3126 (diff)
downloadhaskell-427f9c122f5b1f130b0a342047c87ee0420050c9.tar.gz
Re-export GHC.Types from GHC.Exts
Several times in the past, it has happened that things from GHC.Types were not re-exported from GHC.Exts, forcing users to import either GHC.Types or GHC.Prim, which are subject to internal change without notice. We now re-export GHC.Types from GHC.Exts, which should avoid this happening again in the future. In particular, we now re-export `Multiplicity` and `MultMul`, which we didn't before. Fixes #20695
-rwxr-xr-xlibraries/base/GHC/Exts.hs105
-rw-r--r--libraries/base/changelog.md2
-rw-r--r--libraries/ghc-prim/GHC/Types.hs11
-rw-r--r--testsuite/tests/typecheck/should_run/KindInvariant.stderr3
4 files changed, 63 insertions, 58 deletions
diff --git a/libraries/base/GHC/Exts.hs b/libraries/base/GHC/Exts.hs
index b9d632095c..c03b397601 100755
--- a/libraries/base/GHC/Exts.hs
+++ b/libraries/base/GHC/Exts.hs
@@ -24,23 +24,28 @@
module GHC.Exts
(
- -- * Representations of some basic types
- Int(..),Word(..),Float(..),Double(..),
- Char(..),
+ -- * Primitive types
+
+ FUN, TYPE, -- See https://gitlab.haskell.org/ghc/ghc/issues/18302
+
+ -- ** Pointer types
Ptr(..), FunPtr(..),
- -- * The maximum tuple size
- maxTupleSize,
+ -- ** Other primitive types
+ module GHC.Types,
-- * Primitive operations
- FUN, -- See https://gitlab.haskell.org/ghc/ghc/issues/18302
+
module GHC.Prim,
module GHC.Prim.Ext,
+
+ -- ** Running 'RealWorld' state thread
+ runRW#,
+
+ -- ** Bit shift operations
shiftL#, shiftRL#, iShiftL#, iShiftRA#, iShiftRL#,
- isTrue#,
- Void#, -- Previously exported by GHC.Prim
- -- * Pointer comparison operations
+ -- ** Pointer comparison operations
-- See `Note [Pointer comparison operations]` in primops.txt.pp
reallyUnsafePtrEquality,
eqStableName#,
@@ -57,10 +62,10 @@ module GHC.Exts
sameTVar#,
sameIOPort#,
- -- * Compat wrapper
+ -- ** Compat wrapper
atomicModifyMutVar#,
- -- * Resize functions
+ -- ** Resize functions
--
-- | Resizing arrays of boxed elements is currently handled in
-- library space (rather than being a primop) since there is not
@@ -68,13 +73,20 @@ module GHC.Exts
-- may become primops in a future release of GHC.
resizeSmallMutableArray#,
- -- * Fusion
+ -- ** Fusion
build, augment,
- -- * Overloaded string literals
+ -- * Overloaded lists
+ IsList(..),
+
+ -- * Transform comprehensions
+ Down(..), groupWith, sortWith, the,
+
+ -- * Strings
+ -- ** Overloaded string literals
IsString(..),
- -- * CString
+ -- ** CString
unpackCString#,
unpackAppendCString#,
unpackFoldrCString#,
@@ -83,59 +95,46 @@ module GHC.Exts
cstringLength#,
-- * Debugging
+ -- ** Breakpoints
breakpoint, breakpointCond,
- -- * Ids with special behaviour
- inline, noinline, lazy, oneShot, considerAccessible, SPEC (..),
+ -- ** Event logging
+ traceEvent,
- -- * Running 'RealWorld' state thread
- runRW#,
+ -- ** The call stack
+ currentCallStack,
- -- * Casting class dictionaries with single methods
- withDict,
+ -- * Ids with special behaviour
+ inline, noinline, lazy, oneShot, considerAccessible,
- -- * Safe coercions
+ -- * SpecConstr annotations
+ SpecConstrAnnotation(..), SPEC (..),
+
+ -- * Coercions
+ -- ** Safe coercions
--
- -- | These are available from the /Trustworthy/ module "Data.Coerce" as well
+ -- | These are available from the /Trustworthy/ module "Data.Coerce" as well.
--
-- @since 4.7.0.0
- Data.Coerce.coerce, Data.Coerce.Coercible,
+ Data.Coerce.coerce,
- -- * Very unsafe coercion
+ -- ** Very unsafe coercion
unsafeCoerce#,
- -- * Equality
- type (~~),
-
- -- * Representation polymorphism
- GHC.Prim.TYPE, RuntimeRep(..), Levity(..),
- LiftedRep, UnliftedRep, UnliftedType,
- VecCount(..), VecElem(..),
-
- -- * Transform comprehensions
- Down(..), groupWith, sortWith, the,
-
- -- * Event logging
- traceEvent,
-
- -- * SpecConstr annotations
- SpecConstrAnnotation(..),
-
- -- * The call stack
- currentCallStack,
-
- -- * The Constraint kind
- Constraint,
-
- -- * The Any type
- Any,
+ -- ** Casting class dictionaries with single methods
+ withDict,
- -- * Overloaded lists
- IsList(..)
+ -- * The maximum tuple size
+ maxTupleSize,
) where
-import GHC.Prim hiding ( coerce, TYPE )
-import qualified GHC.Prim
+import GHC.Prim hiding ( coerce )
+import GHC.Types
+ hiding ( IO -- Exported from "GHC.IO"
+ , Type -- Exported from "Data.Kind"
+
+ -- GHC's internal representation of 'TyCon's, for 'Typeable'
+ , Module, TrName, TyCon, TypeLitSort, KindRep, KindBndr )
import qualified GHC.Prim.Ext
import GHC.Base hiding ( coerce )
import GHC.Ptr
diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md
index 7ddc112af4..52f6a56d0c 100644
--- a/libraries/base/changelog.md
+++ b/libraries/base/changelog.md
@@ -27,6 +27,8 @@
These new operators have the same fixity as the originals.
+ * `GHC.Exts` now re-exports `Multiplicity` and `MultMul`.
+
## 4.16.0.0 *Nov 2021*
* The unary tuple type, `Solo`, is now exported by `Data.Tuple`.
diff --git a/libraries/ghc-prim/GHC/Types.hs b/libraries/ghc-prim/GHC/Types.hs
index d40e7a8f38..22e637af6e 100644
--- a/libraries/ghc-prim/GHC/Types.hs
+++ b/libraries/ghc-prim/GHC/Types.hs
@@ -27,6 +27,7 @@ module GHC.Types (
-- Lists: []( [], (:) )
-- Type equality: (~)( Eq# )
+ -- * Built-in types
Bool(..), Char(..), Int(..), Word(..),
Float(..), Double(..),
Ordering(..), IO(..),
@@ -34,7 +35,11 @@ module GHC.Types (
SPEC(..),
Symbol,
Any,
+
+ -- * Type equality
type (~~), Coercible,
+
+ -- * Representation polymorphism
TYPE, Levity(..), RuntimeRep(..),
LiftedRep, UnliftedRep,
Type, UnliftedType, Constraint,
@@ -45,12 +50,12 @@ module GHC.Types (
VecCount(..), VecElem(..),
Void#,
+ -- * Multiplicity types
+ Multiplicity(..), MultMul,
+
-- * Runtime type representation
Module(..), TrName(..), TyCon(..), TypeLitSort(..),
KindRep(..), KindBndr,
-
- -- * Multiplicity Types
- Multiplicity(..), MultMul
) where
import GHC.Prim
diff --git a/testsuite/tests/typecheck/should_run/KindInvariant.stderr b/testsuite/tests/typecheck/should_run/KindInvariant.stderr
index fb4dd69779..ac31936e39 100644
--- a/testsuite/tests/typecheck/should_run/KindInvariant.stderr
+++ b/testsuite/tests/typecheck/should_run/KindInvariant.stderr
@@ -1,7 +1,6 @@
<interactive>:1:3: error:
• Couldn't match a lifted type with an unlifted type
- Expected kind ‘* -> *’,
- but ‘State#’ has kind ‘* -> GHC.Types.ZeroBitType’
+ Expected kind ‘* -> *’, but ‘State#’ has kind ‘* -> ZeroBitType’
• In the first argument of ‘T’, namely ‘State#’
In the type ‘T State#’