summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xlibraries/base/GHC/Exts.hs7
-rw-r--r--libraries/ghc-prim/GHC/Types.hs20
2 files changed, 24 insertions, 3 deletions
diff --git a/libraries/base/GHC/Exts.hs b/libraries/base/GHC/Exts.hs
index da73955cba..5ebdc11a13 100755
--- a/libraries/base/GHC/Exts.hs
+++ b/libraries/base/GHC/Exts.hs
@@ -203,8 +203,11 @@ traceEvent = Debug.Trace.traceEventIO
* *
********************************************************************** -}
--- Annotating a type with NoSpecConstr will make SpecConstr
--- not specialise for arguments of that type.
+-- | Deprecated, use 'SPEC' directly instead.
+--
+-- Annotating a type with 'NoSpecConstr' will make @SpecConstr@
+-- not specialise for arguments of that type,
+-- e. g., @{-# ANN type SPEC ForceSpecConstr #-}@.
-- This data type is defined here, rather than in the SpecConstr module
-- itself, so that importing it doesn't force stupidly linking the
diff --git a/libraries/ghc-prim/GHC/Types.hs b/libraries/ghc-prim/GHC/Types.hs
index 8b9d23787b..448618b537 100644
--- a/libraries/ghc-prim/GHC/Types.hs
+++ b/libraries/ghc-prim/GHC/Types.hs
@@ -435,7 +435,25 @@ you're reading this in 2023 then things went wrong). See #8326.
-- specializations. However, not all loops fall into this category.
--
-- Libraries can specify this by using 'SPEC' data type to inform which
--- loops should be aggressively specialized.
+-- loops should be aggressively specialized. For example,
+-- instead of
+--
+-- > loop x where loop arg = ...
+--
+-- write
+--
+-- > loop SPEC x where loop !_ arg = ...
+--
+-- There is no semantic difference between 'SPEC' and 'SPEC2',
+-- we just need a type with two contructors lest it is optimised away
+-- before @SpecConstr@.
+--
+-- This type is reexported from "GHC.Exts" since GHC 9.0 and @base-4.15@.
+-- For compatibility with earlier releases import it from "GHC.Types"
+-- in @ghc-prim@ package.
+--
+-- @since 0.3.1.0
+--
data SPEC = SPEC | SPEC2