[Git][ghc/ghc][wip/marge_bot_batch_merge_job] 2 commits: perf: Share Module in Iface Symbol Table
by Marge Bot (@marge-bot) 25 Jun '26
by Marge Bot (@marge-bot) 25 Jun '26
25 Jun '26
Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC
Commits:
2f1fc149 by Rodrigo Mesquita at 2026-06-25T08:57:45-04:00
perf: Share Module in Iface Symbol Table
This commit modifies the structure of the serialized `SymbolTable Name`
to then re-use and share the `Module` (both on disk and in memory) across
all `Name`s from the same module.
The new structure looks like:
<total name count>
$modules.size
for (mod, names) in $modules:
$mod
$names.size
for table_ix, occ in $names
$table_ix
$occ
i.e. we put the module just once, followed by all names in that module.
When deserializing, we deserialize the module just once, and all the
following `Name`s are constructed with a pointer to that same decoded
`Module`.
In `hoogle-test`, we must use `DNameEnv` rather than `Map Name`,
otherwise the output fixities order was susceptible to changes in the
uniques assigned to each Names, which is not stable.
Fixes #27401
-------------------------
Metric Decrease:
InstanceMatching
LinkableUsage01
hard_hole_fits
-------------------------
- - - - -
b173c1e7 by Zubin Duggal at 2026-06-25T08:57:47-04:00
testsuite: Report fragile failures as skipped in JUnit output
- - - - -
13 changed files:
- compiler/GHC/Iface/Binary.hs
- compiler/GHC/Unit/Module/Env.hs
- testsuite/driver/junit.py
- testsuite/tests/overloadedrecflds/should_compile/DRFPatSynExport.stdout
- testsuite/tests/rename/should_compile/T1792_imports.stdout
- testsuite/tests/rename/should_compile/T18264.stdout
- testsuite/tests/rename/should_compile/T4239.stdout
- testsuite/tests/showIface/DocsInHiFile1.stdout
- testsuite/tests/showIface/DocsInHiFileTH.stdout
- testsuite/tests/showIface/NoExportList.stdout
- testsuite/tests/typecheck/should_compile/subsumption_sort_hole_fits.stderr
- utils/haddock/haddock-api/src/Haddock/Interface/AttachInstances.hs
- utils/haddock/haddock-api/src/Haddock/InterfaceFile.hs
Changes:
=====================================
compiler/GHC/Iface/Binary.hs
=====================================
@@ -37,7 +37,6 @@ import GHC.Unit
import GHC.Unit.Module.ModIface
import GHC.Types.Name
import GHC.Platform.Profile
-import GHC.Types.Unique.FM
import GHC.Utils.Panic
import GHC.Utils.Binary as Binary
import GHC.Data.FastMutInt
@@ -61,7 +60,8 @@ import System.IO.Unsafe
import Data.Typeable (Typeable)
import qualified GHC.Data.Strict as Strict
import Data.Function ((&))
-
+import GHC.Types.Name.Env
+import Data.Maybe
-- ---------------------------------------------------------------------------
-- Reading and writing binary interface files
@@ -618,25 +618,27 @@ initNameReaderTable cache = do
}
data BinSymbolTable = BinSymbolTable {
- bin_symtab_next :: !FastMutInt, -- The next index to use
- bin_symtab_map :: !(IORef (UniqFM Name (Int,Name)))
- -- indexed by Name
+ bin_symtab_next :: !FastMutInt,
+ -- ^ The next index to use
+ bin_symtab_map :: !(IORef (NameEnv Int, ModuleEnv [(Int,Name)]))
+ -- ^ Deduplication indexed by Name
+ -- ; Group table data by module for serialization
}
initNameWriterTable :: IO (WriterTable, BinaryWriter Name)
initNameWriterTable = do
symtab_next <- newFastMutInt 0
- symtab_map <- newIORef emptyUFM
+ symtab_map <- newIORef (emptyNameEnv, emptyModuleEnv)
let bin_symtab =
BinSymbolTable
{ bin_symtab_next = symtab_next
- , bin_symtab_map = symtab_map
+ , bin_symtab_map = symtab_map
}
let put_symtab bh = do
name_count <- readFastMutInt symtab_next
- symtab_map <- readIORef symtab_map
- putSymbolTable bh name_count symtab_map
+ (_, symtab_tbl) <- readIORef symtab_map
+ putSymbolTable bh name_count symtab_tbl
pure name_count
return
@@ -647,40 +649,53 @@ initNameWriterTable = do
)
-putSymbolTable :: WriteBinHandle -> Int -> UniqFM Name (Int,Name) -> IO ()
+{- |
+The symbol table payload will look like:
+
+ <total name count>
+ $modules.size
+ for (mod, names) in $modules:
+ $mod
+ $names.size
+ for table_ix, occ in $names
+ $table_ix
+ $occ
+-}
+putSymbolTable :: WriteBinHandle -> Int -> ModuleEnv [(Int, Name)] -> IO ()
putSymbolTable bh name_count symtab = do
put_ bh name_count
- let names = elems (array (0,name_count-1) (nonDetEltsUFM symtab))
- -- It's OK to use nonDetEltsUFM here because the elements have
- -- indices that array uses to create order
- mapM_ (\n -> serialiseName bh n symtab) names
-
-
+ put_ bh (sizeModuleEnv symtab)
+ forM_ (moduleEnvToList symtab) $ \(mod,names) -> do
+ put_ bh mod
+ put_ bh (length names)
+ forM_ names $ \(table_ix, name) -> do
+ let occ = assertPpr (isExternalName name) (ppr name) (nameOccName name)
+ put_ bh table_ix
+ put_ bh occ
+
+-- | Decode the symbol table -- layout set by 'putSymbolTable'.
getSymbolTable :: ReadBinHandle -> NameCache -> IO (SymbolTable Name)
getSymbolTable bh name_cache = do
sz <- get bh :: IO Int
-- create an array of Names for the symbols and add them to the NameCache
updateNameCache' name_cache $ \cache0 -> do
- mut_arr <- newArray_ (0, sz-1) :: IO (IOArray Int Name)
- cache <- foldGet' (fromIntegral sz) bh cache0 $ \i (uid, mod_name, occ) cache -> do
- let mod = mkModule uid mod_name
- case lookupOrigNameCache cache mod occ of
- Just name -> do
- writeArray mut_arr (fromIntegral i) name
- return cache
- Nothing -> do
- uniq <- takeUniqFromNameCache name_cache
- let name = mkExternalName uniq mod occ noSrcSpan
- new_cache = extendOrigNameCache cache mod occ name
- writeArray mut_arr (fromIntegral i) name
- return new_cache
- arr <- unsafeFreeze mut_arr
- return (cache, arr)
-
-serialiseName :: WriteBinHandle -> Name -> UniqFM key (Int,Name) -> IO ()
-serialiseName bh name _ = do
- let mod = assertPpr (isExternalName name) (ppr name) (nameModule name)
- put_ bh (moduleUnit mod, moduleName mod, nameOccName name)
+ mut_arr <- newArray_ (0, sz-1) :: IO (IOArray Int Name)
+ mods_sz <- get bh :: IO Int
+ cache <-
+ foldGet' (fromIntegral mods_sz) bh cache0 $ \_mod_ix (mod,mod_nms_sz) cache1 -> do
+ foldGet' (fromIntegral (mod_nms_sz::Int)) bh cache1 $ \_mod_nms_ix (table_ix, occ) cache2 -> do
+ case lookupOrigNameCache cache2 mod occ of
+ Just name -> do
+ writeArray mut_arr table_ix name
+ return cache2
+ Nothing -> do
+ uniq <- takeUniqFromNameCache name_cache
+ let name = mkExternalName uniq mod occ noSrcSpan
+ cache3 = extendOrigNameCache cache2 mod occ name
+ writeArray mut_arr table_ix name
+ return cache3
+ arr <- unsafeFreeze mut_arr
+ return (cache, arr)
-- Note [Symbol table representation of names]
@@ -714,16 +729,26 @@ putName BinSymbolTable{
.|. (fromIntegral u :: Word32))
| otherwise
- = do symtab_map <- readIORef symtab_map_ref
- case lookupUFM symtab_map name of
- Just (off,_) -> put_ bh (fromIntegral off :: Word32)
+ = do (symtab_map,symtab_tbl) <- readIORef symtab_map_ref
+ case lookupNameEnv symtab_map name of
+ Just off -> put_ bh (fromIntegral off :: Word32)
Nothing -> do
- off <- readFastMutInt symtab_next
- -- massert (off < 2^(30 :: Int))
- writeFastMutInt symtab_next (off+1)
- writeIORef symtab_map_ref
- $! addToUFM symtab_map name (off,name)
- put_ bh (fromIntegral off :: Word32)
+ off <- freshIndex
+ let mod = nameModule name
+ let mod_nms = fromMaybe [] (lookupModuleEnv symtab_tbl mod)
+
+ let !symtab_map' = extendNameEnv symtab_map name off
+ let !symtab_tbl' = extendModuleEnv symtab_tbl mod ((off,name):mod_nms)
+ writeIORef symtab_map_ref $! ( symtab_map', symtab_tbl' )
+
+ put_ bh (fromIntegral off :: Word32)
+ where
+ freshIndex :: IO Int
+ freshIndex = do
+ off <- readFastMutInt symtab_next
+ -- massert (off < 2^(30 :: Int))
+ writeFastMutInt symtab_next (off+1)
+ return off
-- See Note [Symbol table representation of names]
getSymtabName :: SymbolTable Name
=====================================
compiler/GHC/Unit/Module/Env.hs
=====================================
@@ -9,7 +9,7 @@ module GHC.Unit.Module.Env
, alterModuleEnv
, partitionModuleEnv
, moduleEnvKeys, moduleEnvElts, moduleEnvToList
- , unitModuleEnv, isEmptyModuleEnv
+ , unitModuleEnv, isEmptyModuleEnv, sizeModuleEnv
, extendModuleEnvWith, filterModuleEnv, mapMaybeModuleEnv
-- * ModuleName mappings
@@ -176,6 +176,9 @@ unitModuleEnv m x = ModuleEnv (Map.singleton (NDModule m) x)
isEmptyModuleEnv :: ModuleEnv a -> Bool
isEmptyModuleEnv (ModuleEnv e) = Map.null e
+sizeModuleEnv :: ModuleEnv a -> Int
+sizeModuleEnv (ModuleEnv e) = Map.size e
+
-- | A set of 'Module's
type ModuleSet = Set NDModule
=====================================
testsuite/driver/junit.py
=====================================
@@ -14,12 +14,13 @@ def junit(t: TestRun) -> ET.ElementTree:
+ len(t.unexpected_stat_failures)
+ len(t.unexpected_passes)),
errors = str(len(t.framework_failures)),
+ skipped = str(len(t.fragile_failures)),
timestamp = datetime.now().isoformat())
- for res_type, group in [('stat failure', t.unexpected_stat_failures),
- ('unexpected failure', t.unexpected_failures),
- ('unexpected pass', t.unexpected_passes),
- ('fragile failure', t.fragile_failures)]:
+ for kind, res_type, group in [('failure', 'stat failure', t.unexpected_stat_failures),
+ ('failure', 'unexpected failure', t.unexpected_failures),
+ ('failure', 'unexpected pass', t.unexpected_passes),
+ ('skipped', 'fragile failure', t.fragile_failures)]:
for tr in group:
testcase = ET.SubElement(testsuite, 'testcase',
classname = tr.way,
@@ -30,7 +31,7 @@ def junit(t: TestRun) -> ET.ElementTree:
if tr.stderr:
message += ['', 'stderr:', '==========', tr.stderr]
- result = ET.SubElement(testcase, 'failure',
+ result = ET.SubElement(testcase, kind,
type = res_type,
message = tr.reason)
result.text = '\n'.join(message)
=====================================
testsuite/tests/overloadedrecflds/should_compile/DRFPatSynExport.stdout
=====================================
@@ -1 +1 @@
-import DRFPatSynExport_A ( MkT, m )
+import DRFPatSynExport_A ( m, MkT )
=====================================
testsuite/tests/rename/should_compile/T1792_imports.stdout
=====================================
@@ -1 +1 @@
-import qualified Data.ByteString as B ( putStr, readFile )
+import qualified Data.ByteString as B ( readFile, putStr )
=====================================
testsuite/tests/rename/should_compile/T18264.stdout
=====================================
@@ -1,6 +1,6 @@
import Data.Char ( isDigit, isLetter )
import Data.List ( sortOn )
-import Data.Maybe ( fromJust, isJust )
+import Data.Maybe ( isJust, fromJust )
import qualified Data.Char as C ( isLetter, isDigit )
import qualified Data.List as S ( sort )
import qualified Data.List as T ( nub )
=====================================
testsuite/tests/rename/should_compile/T4239.stdout
=====================================
@@ -1 +1 @@
-import T4239A ( (·), type (:+++)((:---), (:+++), X) )
+import T4239A ( type (:+++)((:---), (:+++), X), (·) )
=====================================
testsuite/tests/showIface/DocsInHiFile1.stdout
=====================================
@@ -19,49 +19,53 @@ docs:
export docs:
[]
declaration docs:
- [elem -> [text:
- -- | '()', 'elem'.
- identifiers:
- {DocsInHiFile.hs:14:13-16}
- GHC.Internal.Data.Foldable.elem
- {DocsInHiFile.hs:14:13-16}
- elem],
- D -> [text:
- -- | A datatype.
+ [F -> [text:
+ -- | A type family
identifiers:],
- D0 -> [text:
- -- ^ A constructor for 'D'. '
- identifiers:
- {DocsInHiFile.hs:20:32}
- D],
- D1 -> [text:
- -- ^ Another constructor
+ D:R:FInt -> [text:
+ -- | A type family instance
+ identifiers:],
+ D' -> [text:
+ -- | Another datatype...
+ identifiers:,
+ text:
+ -- ^ ...with two docstrings.
identifiers:],
- P -> [text:
- -- | A class
- identifiers:],
- p -> [text:
- -- | A class method
- identifiers:],
$fShowD -> [text:
-- ^ 'Show' instance
identifiers:
{DocsInHiFile.hs:22:25-28}
GHC.Internal.Show.Show],
- D' -> [text:
- -- | Another datatype...
- identifiers:,
- text:
- -- ^ ...with two docstrings.
+ p -> [text:
+ -- | A class method
+ identifiers:],
+ P -> [text:
+ -- | A class
+ identifiers:],
+ D1 -> [text:
+ -- ^ Another constructor
identifiers:],
- D:R:FInt -> [text:
- -- | A type family instance
- identifiers:],
- F -> [text:
- -- | A type family
- identifiers:]]
+ D0 -> [text:
+ -- ^ A constructor for 'D'. '
+ identifiers:
+ {DocsInHiFile.hs:20:32}
+ D],
+ D -> [text:
+ -- | A datatype.
+ identifiers:],
+ elem -> [text:
+ -- | '()', 'elem'.
+ identifiers:
+ {DocsInHiFile.hs:14:13-16}
+ GHC.Internal.Data.Foldable.elem
+ {DocsInHiFile.hs:14:13-16}
+ elem]]
arg docs:
- [add -> 0:
+ [p -> 0:
+ text:
+ -- ^ An argument
+ identifiers:,
+ add -> 0:
text:
-- ^ First summand for 'add'
identifiers:
@@ -74,11 +78,7 @@ docs:
2:
text:
-- ^ Sum
- identifiers:,
- p -> 0:
- text:
- -- ^ An argument
- identifiers:]
+ identifiers:]
documentation structure:
avails:
[elem]
=====================================
testsuite/tests/showIface/DocsInHiFileTH.stdout
=====================================
@@ -6,137 +6,153 @@ docs:
export docs:
[]
declaration docs:
- [Tup2 -> [text:
- -- |Matches a tuple of (a, a)
- identifiers:],
- f -> [text:
- -- |The meaning of life
- identifiers:],
- g -> [text:
- -- |Some documentation
- identifiers:],
- qux -> [text:
- -- |This is qux
+ [D:R:WD13Foo -> [text:
+ -- |13
+ identifiers:],
+ D:R:WD11Int0 -> [text:
+ -- |This is a data instance
+ identifiers:],
+ D:R:WD11Foo0 -> [text:
+ -- |11
+ identifiers:],
+ D:R:WD11Bool0 -> [text:
+ -- |This is a newtype instance
+ identifiers:],
+ D:R:EBool -> [text:
+ -- |A type family instance
+ identifiers:],
+ $fF -> [text:
+ -- |14
identifiers:],
- sin -> [text:
- -- |15
+ $fDka -> [text:
+ -- |Another new instance
+ identifiers:],
+ $fCTYPEList -> [text:
+ -- |Another new instance
+ identifiers:],
+ $fCTYPEInt -> [text:
+ -- |A new instance
+ identifiers:],
+ $fCTYPEFoo -> [text:
+ -- |7
+ identifiers:],
+ WD6 -> [text:
+ -- |6
identifiers:],
- wd1 -> [text:
- -- |1
+ WD5 -> [text:
+ -- |5
identifiers:],
- wd17 -> [text:
- -- |17
+ WD4 -> [text:
+ -- |4
+ identifiers:],
+ WD3 -> [text:
+ -- |3
+ identifiers:],
+ WD12 -> [text:
+ -- |12
identifiers:],
- wd18 -> [text:
- -- |18
+ WD11Int -> [text:
+ -- |This is a data instance constructor
+ identifiers:],
+ WD11Bool -> [text:
+ -- |This is a newtype instance constructor
+ identifiers:],
+ WD10 -> [text:
+ -- |10
identifiers:],
- wd2 -> [text:
- -- |2
- identifiers:],
- wd20 -> [text:
- -- |20
+ quuz1_a -> [text:
+ -- |This is the record constructor's argument
+ identifiers:],
+ Quuz -> [text:
+ -- |This is a record constructor
identifiers:],
- wd8 -> [text:
- -- |8
+ Quux2 -> [text:
+ -- |This is Quux2
+ identifiers:],
+ Quux1 -> [text:
+ -- |This is Quux1
+ identifiers:],
+ Quux -> [text:
+ -- |This is Quux
+ identifiers:],
+ prettyPrint -> [text:
+ -- |Prettily prints the object
+ identifiers:],
+ Pretty -> [text:
+ -- |My cool class
+ identifiers:],
+ Foo -> [text:
+ -- |A new constructor
identifiers:],
- C -> [text:
- -- |A new class
+ Foo -> [text:
+ -- |A new data type
+ identifiers:],
+ E -> [text:
+ -- |A type family
identifiers:],
- Corge -> [text:
- -- |This is a newtype record constructor
- identifiers:],
runCorge -> [text:
-- |This is the newtype record constructor's argument
identifiers:],
- E -> [text:
- -- |A type family
+ Corge -> [text:
+ -- |This is a newtype record constructor
+ identifiers:],
+ C -> [text:
+ -- |A new class
identifiers:],
- Foo -> [text:
- -- |A new data type
- identifiers:],
- Foo -> [text:
- -- |A new constructor
+ wd8 -> [text:
+ -- |8
identifiers:],
- Pretty -> [text:
- -- |My cool class
- identifiers:],
- prettyPrint -> [text:
- -- |Prettily prints the object
- identifiers:],
- Quux -> [text:
- -- |This is Quux
- identifiers:],
- Quux1 -> [text:
- -- |This is Quux1
- identifiers:],
- Quux2 -> [text:
- -- |This is Quux2
- identifiers:],
- Quuz -> [text:
- -- |This is a record constructor
+ wd20 -> [text:
+ -- |20
identifiers:],
- quuz1_a -> [text:
- -- |This is the record constructor's argument
- identifiers:],
- WD10 -> [text:
- -- |10
+ wd2 -> [text:
+ -- |2
+ identifiers:],
+ wd18 -> [text:
+ -- |18
identifiers:],
- WD11Bool -> [text:
- -- |This is a newtype instance constructor
- identifiers:],
- WD11Int -> [text:
- -- |This is a data instance constructor
- identifiers:],
- WD12 -> [text:
- -- |12
+ wd17 -> [text:
+ -- |17
identifiers:],
- WD3 -> [text:
- -- |3
- identifiers:],
- WD4 -> [text:
- -- |4
- identifiers:],
- WD5 -> [text:
- -- |5
+ wd1 -> [text:
+ -- |1
identifiers:],
- WD6 -> [text:
- -- |6
+ sin -> [text:
+ -- |15
identifiers:],
- $fCTYPEFoo -> [text:
- -- |7
- identifiers:],
- $fCTYPEInt -> [text:
- -- |A new instance
- identifiers:],
- $fCTYPEList -> [text:
- -- |Another new instance
- identifiers:],
- $fDka -> [text:
- -- |Another new instance
- identifiers:],
- $fF -> [text:
- -- |14
+ qux -> [text:
+ -- |This is qux
identifiers:],
- D:R:EBool -> [text:
- -- |A type family instance
- identifiers:],
- D:R:WD11Bool0 -> [text:
- -- |This is a newtype instance
- identifiers:],
- D:R:WD11Foo0 -> [text:
- -- |11
- identifiers:],
- D:R:WD11Int0 -> [text:
- -- |This is a data instance
- identifiers:],
- D:R:WD13Foo -> [text:
- -- |13
- identifiers:]]
+ g -> [text:
+ -- |Some documentation
+ identifiers:],
+ f -> [text:
+ -- |The meaning of life
+ identifiers:],
+ Tup2 -> [text:
+ -- |Matches a tuple of (a, a)
+ identifiers:]]
arg docs:
- [Tup2 -> 0:
- text:
- -- |The thing to match twice
- identifiers:,
+ [WD11Int -> 0:
+ text:
+ -- |This is a data instance constructor argument
+ identifiers:,
+ WD11Bool -> 0:
+ text:
+ -- |This is a newtype instance constructor argument
+ identifiers:,
+ Quux2 -> 1:
+ text:
+ -- |I am a bool
+ identifiers:,
+ Quux1 -> 0:
+ text:
+ -- |I am an integer
+ identifiers:,
+ qux -> 1:
+ text:
+ -- |Arg dos
+ identifiers:,
h -> 0:
text:
-- ^Your favourite number
@@ -149,26 +165,10 @@ docs:
text:
-- ^A return value
identifiers:,
- qux -> 1:
- text:
- -- |Arg dos
- identifiers:,
- Quux1 -> 0:
- text:
- -- |I am an integer
- identifiers:,
- Quux2 -> 1:
- text:
- -- |I am a bool
- identifiers:,
- WD11Bool -> 0:
- text:
- -- |This is a newtype instance constructor argument
- identifiers:,
- WD11Int -> 0:
- text:
- -- |This is a data instance constructor argument
- identifiers:]
+ Tup2 -> 0:
+ text:
+ -- |The thing to match twice
+ identifiers:]
documentation structure:
avails:
[f]
=====================================
testsuite/tests/showIface/NoExportList.stdout
=====================================
@@ -6,7 +6,10 @@ docs:
export docs:
[]
declaration docs:
- [fα -> [text:
+ [$fEqR -> [text:
+ -- | A very lazy Eq instance
+ identifiers:],
+ fα -> [text:
-- ^ Documentation for 'R'\'s 'fα' field.
identifiers:
{NoExportList.hs:14:38}
@@ -14,10 +17,7 @@ docs:
{NoExportList.hs:14:38}
R
{NoExportList.hs:14:45-46}
- fα],
- $fEqR -> [text:
- -- | A very lazy Eq instance
- identifiers:]]
+ fα]]
arg docs:
[]
documentation structure:
@@ -99,3 +99,4 @@ docs:
ListTuplePuns
ImplicitStagePersistence
extensible fields:
+
=====================================
testsuite/tests/typecheck/should_compile/subsumption_sort_hole_fits.stderr
=====================================
@@ -5,10 +5,10 @@ subsumption_sort_hole_fits.hs:2:5: warning: [GHC-88464] [-Wtyped-holes (in -Wdef
• Relevant bindings include
f :: [String] (bound at subsumption_sort_hole_fits.hs:2:1)
Valid hole fits include
- lines :: String -> [String]
+ words :: String -> [String]
(imported from ‘Prelude’
(and originally defined in ‘GHC.Internal.Data.OldList’))
- words :: String -> [String]
+ lines :: String -> [String]
(imported from ‘Prelude’
(and originally defined in ‘GHC.Internal.Data.OldList’))
repeat :: forall a. a -> [a]
=====================================
utils/haddock/haddock-api/src/Haddock/Interface/AttachInstances.hs
=====================================
@@ -251,10 +251,12 @@ attachToExportItem cls_index fam_index index expInfo getInstDoc getFixity getIns
}
where
fixities :: [(Name, Fixity)]
- !fixities = force . Map.toList $ List.foldl' f Map.empty all_names
+ -- Use DNameEnv to guarantee a deterministic output regardless of the
+ -- uniques assigned to each_name e.g. off of the interface file.
+ !fixities = force . eltsDNameEnv $ List.foldl' f emptyDNameEnv all_names
- f :: Map.Map Name Fixity -> Name -> Map.Map Name Fixity
- f !fs n = Map.alter (<|> getFixity n) n fs
+ f :: DNameEnv (Name, Fixity) -> Name -> DNameEnv (Name, Fixity)
+ f !fs n = alterDNameEnv (<|> ((,) n <$> getFixity n)) fs n
patsyn_names :: [Name]
patsyn_names = concatMap (getMainDeclBinder emptyOccEnv . fst) patsyns
=====================================
utils/haddock/haddock-api/src/Haddock/InterfaceFile.hs
=====================================
@@ -40,6 +40,7 @@ import Data.Coerce (coerce)
import Data.Function ((&))
import Data.IORef
import Data.Map (Map)
+import Data.Maybe (fromMaybe)
import Data.Version
import Data.Word
import GHC hiding (NoLink)
@@ -50,7 +51,9 @@ import GHC.Iface.Type (IfaceType, putIfaceType)
import GHC.Types.Name.Cache
import GHC.Types.Unique
import GHC.Types.Unique.FM
+import GHC.Types.Name.Env
import GHC.Unit.State
+import GHC.Unit.Module.Env
import GHC.Utils.Binary
import Haddock.Types
import Text.ParserCombinators.ReadP (readP_to_S)
@@ -171,7 +174,7 @@ writeInterfaceFile filename iface = do
-- Make some intial state
symtab_next <- newFastMutInt 0
- symtab_map <- newIORef emptyUFM
+ symtab_map <- newIORef (emptyNameEnv, emptyModuleEnv)
let bin_symtab =
BinSymbolTable
{ bin_symtab_next = symtab_next
@@ -211,8 +214,8 @@ writeInterfaceFile filename iface = do
-- write the symbol table itself
symtab_next' <- readFastMutInt symtab_next
- symtab_map' <- readIORef symtab_map
- putSymbolTable bh symtab_next' symtab_map'
+ (_, symtab_tbl') <- readIORef symtab_map
+ putSymbolTable bh symtab_next' symtab_tbl'
-- write the dictionary pointer at the fornt of the file
dict_p <- tellBinWriter bh
@@ -269,20 +272,30 @@ putName
bh
name =
do
- symtab_map <- readIORef symtab_map_ref
- case lookupUFM symtab_map name of
- Just (off, _) -> put_ bh (fromIntegral off :: Word32)
+ (symtab_map, symtab_tbl) <- readIORef symtab_map_ref
+ case lookupNameEnv symtab_map name of
+ Just off -> put_ bh (fromIntegral off :: Word32)
Nothing -> do
- off <- readFastMutInt symtab_next
- writeFastMutInt symtab_next (off + 1)
- writeIORef symtab_map_ref $!
- addToUFM symtab_map name (off, name)
+ off <- freshIndex
+ let mod' = nameModule name
+ let mod_nms = fromMaybe [] (lookupModuleEnv symtab_tbl mod')
+
+ let !symtab_map' = extendNameEnv symtab_map name off
+ let !symtab_tbl' = extendModuleEnv symtab_tbl mod' ((off, name):mod_nms)
+ writeIORef symtab_map_ref $! (symtab_map', symtab_tbl')
put_ bh (fromIntegral off :: Word32)
+ where
+ freshIndex :: IO Int
+ freshIndex = do
+ off <- readFastMutInt symtab_next
+ writeFastMutInt symtab_next (off + 1)
+ return off
data BinSymbolTable = BinSymbolTable
{ bin_symtab_next :: !FastMutInt -- The next index to use
- , bin_symtab_map :: !(IORef (UniqFM Name (Int, Name)))
- -- indexed by Name
+ , bin_symtab_map :: !(IORef (NameEnv Int, ModuleEnv [(Int, Name)]))
+ -- ^ Deduplication indexed by Name
+ -- ; Group table data by module for serialization
}
putFastString :: BinDictionary -> WriteBinHandle -> FastString -> IO ()
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/263c433c94d4f62bacfe12ba6c60c8…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/263c433c94d4f62bacfe12ba6c60c8…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][wip/sol/remove-ddump-json] 10 commits: Add explicit setBit/clearBit/complementBit for instance Bits Integer (#21176)
by Simon Hengel (@sol) 25 Jun '26
by Simon Hengel (@sol) 25 Jun '26
25 Jun '26
Simon Hengel pushed to branch wip/sol/remove-ddump-json at Glasgow Haskell Compiler / GHC
Commits:
f235d183 by Simon Jakobi at 2026-06-25T05:51:18-04:00
Add explicit setBit/clearBit/complementBit for instance Bits Integer (#21176)
The default setBit, clearBit, and complementBit methods allocate
intermediate Integers per call. Define them explicitly via the new
integerSetBit[#], integerClearBit[#] and integerComplementBit[#], built
on the BigNat# primitives, which avoid those allocations. Allocation is not
eliminated entirely -- the negative (IN) cases would need in-place mutation,
which is left as future work.
The default methods constant-folded on literal arguments via the
integerOr/integerAnd/integerXor rules, which fold literal Integers of any
size. The explicit functions have no such rule, so they (their Word-argument
wrappers, and the Bits Integer methods) are marked INLINE to expose the
underlying primops to the simplifier; see Note [INLINE for constant folding
of bit operations]. This restores folding only on the small-int (IS) path --
large literal Integers (IP/IN) are no longer constant-folded, a minor
regression for that case. T8832 covers the IS-path folding.
The new golden-output test T21176 checks all three operations against the
default implementations across the sign/size boundaries, recording each
result plus its integerCheck validity. The base and ghc-bignum interface-
stability export goldens gain the new functions.
The main changelog entry lives in changelog.d under a new ghc-internal
section (renamed from ghc-prim).
CLC proposal: https://github.com/haskell/core-libraries-committee/issues/423
Co-Authored-By: Claude Opus 4.7 <noreply(a)anthropic.com>
- - - - -
202ed264 by Marc Scholten at 2026-06-25T05:52:21-04:00
haddock: use Text in documentation pipeline
This patch moves Haddock's documentation pipeline from String to Text
where the data is already textual. It avoids repeated conversions while
keeping the existing decoding behavior for invalid UTF-8 docstring
chunks.
The main changes are:
* Render and carry docstrings as Text in Haddock-facing paths.
* Use the Binary Text instance from GHC.Utils.Binary for Haddock
interface files, and bump the Haddock binary interface version.
* Add a FastString HTML instance so XHTML rendering avoids
intermediate String allocation.
* Keep HsDocStringChunk decoding lenient, matching the previous
unpackHDSC behavior on invalid UTF-8 input.
* Update the xhtml submodule to 3000.4.1.0, which contains the
apostrophe escaping fix used by the Haddock test output.
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot(a)users.noreply.github.com>
Co-authored-by: Claude Opus 4.5 <noreply(a)anthropic.com>
Assisted-by: Codex <codex(a)openai.com>
- - - - -
a72ff58f by mangoiv at 2026-06-25T05:53:07-04:00
compiler: rename ZonkAny to UnusedType and add pretty printing logic
ZonkAny is a hard to understand name for users who do not know how the
compiler works internally. Additionally, it is confusing that ZonkAny,
while being a concrete type *represents* a meta variable, espeically in
the compiler output.
This patch changes the name of ZonkAny to UnusedType which is closer to
its intended semantics and adds special pretty printing logic to display
this type in the same fashion the compiler displays meta variables in
other places, whenever they leak from the implementation to the user.
It also exports the type from ghc-internal:GHC.Internal.Types in order
to expose documentation.
Fixes #27390
Co-Authored-By: Sam Derbyshire <sam.derbyshire(a)gmail.com>
- - - - -
935467ed by Simon Hengel at 2026-06-25T19:39:02+07:00
Rename `MCDiagnostic` to `InternalMCDiagnostic`
`MCDiagnostic` is meant to be used for compiler diagnostics.
Any code that creates `MCDiagnostic` directly, without going through
`GHC.Driver.Errors.printMessage`, sidesteps `-fdiagnostics-as-json` (see
e.g. !14616, !14475, !14492 !14548).
To avoid this in the future, this change more narrowly controls who
creates `MCDiagnostic` (see #24113).
- - - - -
6f85922b by Simon Hengel at 2026-06-25T19:50:03+07:00
Remove -ddump-json (fixes #24113)
- - - - -
dd84da16 by Simon Hengel at 2026-06-25T19:50:03+07:00
Add SrcSpan to MCDiagnostic
- - - - -
4b5d41f7 by Simon Hengel at 2026-06-25T19:50:03+07:00
Get rid of mkLocMessage
- - - - -
e89e7e32 by Simon Hengel at 2026-06-25T19:50:03+07:00
Add Message data type
- - - - -
c7f60621 by Simon Hengel at 2026-06-25T19:50:03+07:00
Get rid of MessageClass
- - - - -
fcf52d24 by Simon Hengel at 2026-06-25T19:50:03+07:00
Remove JSON logging
- - - - -
107 changed files:
- + changelog.d/T21176
- changelog.d/config
- + changelog.d/unused-type
- compiler/GHC/Builtin/Names.hs
- compiler/GHC/Builtin/Types.hs
- compiler/GHC/Core/Opt/Monad.hs
- compiler/GHC/Driver/Errors.hs
- compiler/GHC/Driver/Flags.hs
- compiler/GHC/Driver/Main/Passes.hs
- compiler/GHC/Driver/Make.hs
- compiler/GHC/Driver/Monad.hs
- compiler/GHC/Driver/Pipeline.hs
- compiler/GHC/Driver/Pipeline/LogQueue.hs
- compiler/GHC/Driver/Session.hs
- compiler/GHC/Hs/DocString.hs
- compiler/GHC/HsToCore/Expr.hs
- compiler/GHC/HsToCore/Monad.hs
- compiler/GHC/Iface/Load.hs
- compiler/GHC/Iface/Type.hs
- compiler/GHC/Linker/Deps.hs
- compiler/GHC/Linker/Loader.hs
- compiler/GHC/Runtime/Debugger.hs
- compiler/GHC/Runtime/Interpreter.hs
- compiler/GHC/Tc/Errors.hs
- compiler/GHC/Tc/Types.hs
- compiler/GHC/Tc/Utils/Monad.hs
- compiler/GHC/Tc/Utils/TcType.hs
- compiler/GHC/Tc/Zonk/Type.hs
- compiler/GHC/Types/Error.hs
- − compiler/GHC/Types/Error.hs-boot
- compiler/GHC/Types/SourceError.hs
- compiler/GHC/Utils/Error.hs
- compiler/GHC/Utils/Logger.hs
- docs/users_guide/debugging.rst
- ghc/GHCi/UI.hs
- ghc/GHCi/UI/Exception.hs
- libraries/base/changelog.md
- libraries/base/src/GHC/Base.hs
- libraries/base/src/GHC/Exts.hs
- libraries/ghc-bignum/changelog.md
- libraries/ghc-experimental/src/GHC/PrimOps.hs
- libraries/ghc-internal/src/GHC/Internal/Bignum/Integer.hs
- libraries/ghc-internal/src/GHC/Internal/Bits.hs
- libraries/ghc-internal/src/GHC/Internal/Types.hs
- libraries/xhtml
- testsuite/tests/driver/T16167.stderr
- − testsuite/tests/driver/T16167.stdout
- testsuite/tests/driver/all.T
- testsuite/tests/driver/json2.stderr
- − testsuite/tests/driver/json_dump.hs
- − testsuite/tests/driver/json_dump.stderr
- testsuite/tests/ghc-api/T7478/T7478.hs
- testsuite/tests/interface-stability/ghc-bignum-exports.stdout
- testsuite/tests/interface-stability/ghc-prim-exports.stdout
- testsuite/tests/interface-stability/ghc-prim-exports.stdout-mingw32
- + testsuite/tests/numeric/should_run/T21176.hs
- + testsuite/tests/numeric/should_run/T21176.stdout
- + testsuite/tests/numeric/should_run/T21176.stdout-ws-32
- testsuite/tests/numeric/should_run/all.T
- testsuite/tests/perf/compiler/T11068.stdout
- testsuite/tests/plugins/hooks-plugin/Hooks/LogPlugin.hs
- testsuite/tests/pmcheck/should_compile/T12957.stderr
- testsuite/tests/profiling/should_run/staticcallstack002.stdout
- testsuite/tests/simplCore/should_compile/Makefile
- testsuite/tests/simplCore/should_compile/T13156.stdout
- testsuite/tests/simplCore/should_compile/T26615.stderr
- testsuite/tests/simplCore/should_compile/T8832.hs
- testsuite/tests/simplCore/should_compile/T8832.stdout
- testsuite/tests/typecheck/should_fail/T13292.stderr
- + testsuite/tests/typecheck/should_fail/T27390-explicit-kinds.stderr
- + testsuite/tests/typecheck/should_fail/T27390.hs
- + testsuite/tests/typecheck/should_fail/T27390.stderr
- + testsuite/tests/typecheck/should_fail/T27390a.hs
- testsuite/tests/typecheck/should_fail/all.T
- utils/check-exact/Main.hs
- utils/check-exact/Preprocess.hs
- utils/haddock/haddock-api/src/Haddock.hs
- utils/haddock/haddock-api/src/Haddock/Backends/Hoogle.hs
- utils/haddock/haddock-api/src/Haddock/Backends/Hyperlinker.hs
- utils/haddock/haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs
- utils/haddock/haddock-api/src/Haddock/Backends/LaTeX.hs
- utils/haddock/haddock-api/src/Haddock/Backends/Xhtml.hs
- utils/haddock/haddock-api/src/Haddock/Backends/Xhtml/DocMarkup.hs
- utils/haddock/haddock-api/src/Haddock/Backends/Xhtml/Meta.hs
- utils/haddock/haddock-api/src/Haddock/Backends/Xhtml/Names.hs
- utils/haddock/haddock-api/src/Haddock/Backends/Xhtml/Utils.hs
- utils/haddock/haddock-api/src/Haddock/Doc.hs
- utils/haddock/haddock-api/src/Haddock/GhcUtils.hs
- utils/haddock/haddock-api/src/Haddock/Interface/AttachInstances.hs
- utils/haddock/haddock-api/src/Haddock/Interface/Create.hs
- utils/haddock/haddock-api/src/Haddock/Interface/Json.hs
- utils/haddock/haddock-api/src/Haddock/Interface/LexParseRn.hs
- utils/haddock/haddock-api/src/Haddock/Interface/ParseModuleHeader.hs
- utils/haddock/haddock-api/src/Haddock/Interface/Rename.hs
- utils/haddock/haddock-api/src/Haddock/InterfaceFile.hs
- utils/haddock/haddock-api/src/Haddock/Options.hs
- utils/haddock/haddock-api/src/Haddock/Parser.hs
- utils/haddock/haddock-api/src/Haddock/Types.hs
- utils/haddock/haddock-api/src/Haddock/Utils/Json.hs
- utils/haddock/haddock-api/src/Haddock/Utils/Json/Parser.hs
- utils/haddock/haddock-api/src/Haddock/Utils/Json/Types.hs
- utils/haddock/haddock-library/src/Documentation/Haddock/Doc.hs
- utils/haddock/haddock-library/src/Documentation/Haddock/Markup.hs
- utils/haddock/haddock-library/src/Documentation/Haddock/Parser.hs
- utils/haddock/haddock-library/src/Documentation/Haddock/Parser/Util.hs
- utils/haddock/haddock-library/src/Documentation/Haddock/Types.hs
- utils/haddock/haddock-library/test/Documentation/Haddock/ParserSpec.hs
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/f8c5b27454cf665394cbbc31afd7d9…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/f8c5b27454cf665394cbbc31afd7d9…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][wip/sol/rename-mc-diagnostics] 4 commits: Add explicit setBit/clearBit/complementBit for instance Bits Integer (#21176)
by Simon Hengel (@sol) 25 Jun '26
by Simon Hengel (@sol) 25 Jun '26
25 Jun '26
Simon Hengel pushed to branch wip/sol/rename-mc-diagnostics at Glasgow Haskell Compiler / GHC
Commits:
f235d183 by Simon Jakobi at 2026-06-25T05:51:18-04:00
Add explicit setBit/clearBit/complementBit for instance Bits Integer (#21176)
The default setBit, clearBit, and complementBit methods allocate
intermediate Integers per call. Define them explicitly via the new
integerSetBit[#], integerClearBit[#] and integerComplementBit[#], built
on the BigNat# primitives, which avoid those allocations. Allocation is not
eliminated entirely -- the negative (IN) cases would need in-place mutation,
which is left as future work.
The default methods constant-folded on literal arguments via the
integerOr/integerAnd/integerXor rules, which fold literal Integers of any
size. The explicit functions have no such rule, so they (their Word-argument
wrappers, and the Bits Integer methods) are marked INLINE to expose the
underlying primops to the simplifier; see Note [INLINE for constant folding
of bit operations]. This restores folding only on the small-int (IS) path --
large literal Integers (IP/IN) are no longer constant-folded, a minor
regression for that case. T8832 covers the IS-path folding.
The new golden-output test T21176 checks all three operations against the
default implementations across the sign/size boundaries, recording each
result plus its integerCheck validity. The base and ghc-bignum interface-
stability export goldens gain the new functions.
The main changelog entry lives in changelog.d under a new ghc-internal
section (renamed from ghc-prim).
CLC proposal: https://github.com/haskell/core-libraries-committee/issues/423
Co-Authored-By: Claude Opus 4.7 <noreply(a)anthropic.com>
- - - - -
202ed264 by Marc Scholten at 2026-06-25T05:52:21-04:00
haddock: use Text in documentation pipeline
This patch moves Haddock's documentation pipeline from String to Text
where the data is already textual. It avoids repeated conversions while
keeping the existing decoding behavior for invalid UTF-8 docstring
chunks.
The main changes are:
* Render and carry docstrings as Text in Haddock-facing paths.
* Use the Binary Text instance from GHC.Utils.Binary for Haddock
interface files, and bump the Haddock binary interface version.
* Add a FastString HTML instance so XHTML rendering avoids
intermediate String allocation.
* Keep HsDocStringChunk decoding lenient, matching the previous
unpackHDSC behavior on invalid UTF-8 input.
* Update the xhtml submodule to 3000.4.1.0, which contains the
apostrophe escaping fix used by the Haddock test output.
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot(a)users.noreply.github.com>
Co-authored-by: Claude Opus 4.5 <noreply(a)anthropic.com>
Assisted-by: Codex <codex(a)openai.com>
- - - - -
a72ff58f by mangoiv at 2026-06-25T05:53:07-04:00
compiler: rename ZonkAny to UnusedType and add pretty printing logic
ZonkAny is a hard to understand name for users who do not know how the
compiler works internally. Additionally, it is confusing that ZonkAny,
while being a concrete type *represents* a meta variable, espeically in
the compiler output.
This patch changes the name of ZonkAny to UnusedType which is closer to
its intended semantics and adds special pretty printing logic to display
this type in the same fashion the compiler displays meta variables in
other places, whenever they leak from the implementation to the user.
It also exports the type from ghc-internal:GHC.Internal.Types in order
to expose documentation.
Fixes #27390
Co-Authored-By: Sam Derbyshire <sam.derbyshire(a)gmail.com>
- - - - -
935467ed by Simon Hengel at 2026-06-25T19:39:02+07:00
Rename `MCDiagnostic` to `InternalMCDiagnostic`
`MCDiagnostic` is meant to be used for compiler diagnostics.
Any code that creates `MCDiagnostic` directly, without going through
`GHC.Driver.Errors.printMessage`, sidesteps `-fdiagnostics-as-json` (see
e.g. !14616, !14475, !14492 !14548).
To avoid this in the future, this change more narrowly controls who
creates `MCDiagnostic` (see #24113).
- - - - -
85 changed files:
- + changelog.d/T21176
- changelog.d/config
- + changelog.d/unused-type
- compiler/GHC/Builtin/Names.hs
- compiler/GHC/Builtin/Types.hs
- compiler/GHC/Driver/Errors.hs
- compiler/GHC/Driver/Main/Passes.hs
- compiler/GHC/Driver/Pipeline.hs
- compiler/GHC/Hs/DocString.hs
- compiler/GHC/HsToCore/Expr.hs
- compiler/GHC/HsToCore/Monad.hs
- compiler/GHC/Iface/Type.hs
- compiler/GHC/Tc/Errors.hs
- compiler/GHC/Tc/Types.hs
- compiler/GHC/Tc/Utils/Monad.hs
- compiler/GHC/Tc/Utils/TcType.hs
- compiler/GHC/Tc/Zonk/Type.hs
- compiler/GHC/Types/Error.hs
- − compiler/GHC/Types/Error.hs-boot
- compiler/GHC/Types/SourceError.hs
- compiler/GHC/Utils/Error.hs
- ghc/GHCi/UI/Exception.hs
- libraries/base/changelog.md
- libraries/base/src/GHC/Base.hs
- libraries/base/src/GHC/Exts.hs
- libraries/ghc-bignum/changelog.md
- libraries/ghc-experimental/src/GHC/PrimOps.hs
- libraries/ghc-internal/src/GHC/Internal/Bignum/Integer.hs
- libraries/ghc-internal/src/GHC/Internal/Bits.hs
- libraries/ghc-internal/src/GHC/Internal/Types.hs
- libraries/xhtml
- testsuite/tests/interface-stability/ghc-bignum-exports.stdout
- testsuite/tests/interface-stability/ghc-prim-exports.stdout
- testsuite/tests/interface-stability/ghc-prim-exports.stdout-mingw32
- + testsuite/tests/numeric/should_run/T21176.hs
- + testsuite/tests/numeric/should_run/T21176.stdout
- + testsuite/tests/numeric/should_run/T21176.stdout-ws-32
- testsuite/tests/numeric/should_run/all.T
- testsuite/tests/perf/compiler/T11068.stdout
- testsuite/tests/pmcheck/should_compile/T12957.stderr
- testsuite/tests/profiling/should_run/staticcallstack002.stdout
- testsuite/tests/simplCore/should_compile/Makefile
- testsuite/tests/simplCore/should_compile/T13156.stdout
- testsuite/tests/simplCore/should_compile/T26615.stderr
- testsuite/tests/simplCore/should_compile/T8832.hs
- testsuite/tests/simplCore/should_compile/T8832.stdout
- testsuite/tests/typecheck/should_fail/T13292.stderr
- + testsuite/tests/typecheck/should_fail/T27390-explicit-kinds.stderr
- + testsuite/tests/typecheck/should_fail/T27390.hs
- + testsuite/tests/typecheck/should_fail/T27390.stderr
- + testsuite/tests/typecheck/should_fail/T27390a.hs
- testsuite/tests/typecheck/should_fail/all.T
- utils/check-exact/Main.hs
- utils/check-exact/Preprocess.hs
- utils/haddock/haddock-api/src/Haddock.hs
- utils/haddock/haddock-api/src/Haddock/Backends/Hoogle.hs
- utils/haddock/haddock-api/src/Haddock/Backends/Hyperlinker.hs
- utils/haddock/haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs
- utils/haddock/haddock-api/src/Haddock/Backends/LaTeX.hs
- utils/haddock/haddock-api/src/Haddock/Backends/Xhtml.hs
- utils/haddock/haddock-api/src/Haddock/Backends/Xhtml/DocMarkup.hs
- utils/haddock/haddock-api/src/Haddock/Backends/Xhtml/Meta.hs
- utils/haddock/haddock-api/src/Haddock/Backends/Xhtml/Names.hs
- utils/haddock/haddock-api/src/Haddock/Backends/Xhtml/Utils.hs
- utils/haddock/haddock-api/src/Haddock/Doc.hs
- utils/haddock/haddock-api/src/Haddock/GhcUtils.hs
- utils/haddock/haddock-api/src/Haddock/Interface/AttachInstances.hs
- utils/haddock/haddock-api/src/Haddock/Interface/Create.hs
- utils/haddock/haddock-api/src/Haddock/Interface/Json.hs
- utils/haddock/haddock-api/src/Haddock/Interface/LexParseRn.hs
- utils/haddock/haddock-api/src/Haddock/Interface/ParseModuleHeader.hs
- utils/haddock/haddock-api/src/Haddock/Interface/Rename.hs
- utils/haddock/haddock-api/src/Haddock/InterfaceFile.hs
- utils/haddock/haddock-api/src/Haddock/Options.hs
- utils/haddock/haddock-api/src/Haddock/Parser.hs
- utils/haddock/haddock-api/src/Haddock/Types.hs
- utils/haddock/haddock-api/src/Haddock/Utils/Json.hs
- utils/haddock/haddock-api/src/Haddock/Utils/Json/Parser.hs
- utils/haddock/haddock-api/src/Haddock/Utils/Json/Types.hs
- utils/haddock/haddock-library/src/Documentation/Haddock/Doc.hs
- utils/haddock/haddock-library/src/Documentation/Haddock/Markup.hs
- utils/haddock/haddock-library/src/Documentation/Haddock/Parser.hs
- utils/haddock/haddock-library/src/Documentation/Haddock/Parser/Util.hs
- utils/haddock/haddock-library/src/Documentation/Haddock/Types.hs
- utils/haddock/haddock-library/test/Documentation/Haddock/ParserSpec.hs
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/1a6159707c6336f830ebd4a2d20aaf…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/1a6159707c6336f830ebd4a2d20aaf…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][wip/spj-reinstallable-base2] At least make use of the module being cached!
by Rodrigo Mesquita (@alt-romes) 25 Jun '26
by Rodrigo Mesquita (@alt-romes) 25 Jun '26
25 Jun '26
Rodrigo Mesquita pushed to branch wip/spj-reinstallable-base2 at Glasgow Haskell Compiler / GHC
Commits:
0773f283 by Rodrigo Mesquita at 2026-06-25T12:34:00+01:00
At least make use of the module being cached!
- - - - -
1 changed file:
- compiler/GHC/Iface/Load.hs
Changes:
=====================================
compiler/GHC/Iface/Load.hs
=====================================
@@ -370,16 +370,20 @@ checkKnownKeyNamesIface known_key_names_occ_map
-- | Lookup the module exporting the canonical known-entities definitions (GHC.Essentials)
lookupKnownKeysModule :: HscEnv -> DynFlags {-^ Module dyn flags -} -> IO (Maybe Module)
lookupKnownKeysModule hsc_env dflags = do
- found_essentials <- findImportedModule hsc_env eSSENTIALS_NAME NoPkgQual
- let rebindable_kn = gopt Opt_RebindableKnownNames dflags
- let essentials_uid
- | rebindable_kn = return Nothing
- | Found _ mod <- found_essentials = return (Just mod)
- | fr <- found_essentials = do
- throwOneError (initSourceErrorContext dflags) $
- mkPlainErrorMsgEnvelope noSrcSpan $ GhcDriverMessage $ DriverInterfaceError $
- CantFindEssentials (cannotFindModule hsc_env eSSENTIALS_NAME fr) LookingForEssentialsModule
- essentials_uid
+ eps <- hscEPS hsc_env
+ case eps_known_keys eps of
+ Just (_, kk_mod) -> return (Just kk_mod)
+ Nothing -> do
+ found_essentials <- findImportedModule hsc_env eSSENTIALS_NAME NoPkgQual
+ let rebindable_kn = gopt Opt_RebindableKnownNames dflags
+ let essentials_uid
+ | rebindable_kn = return Nothing
+ | Found _ mod <- found_essentials = return (Just mod)
+ | fr <- found_essentials = do
+ throwOneError (initSourceErrorContext dflags) $
+ mkPlainErrorMsgEnvelope noSrcSpan $ GhcDriverMessage $ DriverInterfaceError $
+ CantFindEssentials (cannotFindModule hsc_env eSSENTIALS_NAME fr) LookingForEssentialsModule
+ essentials_uid
{- *********************************************************************
* *
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/0773f2836fa925f24bc2dc43904c001…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/0773f2836fa925f24bc2dc43904c001…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
25 Jun '26
Hannes Siebenhandl pushed to branch wip/fendor/no-code-output-constr at Glasgow Haskell Compiler / GHC
Commits:
7ddafa96 by fendor at 2026-06-25T13:21:18+02:00
WIP
- - - - -
1 changed file:
- compiler/GHC/Driver/Session.hs
Changes:
=====================================
compiler/GHC/Driver/Session.hs
=====================================
@@ -3903,7 +3903,7 @@ makeDynFlagsConsistent dflags
in dflags_c
| gopt Opt_InfoTableMap dflags
- , backendSupportsInfoTableMap (backend dflags)
+ , not (backendSupportsInfoTableMap (backend dflags))
= loop (gopt_unset dflags Opt_InfoTableMap)
$ "-finfo-table-map is incompatible with " ++ show (backend dflags) ++ " and is disabled (See #26435)"
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/7ddafa9624f16c2ae5c5d41ebae1239…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/7ddafa9624f16c2ae5c5d41ebae1239…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][wip/sjakobi/T27437] NCG: cheaper liveness fixpoint convergence test (#27437)
by Simon Jakobi (@sjakobi2) 25 Jun '26
by Simon Jakobi (@sjakobi2) 25 Jun '26
25 Jun '26
Simon Jakobi pushed to branch wip/sjakobi/T27437 at Glasgow Haskell Compiler / GHC
Commits:
5b2720e7 by Simon Jakobi at 2026-06-25T13:00:47+02:00
NCG: cheaper liveness fixpoint convergence test (#27437)
The per-SCC liveness fixpoint compared the whole accumulated BlockMap
after every iteration via mapToList, making each iteration
O(all-blocks-so-far) and rebuilding two lists each time. Profiling a
control-flow-heavy -O Cmm compile showed ~20% of compile time in this
single check.
Only the current SCC's blocks can change between iterations, so detect
that during the pass itself: linearLiveness now threads a strict
`changed` flag and reports whether any of the SCC's own entries moved,
dropping the separate equalBlockMaps comparison entirely. Explicit
'case's (rather than lazy tuple 'let's) keep GHC from reboxing each
block's intermediate results into heap tuples, so the loop allocates
nothing per block beyond the output blocks themselves.
Compiling an ~8300-block Cmm procedure with -O is 1.20x +/- 0.02 faster
(hyperfine, 10 runs) with ~112 MB less allocation.
Co-Authored-By: Claude Opus 4.8 <noreply(a)anthropic.com>
- - - - -
1 changed file:
- compiler/GHC/CmmToAsm/Reg/Liveness.hs
Changes:
=====================================
compiler/GHC/CmmToAsm/Reg/Liveness.hs
=====================================
@@ -62,7 +62,7 @@ import GHC.Types.Unique.DSM
import GHC.Data.Bag
import GHC.Utils.Monad.State.Strict
-import Data.List (mapAccumL, sortOn)
+import Data.List (sortOn)
import Data.Maybe
import Data.IntSet (IntSet)
import GHC.Utils.Misc
@@ -897,36 +897,33 @@ livenessSCCs platform blockmap done (AcyclicSCC block : sccs)
livenessSCCs platform blockmap done
(CyclicSCC blocks : sccs) =
livenessSCCs platform blockmap' (CyclicSCC blocks':done) sccs
- where (blockmap', blocks')
- = iterateUntilUnchanged linearLiveness equalBlockMaps
- blockmap blocks
+ where (blockmap', blocks') = fixpoint blockmap
- iterateUntilUnchanged
- :: (a -> b -> (a,c)) -> (a -> a -> Bool)
- -> a -> b
- -> (a,c)
-
- iterateUntilUnchanged f eq aa b = go aa
- where
- go a = if eq a a' then ac else go a'
- where
- ac@(a', _) = f a b
+ -- Iterate the liveness pass over the SCC until the block map reaches
+ -- a fixed point. Only the SCC's own blocks can change between
+ -- iterations (livenessBlock only inserts the block it processes, and
+ -- earlier SCCs are already finalised).
+ fixpoint bm
+ | changed = fixpoint bm'
+ | otherwise = (bm', blocks'')
+ where (changed, bm', blocks'') = linearLiveness bm blocks
linearLiveness
:: Instruction instr
=> BlockMap Regs -> [LiveBasicBlock instr]
- -> (BlockMap Regs, [LiveBasicBlock instr])
-
- linearLiveness = mapAccumL (livenessBlock platform)
-
- -- probably the least efficient way to compare two
- -- BlockMaps for equality.
- equalBlockMaps :: BlockMap Regs -> BlockMap Regs -> Bool
- equalBlockMaps a b
- = a' == b'
- where a' = mapToList a
- b' = mapToList b
- -- See Note [Unique Determinism and code generation]
+ -> (Bool, BlockMap Regs, [LiveBasicBlock instr])
+ linearLiveness bm0 blks = go False bm0 blks
+ where
+ go !changed bm [] = (changed, bm, [])
+ go !changed bm (block : blks') =
+ case livenessBlock platform bm block of
+ (bm', block') ->
+ let bid = blockId block
+ !changed' = changed
+ || mapLookup bid bm /= mapLookup bid bm'
+ in case go changed' bm' blks' of
+ (changed'', bm'', blks'') ->
+ (changed'', bm'', block' : blks'')
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/5b2720e7add17812c3194f9e6d149a1…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/5b2720e7add17812c3194f9e6d149a1…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][wip/marge_bot_batch_merge_job] 5 commits: Add explicit setBit/clearBit/complementBit for instance Bits Integer (#21176)
by Marge Bot (@marge-bot) 25 Jun '26
by Marge Bot (@marge-bot) 25 Jun '26
25 Jun '26
Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC
Commits:
f235d183 by Simon Jakobi at 2026-06-25T05:51:18-04:00
Add explicit setBit/clearBit/complementBit for instance Bits Integer (#21176)
The default setBit, clearBit, and complementBit methods allocate
intermediate Integers per call. Define them explicitly via the new
integerSetBit[#], integerClearBit[#] and integerComplementBit[#], built
on the BigNat# primitives, which avoid those allocations. Allocation is not
eliminated entirely -- the negative (IN) cases would need in-place mutation,
which is left as future work.
The default methods constant-folded on literal arguments via the
integerOr/integerAnd/integerXor rules, which fold literal Integers of any
size. The explicit functions have no such rule, so they (their Word-argument
wrappers, and the Bits Integer methods) are marked INLINE to expose the
underlying primops to the simplifier; see Note [INLINE for constant folding
of bit operations]. This restores folding only on the small-int (IS) path --
large literal Integers (IP/IN) are no longer constant-folded, a minor
regression for that case. T8832 covers the IS-path folding.
The new golden-output test T21176 checks all three operations against the
default implementations across the sign/size boundaries, recording each
result plus its integerCheck validity. The base and ghc-bignum interface-
stability export goldens gain the new functions.
The main changelog entry lives in changelog.d under a new ghc-internal
section (renamed from ghc-prim).
CLC proposal: https://github.com/haskell/core-libraries-committee/issues/423
Co-Authored-By: Claude Opus 4.7 <noreply(a)anthropic.com>
- - - - -
202ed264 by Marc Scholten at 2026-06-25T05:52:21-04:00
haddock: use Text in documentation pipeline
This patch moves Haddock's documentation pipeline from String to Text
where the data is already textual. It avoids repeated conversions while
keeping the existing decoding behavior for invalid UTF-8 docstring
chunks.
The main changes are:
* Render and carry docstrings as Text in Haddock-facing paths.
* Use the Binary Text instance from GHC.Utils.Binary for Haddock
interface files, and bump the Haddock binary interface version.
* Add a FastString HTML instance so XHTML rendering avoids
intermediate String allocation.
* Keep HsDocStringChunk decoding lenient, matching the previous
unpackHDSC behavior on invalid UTF-8 input.
* Update the xhtml submodule to 3000.4.1.0, which contains the
apostrophe escaping fix used by the Haddock test output.
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot(a)users.noreply.github.com>
Co-authored-by: Claude Opus 4.5 <noreply(a)anthropic.com>
Assisted-by: Codex <codex(a)openai.com>
- - - - -
a72ff58f by mangoiv at 2026-06-25T05:53:07-04:00
compiler: rename ZonkAny to UnusedType and add pretty printing logic
ZonkAny is a hard to understand name for users who do not know how the
compiler works internally. Additionally, it is confusing that ZonkAny,
while being a concrete type *represents* a meta variable, espeically in
the compiler output.
This patch changes the name of ZonkAny to UnusedType which is closer to
its intended semantics and adds special pretty printing logic to display
this type in the same fashion the compiler displays meta variables in
other places, whenever they leak from the implementation to the user.
It also exports the type from ghc-internal:GHC.Internal.Types in order
to expose documentation.
Fixes #27390
Co-Authored-By: Sam Derbyshire <sam.derbyshire(a)gmail.com>
- - - - -
1667a751 by Julian Ospald at 2026-06-25T06:26:30-04:00
Update libffi to 3.6.0
- - - - -
263c433c by Zubin Duggal at 2026-06-25T06:26:31-04:00
testsuite: Report fragile failures as skipped in JUnit output
- - - - -
73 changed files:
- + changelog.d/T21176
- changelog.d/config
- + changelog.d/unused-type
- compiler/GHC/Builtin/Names.hs
- compiler/GHC/Builtin/Types.hs
- compiler/GHC/Hs/DocString.hs
- compiler/GHC/HsToCore/Expr.hs
- compiler/GHC/Iface/Type.hs
- compiler/GHC/Tc/Types.hs
- compiler/GHC/Tc/Utils/Monad.hs
- compiler/GHC/Tc/Utils/TcType.hs
- compiler/GHC/Tc/Zonk/Type.hs
- libraries/base/changelog.md
- libraries/base/src/GHC/Base.hs
- libraries/base/src/GHC/Exts.hs
- libraries/ghc-bignum/changelog.md
- libraries/ghc-experimental/src/GHC/PrimOps.hs
- libraries/ghc-internal/src/GHC/Internal/Bignum/Integer.hs
- libraries/ghc-internal/src/GHC/Internal/Bits.hs
- libraries/ghc-internal/src/GHC/Internal/Types.hs
- libraries/libffi-clib
- libraries/xhtml
- testsuite/driver/junit.py
- testsuite/tests/interface-stability/ghc-bignum-exports.stdout
- testsuite/tests/interface-stability/ghc-prim-exports.stdout
- testsuite/tests/interface-stability/ghc-prim-exports.stdout-mingw32
- + testsuite/tests/numeric/should_run/T21176.hs
- + testsuite/tests/numeric/should_run/T21176.stdout
- + testsuite/tests/numeric/should_run/T21176.stdout-ws-32
- testsuite/tests/numeric/should_run/all.T
- testsuite/tests/perf/compiler/T11068.stdout
- testsuite/tests/pmcheck/should_compile/T12957.stderr
- testsuite/tests/profiling/should_run/staticcallstack002.stdout
- testsuite/tests/simplCore/should_compile/Makefile
- testsuite/tests/simplCore/should_compile/T13156.stdout
- testsuite/tests/simplCore/should_compile/T26615.stderr
- testsuite/tests/simplCore/should_compile/T8832.hs
- testsuite/tests/simplCore/should_compile/T8832.stdout
- testsuite/tests/typecheck/should_fail/T13292.stderr
- + testsuite/tests/typecheck/should_fail/T27390-explicit-kinds.stderr
- + testsuite/tests/typecheck/should_fail/T27390.hs
- + testsuite/tests/typecheck/should_fail/T27390.stderr
- + testsuite/tests/typecheck/should_fail/T27390a.hs
- testsuite/tests/typecheck/should_fail/all.T
- utils/haddock/haddock-api/src/Haddock.hs
- utils/haddock/haddock-api/src/Haddock/Backends/Hoogle.hs
- utils/haddock/haddock-api/src/Haddock/Backends/LaTeX.hs
- utils/haddock/haddock-api/src/Haddock/Backends/Xhtml.hs
- utils/haddock/haddock-api/src/Haddock/Backends/Xhtml/DocMarkup.hs
- utils/haddock/haddock-api/src/Haddock/Backends/Xhtml/Meta.hs
- utils/haddock/haddock-api/src/Haddock/Backends/Xhtml/Names.hs
- utils/haddock/haddock-api/src/Haddock/Backends/Xhtml/Utils.hs
- utils/haddock/haddock-api/src/Haddock/Doc.hs
- utils/haddock/haddock-api/src/Haddock/GhcUtils.hs
- utils/haddock/haddock-api/src/Haddock/Interface/AttachInstances.hs
- utils/haddock/haddock-api/src/Haddock/Interface/Create.hs
- utils/haddock/haddock-api/src/Haddock/Interface/Json.hs
- utils/haddock/haddock-api/src/Haddock/Interface/LexParseRn.hs
- utils/haddock/haddock-api/src/Haddock/Interface/ParseModuleHeader.hs
- utils/haddock/haddock-api/src/Haddock/Interface/Rename.hs
- utils/haddock/haddock-api/src/Haddock/InterfaceFile.hs
- utils/haddock/haddock-api/src/Haddock/Options.hs
- utils/haddock/haddock-api/src/Haddock/Parser.hs
- utils/haddock/haddock-api/src/Haddock/Types.hs
- utils/haddock/haddock-api/src/Haddock/Utils/Json.hs
- utils/haddock/haddock-api/src/Haddock/Utils/Json/Parser.hs
- utils/haddock/haddock-api/src/Haddock/Utils/Json/Types.hs
- utils/haddock/haddock-library/src/Documentation/Haddock/Doc.hs
- utils/haddock/haddock-library/src/Documentation/Haddock/Markup.hs
- utils/haddock/haddock-library/src/Documentation/Haddock/Parser.hs
- utils/haddock/haddock-library/src/Documentation/Haddock/Parser/Util.hs
- utils/haddock/haddock-library/src/Documentation/Haddock/Types.hs
- utils/haddock/haddock-library/test/Documentation/Haddock/ParserSpec.hs
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/b50d15f3497d7787c3123daf0f0fea…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/b50d15f3497d7787c3123daf0f0fea…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][master] compiler: rename ZonkAny to UnusedType and add pretty printing logic
by Marge Bot (@marge-bot) 25 Jun '26
by Marge Bot (@marge-bot) 25 Jun '26
25 Jun '26
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
a72ff58f by mangoiv at 2026-06-25T05:53:07-04:00
compiler: rename ZonkAny to UnusedType and add pretty printing logic
ZonkAny is a hard to understand name for users who do not know how the
compiler works internally. Additionally, it is confusing that ZonkAny,
while being a concrete type *represents* a meta variable, espeically in
the compiler output.
This patch changes the name of ZonkAny to UnusedType which is closer to
its intended semantics and adds special pretty printing logic to display
this type in the same fashion the compiler displays meta variables in
other places, whenever they leak from the implementation to the user.
It also exports the type from ghc-internal:GHC.Internal.Types in order
to expose documentation.
Fixes #27390
Co-Authored-By: Sam Derbyshire <sam.derbyshire(a)gmail.com>
- - - - -
27 changed files:
- + changelog.d/unused-type
- compiler/GHC/Builtin/Names.hs
- compiler/GHC/Builtin/Types.hs
- compiler/GHC/HsToCore/Expr.hs
- compiler/GHC/Iface/Type.hs
- compiler/GHC/Tc/Types.hs
- compiler/GHC/Tc/Utils/Monad.hs
- compiler/GHC/Tc/Utils/TcType.hs
- compiler/GHC/Tc/Zonk/Type.hs
- libraries/base/src/GHC/Base.hs
- libraries/base/src/GHC/Exts.hs
- libraries/ghc-experimental/src/GHC/PrimOps.hs
- libraries/ghc-internal/src/GHC/Internal/Types.hs
- testsuite/tests/interface-stability/ghc-prim-exports.stdout
- testsuite/tests/interface-stability/ghc-prim-exports.stdout-mingw32
- testsuite/tests/perf/compiler/T11068.stdout
- testsuite/tests/pmcheck/should_compile/T12957.stderr
- testsuite/tests/profiling/should_run/staticcallstack002.stdout
- testsuite/tests/simplCore/should_compile/Makefile
- testsuite/tests/simplCore/should_compile/T13156.stdout
- testsuite/tests/simplCore/should_compile/T26615.stderr
- testsuite/tests/typecheck/should_fail/T13292.stderr
- + testsuite/tests/typecheck/should_fail/T27390-explicit-kinds.stderr
- + testsuite/tests/typecheck/should_fail/T27390.hs
- + testsuite/tests/typecheck/should_fail/T27390.stderr
- + testsuite/tests/typecheck/should_fail/T27390a.hs
- testsuite/tests/typecheck/should_fail/all.T
Changes:
=====================================
changelog.d/unused-type
=====================================
@@ -0,0 +1,12 @@
+section: compiler
+synopsis: Rename ZonkAny to UnusedType and add pretty printing logic for it.
+issues: #27390
+mrs: !16212
+
+description: {
+ After unification, GHC fills in unconstrained type variables such as ``alpha`` in
+ ``(length :: [alpha] -> Int) ([] :: List alpha) :: Int`` with a fixed type.
+ This type was, confusingly to the user, called ``ZonkAny``.
+ This type is now renamed ``UnusedType``, with special pretty-printing logic to make
+ it display like an ordinary metavariable.
+}
=====================================
compiler/GHC/Builtin/Names.hs
=====================================
@@ -1904,8 +1904,8 @@ unsatisfiableClassNameKey = mkPreludeTyConUnique 170
anyTyConKey :: Unique
anyTyConKey = mkPreludeTyConUnique 171
-zonkAnyTyConKey :: Unique
-zonkAnyTyConKey = mkPreludeTyConUnique 172
+unusedTypeTyConKey :: Unique
+unusedTypeTyConKey = mkPreludeTyConUnique 172
-- Custom user type-errors
errorMessageTypeErrorFamKey :: Unique
=====================================
compiler/GHC/Builtin/Types.hs
=====================================
@@ -93,7 +93,7 @@ module GHC.Builtin.Types (
cTupleSelId, cTupleSelIdName,
-- * Any
- anyTyCon, anyTy, anyTypeOfKind, zonkAnyTyCon,
+ anyTyCon, anyTy, anyTypeOfKind, unusedTypeTyCon,
-- * Recovery TyCon
makeRecoveryTyCon,
@@ -300,7 +300,7 @@ wiredInTyCons :: [TyCon]
wiredInTyCons = map (dataConTyCon . snd) boxingDataCons
++ [ anyTyCon
- , zonkAnyTyCon
+ , unusedTypeTyCon
, boolTyCon
, charTyCon
, stringTyCon
@@ -410,58 +410,89 @@ doubleDataConName = mkWiredInDataConName UserSyntax gHC_TYPES (fsLit "D#")
-- Any
{-
-Note [Any types]
-~~~~~~~~~~~~~~~~
-The type constructors `Any` and `ZonkAny` are closed type families declared thus:
+Note [The types Any and UnusedType]
+~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
+The type constructors `Any` and `UnusedType` are closed type families declared as:
- type family Any :: forall k. k where { }
- type family ZonkAny :: forall k. Nat -> k where { }
+ type family Any :: forall k. k where { }
+ type family UnusedType :: forall k. Symbol -> k where { }
They are used when we want a type of a particular kind, but we don't really care
-what that type is. The leading example is this: `ZonkAny` is used to instantiate
-un-constrained type variables after type checking. For example, consider the
-term (length [] :: Int), where
+what that type is. The leading example that is relevant for GHC itself is this:
- length :: forall a. [a] -> Int
- [] :: forall a. [a]
+ `UnusedType` is used to instantiate unconstrained type variables after type
+ checking. For example, consider the term (length [] :: Int), where
-We must type-apply `length` and `[]`, but to what type? It doesn't matter!
-The typechecker will end up with
+ length :: forall a. [a] -> Int
+ [] :: forall a. [a]
- length @alpha ([] @alpha)
+ We must type-apply `length` and `[]`, but to what type? It doesn't matter!
+ The typechecker will end up with
-where `alpha` is an un-constrained unification variable. The "zonking" process zaps
-that unconstrained `alpha` to an arbitrary type (ZonkAny @Type 3), where the `3` is
-arbitrary (see wrinkle (Any5) below). This is done in `GHC.Tc.Zonk.Type.commitFlexi`.
-So we end up with
+ length @alpha ([] @alpha)
- length @(ZonkAny @Type 3) ([] @(ZonkAny @Type 3))
+ where `alpha` is an unconstrained unification variable. The "zonking" process
+ zaps that unconstrained `alpha` to an arbitrary type (UnusedType @Type "a_3"),
+ where the `3` is arbitrary (see wrinkle (Any3) below) and "a" is the name string
+ of the meta variable. This is done in `GHC.Tc.Zonk.Type.commitFlexi`.
+ So we end up with
-`Any` and `ZonkAny` differ only in the presence of the `Nat` argument; see
-wrinkle (Any4).
+ length @(UnusedType @Type "a_3") ([] @(UnusedType @Type "a_3"))
-Wrinkles:
+`Any` and `UnusedType` differ only in the presence of the `Symbol` argument; see (Any6).
-(Any1) `Any` and `ZonkAny` are kind polymorphic since in some program we may
- need to use `ZonkAny` to fill in a type variable of some kind other than *
- (see #959 for examples).
-
-(Any2) They are /closed/ type families, with no instances. For example, suppose that
+(Any1) They are /closed/ type families, with no instances. For example, suppose that
with alpha :: '(k1, k2) we add a given coercion
g :: alpha ~ (Fst alpha, Snd alpha)
- and we zonked alpha = ZonkAny @(k1,k2) n. Then, if `ZonkAny` was a /data/ type,
- we'd get inconsistency because we'd have a Given equality with `ZonkAny` on one
+ and we zonked alpha = UnusedType @(k1,k2) n. Then, if `UnusedType` was a /data/ type,
+ we'd get inconsistency because we'd have a Given equality with `UnusedType` on one
side and '(,) on the other. See also #9097 and #9636.
- See #25244 for a suggestion that we instead use an /open/ type family for which
- you cannot provide instances. Probably the difference is not very important.
+ They are not /data/ types, and that's important for the code generator,
+ because the code gen may enter a data value.
+
+ A closed type family with no equations behaves differently than an open type
+ family with no equations due to Note [Insoluble fundeps] IFD0 in
+ GHC.Tc.Solver.FunDeps, so it was argued in #25244 that perhaps 'Any' should
+ rather be an open type family for which new equations cannot be written.
+
+(Any2) `Any` and `UnusedType` are kind polymorphic since in some programs we may
+ need to use `UnusedType` to fill in a type variable of some kind other than Type
+ e.g. TYPE r for some r, or types of the form _ -> Type.
+
+(Any3) `Any` and `UnusedType` are wired-in so we can easily refer to them where we
+ don't have a name environment.
+
+(Any4) User facing aspects of the types Any and UnusedType:
+
+ `Any` is defined in ghc-internal:GHC.Internal.Types, and exported. `Any`
+ is available to users because it is a useful type in userspace and is thus
+ re-exported from base:GHC.Exts.
+
+ `UnusedType` is exported mainly for documentation in case a user stumbles over
+ it in debug output of GHC.
+
+ The key property of 'Any' is that it is safe to coerce a type to 'Any' as long
+ as the representation is unchanged. That is, it is OK to use 'unsafeCoerce#' to
+ go from 'ty :: TYPE r' to 'Any :: TYPE r' and back.
+ This can be useful when e.g. implementing dependent maps or similar typed
+ container types, storing values of type `Any`.
+
+(Any5) Warnings about unused bindings of type `Any` and `UnusedType` are suppressed,
+ following the same rationale of supressing warning about the unit type.
+
+ For example, consider (#25895):
+
+ do { forever (return ()); blah }
-(Any3) They do not claim to be /data/ types, and that's important for
- the code generator, because the code gen may /enter/ a data value
- but never enters a function value.
+ where forever :: forall a b. IO a -> IO b
+ Nothing constrains `b`, so it will be instantiated with `Any` or `UnusedType`.
+ But we certainly don't want to complain about a discarded do-binding.
-(Any4) `ZonkAny` takes a `Nat` argument so that we can readily make up /distinct/
- types (#24817). Consider
+(Any6) Wrinkle - Pattern match checking.
+
+ The first reason why `UnusedType` takes a `Symbol` argument is that
+ we can readily make up /distinct/ types (#24817) for the Pmc. Consider
data SBool a where { STrue :: SBool True; SFalse :: SBool False }
@@ -475,53 +506,33 @@ Wrinkles:
Now, what are `alpha` and `beta`? If we zonk both of them to the same type
`Any @Type`, the pattern-match checker will (wrongly) report that the first
branch is inaccessible. So we zonk them to two /different/ types:
- alpha := ZonkAny @Type 4 and beta := ZonkAny @Type k 5
+ alpha := UnusedType @Type "a_4" and beta := UnusedType @Type k "b_5"
(The actual numbers are arbitrary; they just need to differ.)
The unique-name generation comes from field `tcg_zany_n` of `TcGblEnv`; and
- `GHC.Tc.Zonk.Type.commitFlexi` calls `GHC.Tc.Utils.Monad.newZonkAnyType` to
+ `GHC.Tc.Zonk.Type.commitFlexi` calls `GHC.Tc.Utils.Monad.newUnusedTypeType` to
make up a fresh type.
If this example seems unconvincing (e.g. in this case foo must be bottom)
see #24817 for larger but more compelling examples.
-(Any5) `Any` and `ZonkAny` are wired-in so we can easily refer to it where we
- don't have a name environment (e.g. see Rules.matchRule for one example)
-
-(Any6) `Any` is defined in library module ghc-prim:GHC.Types, and exported so that
- it is available to users. For this reason it's treated like any other
- wired-in type:
- - has a fixed unique, anyTyConKey,
- - lives in the global name cache
- Currently `ZonkAny` is not available to users; but it could easily be.
+(Any7) Wrinkle - Error reporting.
-(Any7) Properties of `Any`:
- * When `Any` is instantiated at a lifted type it is inhabited by at least one value,
- namely bottom.
+ There's a second reason why `UnusedType` takes a `Symbol` argument, which is that
+ we use it to neatly display zonked unfilled metavariables without leaking
+ implementation details of code generation.
- * You can safely coerce any /lifted/ type to `Any` and back with `unsafeCoerce`.
+ `UnusedType` is handled specially in the pretty-printer to avoid confusing
+ compiler output. For example, `UnusedType "foo_3" :: Type` is displayed as `foo_3`.
- * You can safely coerce any /unlifted/ type to `Any` and back with `unsafeCoerceUnlifted`.
+ That special handling is implemented in GHC.Iface.Type.pprTyTcApp and more
+ specifically ppr_iface_unused_ty_tycon.
- * You can coerce /any/ type to `Any` and back with `unsafeCoerce#`, but it's only safe when
- the kinds of both the type and `Any` match.
+ See testcase T27390 for an example of the pretty-printing in action.
- * For lifted/unlifted types `unsafeCoerce[Unlifted]` should be preferred over
- `unsafeCoerce#` as they prevent accidentally coercing between types with kinds
- that don't match.
-
- See examples in ghc-prim:GHC.Types
-
-(Any8) Warning about unused bindings of type `Any` and `ZonkAny` are suppressed,
- following the same rationale of supressing warning about the unit type.
-
- For example, consider (#25895):
-
- do { forever (return ()); blah }
-
- where forever :: forall a b. IO a -> IO b
- Nothing constrains `b`, so it will be instantiates with `Any` or `ZonkAny`.
- But we certainly don't want to complain about a discarded do-binding.
+ Historical note: in the past, `UnusedType` was called `ZonkAny` (or `Any` before that).
+ We renamed it to `UnusedType` and added this special treatment in the pretty-printer to avoid
+ confusing mentions of zonking.
The Any tycon used to be quite magic, but we have since been able to
implement it merely with an empty kind polymorphic type family. See #10886 for a
@@ -534,7 +545,7 @@ anyTyConName =
mkWiredInTyConName UserSyntax gHC_TYPES (fsLit "Any") anyTyConKey anyTyCon
anyTyCon :: TyCon
--- See Note [Any types]
+-- See Note [The types Any and UnusedType]
anyTyCon = mkFamilyTyCon anyTyConName kind binders 0 res_kind Nothing
(ClosedSynFamilyTyCon Nothing)
Nothing
@@ -550,22 +561,22 @@ anyTy = mkTyConTy anyTyCon
anyTypeOfKind :: Kind -> Type
anyTypeOfKind kind = mkTyConApp anyTyCon [kind]
-zonkAnyTyConName :: Name
-zonkAnyTyConName =
- mkWiredInTyConName UserSyntax gHC_TYPES (fsLit "ZonkAny") zonkAnyTyConKey zonkAnyTyCon
+unusedTypeTyConName :: Name
+unusedTypeTyConName =
+ mkWiredInTyConName UserSyntax gHC_TYPES (fsLit "UnusedType") unusedTypeTyConKey unusedTypeTyCon
-zonkAnyTyCon :: TyCon
--- ZonkAnyTyCon :: forall k. Nat -> k
--- See Note [Any types]
-zonkAnyTyCon = mkFamilyTyCon zonkAnyTyConName kind bndrs 0 res_kind
+unusedTypeTyCon :: TyCon
+-- unusedTypeTyCon :: forall k. Symbol -> k
+-- See Note [The types Any and UnusedType]
+unusedTypeTyCon = mkFamilyTyCon unusedTypeTyConName kind bndrs 0 res_kind
Nothing
(ClosedSynFamilyTyCon Nothing)
Nothing
NotInjective
where
- [kv,nat_kv] = mkTemplateKindVars [liftedTypeKind, naturalTy]
+ [kv,sym_kv] = mkTemplateKindVars [liftedTypeKind, typeSymbolKind]
bndrs = [ mkNamedTyConBinder Specified kv
- , mkAnonTyConBinder nat_kv ]
+ , mkAnonTyConBinder sym_kv ]
res_kind = mkTyVarTy kv
kind = mkTyConKind bndrs res_kind
=====================================
compiler/GHC/HsToCore/Expr.hs
=====================================
@@ -1281,11 +1281,11 @@ warnDiscardedDoBindings rhs@(L rhs_loc _) m_ty elt_ty
do { fam_inst_envs <- dsGetFamInstEnvs
; let norm_elt_ty = topNormaliseType fam_inst_envs elt_ty
supressible_ty =
- isUnitTy norm_elt_ty || isAnyTy norm_elt_ty || isZonkAnyTy norm_elt_ty
+ isUnitTy norm_elt_ty || isAnyTy norm_elt_ty || isUnusedTypeTy norm_elt_ty
-- Warn about discarding things in 'monadic' binding,
-- however few types are excluded:
-- * Unit type `()`
- -- * `ZonkAny` or `Any` type see (Any8) of Note [Any types]
+ -- * `UnusedType` or `Any` type see (Any5) of Note [The types Any and UnusedType]
; if warn_unused && not supressible_ty
then diagnosticDs (DsUnusedDoBind rhs elt_ty)
else
=====================================
compiler/GHC/Iface/Type.hs
=====================================
@@ -7,7 +7,7 @@ This module defines interface types and binders
-}
-{-# LANGUAGE MultiWayIf #-}
+{-# LANGUAGE MultiWayIf, OverloadedRecordDot #-}
module GHC.Iface.Type (
IfExtName,
IfLclName(..), mkIfLclName, ifLclNameFS,
@@ -1740,6 +1740,7 @@ pprTyTcApp ctxt_prec tc tys =
sdocOption sdocPrintExplicitKinds $ \print_kinds ->
sdocOption sdocPrintTypeAbbreviations $ \print_type_abbreviations ->
getPprDebug $ \debug ->
+ getPprStyle $ \style ->
if | ifaceTyConName tc `hasKey` ipClassKey
, IA_Arg (IfaceLitTy (IfaceStrTyLit n))
@@ -1791,6 +1792,14 @@ pprTyTcApp ctxt_prec tc tys =
| Just doc <- ppr_equality ctxt_prec tc (appArgsIfaceTypes tys)
-> doc
+ -- See Note [The types Any and UnusedType], specifically (Any6) and (Any7)
+ | ifaceTyConName tc `hasKey` unusedTypeTyConKey
+ , ((arg_k, _) : (IfaceLitTy (IfaceStrTyLit arg_nm), _) : args_usr)
+ <- appArgsIfaceTypesForAllTyFlags tys
+ -- if arg_k is a kind with more than 0 arguments, then _ might not be [] here
+ , userStyle style
+ -> ppr_iface_unused_ty_tycon ctxt_prec arg_k arg_nm args_usr
+
| otherwise
-> ppr_iface_tc_app ppr_app_arg ctxt_prec tc $
appArgsIfaceTypesForAllTyFlags $ stripInvisArgs (PrintExplicitKinds print_kinds) tys
@@ -1802,6 +1811,23 @@ ppr_kind_type ctxt_prec = sdocOption sdocStarIsType $ \case
False -> pprPrefixOcc liftedTypeKindTyConName
True -> maybeParen ctxt_prec starPrec starLit
+-- | user-style printer that pretty-prints an 'UnusedType @k "foo_3" to foo_3.
+-- If -fprint-explicit-kinds or -fprint-explicit-runtime-reps are set, instead
+-- prints them to (foo3 :: k).
+-- See Note [The types Any and UnusedType], specifically (Any6) and (Any7) for why this is useful.
+ppr_iface_unused_ty_tycon :: PprPrec -> IfaceType -> LexicalFastString -> [(IfaceType, ForAllTyFlag)] -> SDoc
+ppr_iface_unused_ty_tycon ctxt_prec arg_k arg_nm args_usr
+ = sdocOption sdocPrintExplicitKinds $ \print_kinds ->
+ sdocOption sdocPrintExplicitRuntimeReps $ \print_reps ->
+ if print_kinds || print_reps
+ then prettyMeta $ \nm ->
+ maybeParen sig_prec sigPrec $ nm <+> text "::" <+> pprIfaceType arg_k
+ else prettyMeta id
+ where sig_prec = if null args_usr then ctxt_prec else appPrec
+ prettyMeta add_ty
+ = pprIfacePrefixApp ctxt_prec (add_ty $ ppr arg_nm)
+ $ map (ppr_app_arg appPrec) args_usr
+
-- | Pretty-print a type-level equality.
-- Returns (Just doc) if the argument is a /saturated/ application
-- of eqTyCon (~)
@@ -2190,7 +2216,8 @@ instance Binary IfaceTyConSort where
0 -> return IfaceNormalTyCon
1 -> IfaceTupleTyCon <$> get bh <*> get bh
2 -> IfaceSumTyCon <$> get bh
- _ -> return IfaceEqualityTyCon
+ 3 -> return IfaceEqualityTyCon
+ _ -> panic "get IfaceTyConSort"
instance Binary IfaceTyConInfo where
put_ bh (IfaceTyConInfo i s) = put_ bh i >> put_ bh s
=====================================
compiler/GHC/Tc/Types.hs
=====================================
@@ -582,8 +582,8 @@ data TcGblEnv
-- ^ Allows us to choose unique DFun names.
tcg_zany_n :: TcRef Integer,
- -- ^ A source of unique identities for ZonkAny instances
- -- See Note [Any types] in GHC.Builtin.Types, wrinkle (Any4)
+ -- ^ A source of unique identities for UnusedType instances
+ -- See Note [The types Any and UnusedType] in GHC.Builtin.Types, wrinkle (Any6)
tcg_merged :: [(Module, Fingerprint)],
-- ^ The requirements we merged with; we always have to recompile
=====================================
compiler/GHC/Tc/Utils/Monad.hs
=====================================
@@ -154,7 +154,7 @@ module GHC.Tc.Utils.Monad(
getCCIndexM, getCCIndexTcM,
-- * Zonking
- liftZonkM, newZonkAnyType,
+ liftZonkM, newUnusedType,
-- * Complete matches
localAndImportedCompleteMatches, getCompleteMatchesTcM,
@@ -168,7 +168,7 @@ import GHC.Prelude
import GHC.Builtin.Names
-import GHC.Builtin.Types( zonkAnyTyCon )
+import GHC.Builtin.Types( unusedTypeTyCon )
import GHC.Tc.Errors.Types
import GHC.Tc.Errors.Hole.Plugin ( HoleFitPlugin, HoleFitPluginR (..) )
@@ -197,7 +197,7 @@ import GHC.Core.Coercion ( isReflCo )
import GHC.Core.Multiplicity
import GHC.Core.InstEnv
import GHC.Core.FamInstEnv
-import GHC.Core.Type( mkNumLitTy )
+import GHC.Core.Type( mkStrLitTy )
import GHC.Core.TyCo.Rep( CoercionHole(..) )
import GHC.Core.TyCo.FVs( coVarsOfCo )
import GHC.Core.TyCon ( TyCon )
@@ -2258,17 +2258,24 @@ chooseUniqueOccTc fn =
; writeTcRef dfun_n_var (extendOccSet set occ)
; return occ }
-newZonkAnyType :: Kind -> TcM Type
--- Return a type (ZonkAny @k n), where n is fresh
--- Recall ZonkAny :: forall k. Natural -> k
--- See Note [Any types] in GHC.Builtin.Types, wrinkle (Any4)
-newZonkAnyType kind
+newUnusedType :: Name -> Kind -> TcM Type
+-- Return a type (UnusedType @k sym_n), where sym
+-- is a name and n is a fresh Integer.
+-- Recall UnusedType :: forall k. Symbol -> k
+-- See Note [The types Any and UnusedType] in GHC.Builtin.Types, wrinkle (Any6)
+newUnusedType name kind
= do { env <- getGblEnv
; let zany_n_var = tcg_zany_n env
; i <- readTcRef zany_n_var
; let !i2 = i+1
; writeTcRef zany_n_var i2
- ; return (mkTyConApp zonkAnyTyCon [kind, mkNumLitTy i]) }
+ -- Mind that the "_" here is load-bearing:
+ -- name foo1 with zany_n_var = 1 musn't be equal to
+ -- name foo with zany_n_var = 11 b/c that way the Pmc
+ -- would consider them equal. Using "_" suffices because
+ -- numbers never start with _ and so (legal) identfiers like
+ -- foo_ would become foo__1 which is distinct from e.g. foo_1
+ ; return (mkTyConApp unusedTypeTyCon [kind, mkStrLitTy $ getOccFS name `appendFS` fsLit "_" `appendFS` fsLit (show i) ]) }
getConstraintVar :: TcM (TcRef WantedConstraints)
getConstraintVar = do { env <- getLclEnv; return (tcl_lie env) }
=====================================
compiler/GHC/Tc/Utils/TcType.hs
=====================================
@@ -85,7 +85,7 @@ module GHC.Tc.Utils.TcType (
isSigmaTy, isRhoTy, isRhoExpTy, isOverloadedTy,
isFloatingPrimTy, isDoubleTy, isFloatTy, isIntTy, isWordTy, isStringTy,
isIntegerTy, isNaturalTy,
- isBoolTy, isUnitTy, isAnyTy, isZonkAnyTy, isCharTy,
+ isBoolTy, isUnitTy, isAnyTy, isUnusedTypeTy, isCharTy,
isTauTy, isTauTyCon, tcIsTyVarTy,
isPredTy, isSimplePredTy, isTyVarClassPred,
checkValidClsArgs, hasTyVarHead,
@@ -2057,7 +2057,7 @@ isFloatTy, isDoubleTy,
isFloatPrimTy, isDoublePrimTy,
isIntegerTy, isNaturalTy,
isIntTy, isWordTy, isBoolTy,
- isUnitTy, isAnyTy, isZonkAnyTy, isCharTy :: Type -> Bool
+ isUnitTy, isAnyTy, isUnusedTypeTy, isCharTy :: Type -> Bool
isFloatTy = is_tc floatTyConKey
isDoubleTy = is_tc doubleTyConKey
isFloatPrimTy = is_tc floatPrimTyConKey
@@ -2069,7 +2069,7 @@ isWordTy = is_tc wordTyConKey
isBoolTy = is_tc boolTyConKey
isUnitTy = is_tc unitTyConKey
isAnyTy = is_tc anyTyConKey
-isZonkAnyTy = is_tc zonkAnyTyConKey
+isUnusedTypeTy = is_tc unusedTypeTyConKey
isCharTy = is_tc charTyConKey
-- | Check whether the type is of the form @Any :: k@,
=====================================
compiler/GHC/Tc/Zonk/Type.hs
=====================================
@@ -1,3 +1,4 @@
+{-# LANGUAGE OverloadedRecordDot #-}
{-
(c) The University of Glasgow 2006
(c) The AQUA Project, Glasgow University, 1996-1998
@@ -43,7 +44,7 @@ import GHC.Tc.Types.TcRef
import GHC.Tc.TyCl.Build ( TcMethInfo, MethInfo )
import GHC.Tc.Utils.Env ( tcLookupGlobalOnly )
import GHC.Tc.Utils.TcType
-import GHC.Tc.Utils.Monad ( newZonkAnyType, setSrcSpanA, liftZonkM, traceTc, addErr )
+import GHC.Tc.Utils.Monad ( newUnusedType, setSrcSpanA, liftZonkM, traceTc, addErr )
import GHC.Tc.Types.Evidence
import GHC.Tc.Errors.Types
import GHC.Tc.Zonk.Env
@@ -470,11 +471,11 @@ commitFlexi DefaultFlexi tv zonked_kind
; return manyDataConTy }
| Just (ConcreteFRR origin) <- isConcreteTyVar_maybe tv
= do { addErr $ TcRnZonkerMessage (ZonkerCannotDefaultConcrete origin)
- ; newZonkAnyType zonked_kind }
+ ; newUnusedType tv.varName zonked_kind }
| otherwise
- = do { traceTc "Defaulting flexi tyvar to ZonkAny:" (pprTyVar tv)
- -- See Note [Any types] in GHC.Builtin.Types, esp wrinkle (Any4)
- ; newZonkAnyType zonked_kind }
+ = do { traceTc "Defaulting flexi tyvar to UnusedType:" (pprTyVar tv)
+ -- See Note [The types Any and UnusedType] in GHC.Builtin.Types, esp wrinkle (Any6)
+ ; newUnusedType tv.varName zonked_kind }
zonkCoVarOcc :: CoVar -> ZonkTcM Coercion
zonkCoVarOcc cv
=====================================
libraries/base/src/GHC/Base.hs
=====================================
@@ -535,4 +535,5 @@ import GHC.Types hiding (
Sum62#,
Sum63#,
Sum64#,
+ UnusedType,
)
=====================================
libraries/base/src/GHC/Exts.hs
=====================================
@@ -374,6 +374,7 @@ import GHC.Types hiding (
Type, -- Exported from "Data.Kind"
-- GHC's internal representation of 'TyCon's, for 'Typeable'
Module, TrName, TyCon, TypeLitSort, KindRep, KindBndr,
+ UnusedType,
Unit#,
Solo#(..),
Tuple0#,
=====================================
libraries/ghc-experimental/src/GHC/PrimOps.hs
=====================================
@@ -29,5 +29,5 @@ module GHC.PrimOps
module GHC.Internal.Exts,
) where
-import GHC.Internal.Exts
+import GHC.Internal.Exts hiding (UnusedType)
=====================================
libraries/ghc-internal/src/GHC/Internal/Types.hs
=====================================
@@ -35,6 +35,7 @@ module GHC.Internal.Types (
SPEC(..),
Symbol,
Any,
+ UnusedType,
-- * Type equality
type (~), type (~~), Coercible,
@@ -284,48 +285,53 @@ data Symbol
* *
********************************************************************* -}
--- | The type constructor @Any :: forall k. k@ is a type to which you can unsafely coerce any type, and back.
+-- | The type constructor @Any :: forall k. k@ allows creating an arbitrary type
+-- of the given kind.
--
--- For @unsafeCoerce@ this means for all lifted types @t@ that
--- @unsafeCoerce (unsafeCoerce x :: Any) :: t@ is equivalent to @x@ and safe.
+-- It can be used to create a placeholder type when you only have a kind in hand.
--
--- The same is true for *all* types when using
--- @
--- unsafeCoerce# :: forall (r1 :: RuntimeRep) (r2 :: RuntimeRep)
--- (a :: TYPE r1) (b :: TYPE r2).
--- a -> b
--- @
--- but /only/ if you instantiate @r1@ and @r2@ to the /same/ runtime representation.
--- For example using @(unsafeCoerce# :: forall (a :: TYPE IntRep) (b :: TYPE IntRep). a -> b) x@
--- is fine, but @(unsafeCoerce# :: forall (a :: TYPE IntRep) (b :: TYPE FloatRep). a -> b)@
--- will likely cause seg-faults or worse.
--- For this resason, users should always prefer unsafeCoerce over unsafeCoerce# when possible.
+-- You can use 'unsafeCoerce#' to unsafely coerce a value from @ty :: k@ to @Any \@k@
+-- and back. As per the documentation of 'unsafeCoerce#', this is only sound if both
+-- sides have the __exact same__runtime representation. Some examples:
--
--- Here are some more examples:
-- @
--- bad_a1 :: Any @(TYPE 'IntRep)
--- bad_a1 = unsafeCoerce# True
---
--- bad_a2 :: Any @(TYPE ('BoxedRep 'UnliftedRep))
--- bad_a2 = unsafeCoerce# True
+-- unsafeCoerce# True :: (Any :: Type) -- OK
+-- unsafeCoerce# (1# :: Int#) :: (Any :: TYPE IntRep) -- OK
+-- unsafeCoerce# True :: (Any :: Type IntRep) -- INVALID
+-- unsafeCoerce True :: (Any :: UnliftedType) -- INVALID
+-- unsafeCoerce (ba :: ByteArray#) :: (Any :: Type) -- INVALID
-- @
--- Here @bad_a1@ is bad because we started with @True :: (Bool :: Type)@, represented by a boxed heap pointer,
--- and coerced it to @a1 :: Any @(TYPE 'IntRep)@, whose representation is a non-pointer integer.
--- That's why we had to use `unsafeCoerce#`; it is really unsafe because it can change representations.
--- Similarly @bad_a2@ is bad because although both @True@ and @bad_a2@ are represented by a heap pointer,
--- @True@ is lifted but @bad_a2@ is not; bugs here may be rather subtle.
--
--- If you must use unsafeCoerce# to cast to `Any`, type annotations are recommended
--- to make sure that @Any@ has the correct kind. As casting between different runtimereps is
--- unsound. For example to cast a @ByteArray#@ to @Any@ you might use:
--- @
--- unsafeCoerce# b :: (Any :: TYPE ('BoxedRep 'Unlifted))
--- @
+-- To avoid accidentally unsafe-coercing between different representations,
+-- it is recommended to:
+-- - use explicit type annotations or type applications at every use-site
+-- of 'unsafeCoerce#'
+-- - use representation-monomorphic variants such as 'unsafeCoerce' or
+-- 'unsafeCoerceUnlifted'.
+--
+-- In particular, this also implies it is safe to round-trip unsafe-coercion via 'Any',
+-- as long as the kinds line up e.g. @unsafeCoerce (unsafeCoerce (val :: a) :: 'Any') :: a@
+-- is safe in that way.
type family Any :: k where { }
--- See Note [Any types] in GHC.Builtin.Types. Also, for a bit of history on Any see
+-- See Note [The types Any and UnusedType] in GHC.Builtin.Types. Also, for a bit of history on Any see
-- #10886. Note that this must be a *closed* type family: we need to ensure
-- that this can't reduce to a `data` type for the results discussed in
--- Note [Any types].
+-- Note [The types Any and UnusedType].
+--
+
+-- | @UnusedType \@k "foo"@ denotes an arbitrary type of kind
+-- @k@ and is pretty-printed as @foo@ .
+--
+-- This type is used internally by GHC to fill in otherwise
+-- unconstrained type variables, such as @a@ in @length \@a []@.
+-- It is exported purely for documentation purposes.
+--
+-- You shouldn't ever see this type in the compiler's output if
+-- you don't specifically ask for it, for instance when viewing
+-- core, since the compiler will try hard to output a given
+-- @'UnusedType' "m_0"@ simply as @m_0@.
+type family UnusedType :: Symbol -> k where { }
+-- See Note [The types Any and UnusedType] in GHC.Builtin.Types.
{- *********************************************************************
* *
=====================================
testsuite/tests/interface-stability/ghc-prim-exports.stdout
=====================================
@@ -6975,6 +6975,8 @@ module GHC.Types where
type UnliftedRep = BoxedRep Unlifted
type UnliftedType :: *
type UnliftedType = TYPE UnliftedRep
+ type UnusedType :: forall k0. Symbol -> k0
+ type family UnusedType k1 where
type VecCount :: *
data VecCount = Vec2 | Vec4 | Vec8 | Vec16 | Vec32 | Vec64
type VecElem :: *
=====================================
testsuite/tests/interface-stability/ghc-prim-exports.stdout-mingw32
=====================================
@@ -6978,6 +6978,8 @@ module GHC.Types where
type UnliftedRep = BoxedRep Unlifted
type UnliftedType :: *
type UnliftedType = TYPE UnliftedRep
+ type UnusedType :: forall k0. Symbol -> k0
+ type family UnusedType k1 where
type VecCount :: *
data VecCount = Vec2 | Vec4 | Vec8 | Vec16 | Vec32 | Vec64
type VecElem :: *
=====================================
testsuite/tests/perf/compiler/T11068.stdout
=====================================
@@ -23,137 +23,137 @@
`cast` (GHC.Internal.Generics.N:M1
`cast` (GHC.Internal.Generics.N:M1
= GHC.Internal.Generics.L1
- ((GHC.Internal.Generics.U1 @(*) @(GHC.Internal.Types.ZonkAny 0))
+ ((GHC.Internal.Generics.U1
`cast` (Sym (GHC.Internal.Generics.N:M1
= GHC.Internal.Generics.L1
= GHC.Internal.Generics.L1
= GHC.Internal.Generics.L1
- ((GHC.Internal.Generics.U1 @(*) @(GHC.Internal.Types.ZonkAny 0))
+ ((GHC.Internal.Generics.U1
`cast` (Sym (GHC.Internal.Generics.N:M1
= GHC.Internal.Generics.R1
= GHC.Internal.Generics.L1
= GHC.Internal.Generics.L1
= GHC.Internal.Generics.R1
- ((GHC.Internal.Generics.U1 @(*) @(GHC.Internal.Types.ZonkAny 0))
+ ((GHC.Internal.Generics.U1
`cast` (Sym (GHC.Internal.Generics.N:M1
= GHC.Internal.Generics.R1
= GHC.Internal.Generics.L1
= GHC.Internal.Generics.L1
= GHC.Internal.Generics.L1
- ((GHC.Internal.Generics.U1 @(*) @(GHC.Internal.Types.ZonkAny 0))
+ ((GHC.Internal.Generics.U1
`cast` (Sym (GHC.Internal.Generics.N:M1
= GHC.Internal.Generics.R1
= GHC.Internal.Generics.L1
= GHC.Internal.Generics.L1
- ((GHC.Internal.Generics.U1 @(*) @(GHC.Internal.Types.ZonkAny 0))
+ ((GHC.Internal.Generics.U1
`cast` (Sym (GHC.Internal.Generics.N:M1
= GHC.Internal.Generics.R1
= GHC.Internal.Generics.R1
= GHC.Internal.Generics.L1
= GHC.Internal.Generics.R1
- ((GHC.Internal.Generics.U1 @(*) @(GHC.Internal.Types.ZonkAny 0))
+ ((GHC.Internal.Generics.U1
`cast` (Sym (GHC.Internal.Generics.N:M1
= GHC.Internal.Generics.R1
= GHC.Internal.Generics.R1
= GHC.Internal.Generics.L1
= GHC.Internal.Generics.L1
- ((GHC.Internal.Generics.U1 @(*) @(GHC.Internal.Types.ZonkAny 0))
+ ((GHC.Internal.Generics.U1
`cast` (Sym (GHC.Internal.Generics.N:M1
= GHC.Internal.Generics.L1
= GHC.Internal.Generics.R1
= GHC.Internal.Generics.L1
- ((GHC.Internal.Generics.U1 @(*) @(GHC.Internal.Types.ZonkAny 0))
+ ((GHC.Internal.Generics.U1
`cast` (Sym (GHC.Internal.Generics.N:M1
= GHC.Internal.Generics.R1
= GHC.Internal.Generics.L1
= GHC.Internal.Generics.R1
= GHC.Internal.Generics.R1
- ((GHC.Internal.Generics.U1 @(*) @(GHC.Internal.Types.ZonkAny 0))
+ ((GHC.Internal.Generics.U1
`cast` (Sym (GHC.Internal.Generics.N:M1
= GHC.Internal.Generics.R1
= GHC.Internal.Generics.L1
= GHC.Internal.Generics.R1
= GHC.Internal.Generics.L1
- ((GHC.Internal.Generics.U1 @(*) @(GHC.Internal.Types.ZonkAny 0))
+ ((GHC.Internal.Generics.U1
`cast` (Sym (GHC.Internal.Generics.N:M1
= GHC.Internal.Generics.R1
= GHC.Internal.Generics.R1
= GHC.Internal.Generics.L1
- ((GHC.Internal.Generics.U1 @(*) @(GHC.Internal.Types.ZonkAny 0))
+ ((GHC.Internal.Generics.U1
`cast` (Sym (GHC.Internal.Generics.N:M1
= GHC.Internal.Generics.R1
= GHC.Internal.Generics.R1
= GHC.Internal.Generics.R1
= GHC.Internal.Generics.R1
- ((GHC.Internal.Generics.U1 @(*) @(GHC.Internal.Types.ZonkAny 0))
+ ((GHC.Internal.Generics.U1
`cast` (Sym (GHC.Internal.Generics.N:M1
= GHC.Internal.Generics.R1
= GHC.Internal.Generics.R1
= GHC.Internal.Generics.R1
= GHC.Internal.Generics.L1
- ((GHC.Internal.Generics.U1 @(*) @(GHC.Internal.Types.ZonkAny 0))
+ ((GHC.Internal.Generics.U1
`cast` (Sym (GHC.Internal.Generics.N:M1
= GHC.Internal.Generics.L1
= GHC.Internal.Generics.L1
= GHC.Internal.Generics.L1
- ((GHC.Internal.Generics.U1 @(*) @(GHC.Internal.Types.ZonkAny 0))
+ ((GHC.Internal.Generics.U1
`cast` (Sym (GHC.Internal.Generics.N:M1
= GHC.Internal.Generics.R1
= GHC.Internal.Generics.L1
= GHC.Internal.Generics.L1
= GHC.Internal.Generics.R1
- ((GHC.Internal.Generics.U1 @(*) @(GHC.Internal.Types.ZonkAny 0))
+ ((GHC.Internal.Generics.U1
`cast` (Sym (GHC.Internal.Generics.N:M1
= GHC.Internal.Generics.R1
= GHC.Internal.Generics.L1
= GHC.Internal.Generics.L1
= GHC.Internal.Generics.L1
- ((GHC.Internal.Generics.U1 @(*) @(GHC.Internal.Types.ZonkAny 0))
+ ((GHC.Internal.Generics.U1
`cast` (Sym (GHC.Internal.Generics.N:M1
= GHC.Internal.Generics.R1
= GHC.Internal.Generics.L1
= GHC.Internal.Generics.L1
- ((GHC.Internal.Generics.U1 @(*) @(GHC.Internal.Types.ZonkAny 0))
+ ((GHC.Internal.Generics.U1
`cast` (Sym (GHC.Internal.Generics.N:M1
= GHC.Internal.Generics.R1
= GHC.Internal.Generics.R1
= GHC.Internal.Generics.L1
= GHC.Internal.Generics.R1
- ((GHC.Internal.Generics.U1 @(*) @(GHC.Internal.Types.ZonkAny 0))
+ ((GHC.Internal.Generics.U1
`cast` (Sym (GHC.Internal.Generics.N:M1
= GHC.Internal.Generics.R1
= GHC.Internal.Generics.R1
= GHC.Internal.Generics.L1
= GHC.Internal.Generics.L1
- ((GHC.Internal.Generics.U1 @(*) @(GHC.Internal.Types.ZonkAny 0))
+ ((GHC.Internal.Generics.U1
`cast` (Sym (GHC.Internal.Generics.N:M1
= GHC.Internal.Generics.L1
= GHC.Internal.Generics.R1
= GHC.Internal.Generics.L1
- ((GHC.Internal.Generics.U1 @(*) @(GHC.Internal.Types.ZonkAny 0))
+ ((GHC.Internal.Generics.U1
`cast` (Sym (GHC.Internal.Generics.N:M1
= GHC.Internal.Generics.R1
= GHC.Internal.Generics.L1
= GHC.Internal.Generics.R1
= GHC.Internal.Generics.R1
- ((GHC.Internal.Generics.U1 @(*) @(GHC.Internal.Types.ZonkAny 0))
+ ((GHC.Internal.Generics.U1
`cast` (Sym (GHC.Internal.Generics.N:M1
= GHC.Internal.Generics.R1
= GHC.Internal.Generics.L1
= GHC.Internal.Generics.R1
= GHC.Internal.Generics.L1
- ((GHC.Internal.Generics.U1 @(*) @(GHC.Internal.Types.ZonkAny 0))
+ ((GHC.Internal.Generics.U1
`cast` (Sym (GHC.Internal.Generics.N:M1
= GHC.Internal.Generics.R1
= GHC.Internal.Generics.R1
= GHC.Internal.Generics.L1
- ((GHC.Internal.Generics.U1 @(*) @(GHC.Internal.Types.ZonkAny 0))
+ ((GHC.Internal.Generics.U1
`cast` (Sym (GHC.Internal.Generics.N:M1
= GHC.Internal.Generics.R1
= GHC.Internal.Generics.R1
= GHC.Internal.Generics.R1
= GHC.Internal.Generics.R1
- ((GHC.Internal.Generics.U1 @(*) @(GHC.Internal.Types.ZonkAny 0))
+ ((GHC.Internal.Generics.U1
`cast` (Sym (GHC.Internal.Generics.N:M1
= GHC.Internal.Generics.R1
= GHC.Internal.Generics.R1
=====================================
testsuite/tests/pmcheck/should_compile/T12957.stderr
=====================================
@@ -1,7 +1,6 @@
T12957.hs:4:5: warning: [GHC-62161] [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
- In a case alternative:
- Patterns of type ‘[GHC.Internal.Types.ZonkAny 0]’ not matched: []
+ In a case alternative: Patterns of type ‘[a_0]’ not matched: []
T12957.hs:4:16: warning: [GHC-53633] [-Woverlapping-patterns (in -Wdefault)]
Pattern match is redundant
=====================================
testsuite/tests/profiling/should_run/staticcallstack002.stdout
=====================================
@@ -1,4 +1,4 @@
-Just (InfoProv {ipName = "sat_s1Rh_info", ipDesc = THUNK, ipTyDesc = "ZonkAny 0", ipLabel = "main", ipUnitId = "main", ipMod = "Main", ipSrcFile = "staticcallstack002.hs", ipSrcSpan = "10:23-39"})
-Just (InfoProv {ipName = "sat_s1RB_info", ipDesc = THUNK, ipTyDesc = "ZonkAny 1", ipLabel = "main", ipUnitId = "main", ipMod = "Main", ipSrcFile = "staticcallstack002.hs", ipSrcSpan = "11:23-42"})
-Just (InfoProv {ipName = "sat_s1RV_info", ipDesc = THUNK, ipTyDesc = "ZonkAny 2", ipLabel = "main", ipUnitId = "main", ipMod = "Main", ipSrcFile = "staticcallstack002.hs", ipSrcSpan = "12:23-46"})
-Just (InfoProv {ipName = "sat_s1Sf_info", ipDesc = THUNK, ipTyDesc = "ZonkAny 3", ipLabel = "main", ipUnitId = "main", ipMod = "Main", ipSrcFile = "staticcallstack002.hs", ipSrcSpan = "13:23-44"})
+Just (InfoProv {ipName = "main_sat_t2fs_info", ipDesc = THUNK, ipTyDesc = "UnusedType \"a_0\"", ipLabel = "main", ipUnitId = "main", ipMod = "Main", ipSrcFile = "staticcallstack002.hs", ipSrcSpan = "10:23-39"})
+Just (InfoProv {ipName = "main_sat_t2fJ_info", ipDesc = THUNK, ipTyDesc = "UnusedType \"a_1\"", ipLabel = "main", ipUnitId = "main", ipMod = "Main", ipSrcFile = "staticcallstack002.hs", ipSrcSpan = "11:23-42"})
+Just (InfoProv {ipName = "main_sat_t2g0_info", ipDesc = THUNK, ipTyDesc = "UnusedType \"a_2\"", ipLabel = "main", ipUnitId = "main", ipMod = "Main", ipSrcFile = "staticcallstack002.hs", ipSrcSpan = "12:23-46"})
+Just (InfoProv {ipName = "main_sat_t2gh_info", ipDesc = THUNK, ipTyDesc = "UnusedType \"a_3\"", ipLabel = "main", ipUnitId = "main", ipMod = "Main", ipSrcFile = "staticcallstack002.hs", ipSrcSpan = "13:23-44"})
=====================================
testsuite/tests/simplCore/should_compile/Makefile
=====================================
@@ -188,7 +188,7 @@ T13155:
T13156:
$(RM) -f T13156.hi T13156.o
- '$(TEST_HC)' $(TEST_HC_OPTS) -c T13156.hs -O -ddump-prep -dsuppress-uniques | grep "case.*Any"
+ '$(TEST_HC)' $(TEST_HC_OPTS) -c T13156.hs -O -ddump-prep -dsuppress-uniques | grep "case.*UnusedType"
# There should be a single 'case r @ GHC.Types.Any'
.PHONY: T4138
=====================================
testsuite/tests/simplCore/should_compile/T13156.stdout
=====================================
@@ -1,2 +1,2 @@
- case r @(GHC.Internal.Types.ZonkAny 0) of { __DEFAULT ->
- case r @(GHC.Internal.Types.ZonkAny 1) of { __DEFAULT -> r @a }
+ case r @(GHC.Internal.Types.UnusedType "a_0") of { __DEFAULT ->
+ case r @(GHC.Internal.Types.UnusedType "a_1") of { __DEFAULT ->
=====================================
testsuite/tests/simplCore/should_compile/T26615.stderr
=====================================
@@ -2,7 +2,7 @@
==================== Tidy Core ====================
Result size of Tidy Core
- = {terms: 1,209, types: 1,139, coercions: 18, joins: 17/29}
+ = {terms: 1,209, types: 1,155, coercions: 18, joins: 17/29}
-- RHS size: {terms: 6, types: 8, coercions: 0, joins: 0/0}
unArray :: forall a. Array a -> SmallArray# a
@@ -15,45 +15,29 @@ unArray :: forall a. Array a -> SmallArray# a
unArray = \ (@a) (ds :: Array a) -> case ds of { Array ds1 -> ds1 }
-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
-T26615a.$trModule4 :: Addr#
-[GblId,
- Unf=Unf{Src=<vanilla>, TopLvl=True,
- Value=True, ConLike=True, WorkFree=True, Expandable=True,
- Guidance=IF_ARGS [] 20 0}]
-T26615a.$trModule4 = "main"#
+$trModule1 :: Addr#
+[GblId, Unf=OtherCon []]
+$trModule1 = "main"#
-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
-T26615a.$trModule3 :: GHC.Internal.Types.TrName
-[GblId,
- Unf=Unf{Src=<vanilla>, TopLvl=True,
- Value=True, ConLike=True, WorkFree=True, Expandable=True,
- Guidance=IF_ARGS [] 10 10}]
-T26615a.$trModule3 = GHC.Internal.Types.TrNameS T26615a.$trModule4
+$trModule2 :: GHC.Internal.Types.TrName
+[GblId, Unf=OtherCon []]
+$trModule2 = GHC.Internal.Types.TrNameS $trModule1
-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
-T26615a.$trModule2 :: Addr#
-[GblId,
- Unf=Unf{Src=<vanilla>, TopLvl=True,
- Value=True, ConLike=True, WorkFree=True, Expandable=True,
- Guidance=IF_ARGS [] 30 0}]
-T26615a.$trModule2 = "T26615a"#
+$trModule3 :: Addr#
+[GblId, Unf=OtherCon []]
+$trModule3 = "T26615a"#
-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
-T26615a.$trModule1 :: GHC.Internal.Types.TrName
-[GblId,
- Unf=Unf{Src=<vanilla>, TopLvl=True,
- Value=True, ConLike=True, WorkFree=True, Expandable=True,
- Guidance=IF_ARGS [] 10 10}]
-T26615a.$trModule1 = GHC.Internal.Types.TrNameS T26615a.$trModule2
+$trModule4 :: GHC.Internal.Types.TrName
+[GblId, Unf=OtherCon []]
+$trModule4 = GHC.Internal.Types.TrNameS $trModule3
-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0}
-T26615a.$trModule :: GHC.Internal.Types.Module
-[GblId,
- Unf=Unf{Src=<vanilla>, TopLvl=True,
- Value=True, ConLike=True, WorkFree=True, Expandable=True,
- Guidance=IF_ARGS [] 10 10}]
-T26615a.$trModule
- = GHC.Internal.Types.Module T26615a.$trModule3 T26615a.$trModule1
+T26615a.$trModule [InlPrag=[~]] :: GHC.Internal.Types.Module
+[GblId, Unf=OtherCon []]
+T26615a.$trModule = GHC.Internal.Types.Module $trModule2 $trModule4
-- RHS size: {terms: 3, types: 1, coercions: 0, joins: 0/0}
$krep :: GHC.Internal.Types.KindRep
@@ -104,33 +88,24 @@ $krep6
GHC.Internal.Types.$tcSmallArray# $krep5
-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
-T26615a.$tcLeaf2 :: Addr#
-[GblId,
- Unf=Unf{Src=<vanilla>, TopLvl=True,
- Value=True, ConLike=True, WorkFree=True, Expandable=True,
- Guidance=IF_ARGS [] 20 0}]
-T26615a.$tcLeaf2 = "Leaf"#
+$tcLeaf1 :: Addr#
+[GblId, Unf=OtherCon []]
+$tcLeaf1 = "Leaf"#
-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
-T26615a.$tcLeaf1 :: GHC.Internal.Types.TrName
-[GblId,
- Unf=Unf{Src=<vanilla>, TopLvl=True,
- Value=True, ConLike=True, WorkFree=True, Expandable=True,
- Guidance=IF_ARGS [] 10 10}]
-T26615a.$tcLeaf1 = GHC.Internal.Types.TrNameS T26615a.$tcLeaf2
+$tcLeaf2 :: GHC.Internal.Types.TrName
+[GblId, Unf=OtherCon []]
+$tcLeaf2 = GHC.Internal.Types.TrNameS $tcLeaf1
-- RHS size: {terms: 7, types: 0, coercions: 0, joins: 0/0}
-T26615a.$tcLeaf :: GHC.Internal.Types.TyCon
-[GblId,
- Unf=Unf{Src=<vanilla>, TopLvl=True,
- Value=True, ConLike=True, WorkFree=True, Expandable=True,
- Guidance=IF_ARGS [] 10 10}]
+T26615a.$tcLeaf [InlPrag=[~]] :: GHC.Internal.Types.TyCon
+[GblId, Unf=OtherCon []]
T26615a.$tcLeaf
= GHC.Internal.Types.TyCon
13798714324392902582#Word64
3237499036029031497#Word64
T26615a.$trModule
- T26615a.$tcLeaf1
+ $tcLeaf2
0#
GHC.Internal.Types.krep$*->*->*
@@ -160,372 +135,284 @@ $krep10 :: GHC.Internal.Types.KindRep
$krep10 = GHC.Internal.Types.KindRepFun $krep2 $krep9
-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0}
-T26615a.$tc'L1 [InlPrag=[~]] :: GHC.Internal.Types.KindRep
+$krep11 :: GHC.Internal.Types.KindRep
[GblId, Unf=OtherCon []]
-T26615a.$tc'L1 = GHC.Internal.Types.KindRepFun $krep3 $krep10
+$krep11 = GHC.Internal.Types.KindRepFun $krep3 $krep10
-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
-T26615a.$tc'L3 :: Addr#
-[GblId,
- Unf=Unf{Src=<vanilla>, TopLvl=True,
- Value=True, ConLike=True, WorkFree=True, Expandable=True,
- Guidance=IF_ARGS [] 20 0}]
-T26615a.$tc'L3 = "'L"#
+$tc'L1 :: Addr#
+[GblId, Unf=OtherCon []]
+$tc'L1 = "'L"#
-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
-T26615a.$tc'L2 :: GHC.Internal.Types.TrName
-[GblId,
- Unf=Unf{Src=<vanilla>, TopLvl=True,
- Value=True, ConLike=True, WorkFree=True, Expandable=True,
- Guidance=IF_ARGS [] 10 10}]
-T26615a.$tc'L2 = GHC.Internal.Types.TrNameS T26615a.$tc'L3
+$tc'L2 :: GHC.Internal.Types.TrName
+[GblId, Unf=OtherCon []]
+$tc'L2 = GHC.Internal.Types.TrNameS $tc'L1
-- RHS size: {terms: 7, types: 0, coercions: 0, joins: 0/0}
-T26615a.$tc'L :: GHC.Internal.Types.TyCon
-[GblId,
- Unf=Unf{Src=<vanilla>, TopLvl=True,
- Value=True, ConLike=True, WorkFree=True, Expandable=True,
- Guidance=IF_ARGS [] 10 10}]
+T26615a.$tc'L [InlPrag=[~]] :: GHC.Internal.Types.TyCon
+[GblId, Unf=OtherCon []]
T26615a.$tc'L
= GHC.Internal.Types.TyCon
8570419491837374712#Word64
2090006989092642392#Word64
T26615a.$trModule
- T26615a.$tc'L2
+ $tc'L2
2#
- T26615a.$tc'L1
+ $krep11
-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
-T26615a.$tcArray2 :: Addr#
-[GblId,
- Unf=Unf{Src=<vanilla>, TopLvl=True,
- Value=True, ConLike=True, WorkFree=True, Expandable=True,
- Guidance=IF_ARGS [] 30 0}]
-T26615a.$tcArray2 = "Array"#
+$tcArray1 :: Addr#
+[GblId, Unf=OtherCon []]
+$tcArray1 = "Array"#
-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
-T26615a.$tcArray1 :: GHC.Internal.Types.TrName
-[GblId,
- Unf=Unf{Src=<vanilla>, TopLvl=True,
- Value=True, ConLike=True, WorkFree=True, Expandable=True,
- Guidance=IF_ARGS [] 10 10}]
-T26615a.$tcArray1 = GHC.Internal.Types.TrNameS T26615a.$tcArray2
+$tcArray2 :: GHC.Internal.Types.TrName
+[GblId, Unf=OtherCon []]
+$tcArray2 = GHC.Internal.Types.TrNameS $tcArray1
-- RHS size: {terms: 7, types: 0, coercions: 0, joins: 0/0}
-T26615a.$tcArray :: GHC.Internal.Types.TyCon
-[GblId,
- Unf=Unf{Src=<vanilla>, TopLvl=True,
- Value=True, ConLike=True, WorkFree=True, Expandable=True,
- Guidance=IF_ARGS [] 10 10}]
+T26615a.$tcArray [InlPrag=[~]] :: GHC.Internal.Types.TyCon
+[GblId, Unf=OtherCon []]
T26615a.$tcArray
= GHC.Internal.Types.TyCon
10495761415291712389#Word64
7580086293698619153#Word64
T26615a.$trModule
- T26615a.$tcArray1
+ $tcArray2
0#
GHC.Internal.Types.krep$*Arr*
-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0}
-$krep11 :: GHC.Internal.Types.KindRep
+$krep12 :: GHC.Internal.Types.KindRep
[GblId, Unf=OtherCon []]
-$krep11
+$krep12
= GHC.Internal.Types.KindRepTyConApp T26615a.$tcArray $krep4
-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0}
-T26615a.$tc'Array1 [InlPrag=[~]] :: GHC.Internal.Types.KindRep
+$krep13 :: GHC.Internal.Types.KindRep
[GblId, Unf=OtherCon []]
-T26615a.$tc'Array1 = GHC.Internal.Types.KindRepFun $krep6 $krep11
+$krep13 = GHC.Internal.Types.KindRepFun $krep6 $krep12
-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
-T26615a.$tc'Array3 :: Addr#
-[GblId,
- Unf=Unf{Src=<vanilla>, TopLvl=True,
- Value=True, ConLike=True, WorkFree=True, Expandable=True,
- Guidance=IF_ARGS [] 30 0}]
-T26615a.$tc'Array3 = "'Array"#
+$tc'Array1 :: Addr#
+[GblId, Unf=OtherCon []]
+$tc'Array1 = "'Array"#
-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
-T26615a.$tc'Array2 :: GHC.Internal.Types.TrName
-[GblId,
- Unf=Unf{Src=<vanilla>, TopLvl=True,
- Value=True, ConLike=True, WorkFree=True, Expandable=True,
- Guidance=IF_ARGS [] 10 10}]
-T26615a.$tc'Array2 = GHC.Internal.Types.TrNameS T26615a.$tc'Array3
+$tc'Array2 :: GHC.Internal.Types.TrName
+[GblId, Unf=OtherCon []]
+$tc'Array2 = GHC.Internal.Types.TrNameS $tc'Array1
-- RHS size: {terms: 7, types: 0, coercions: 0, joins: 0/0}
-T26615a.$tc'Array :: GHC.Internal.Types.TyCon
-[GblId,
- Unf=Unf{Src=<vanilla>, TopLvl=True,
- Value=True, ConLike=True, WorkFree=True, Expandable=True,
- Guidance=IF_ARGS [] 10 10}]
+T26615a.$tc'Array [InlPrag=[~]] :: GHC.Internal.Types.TyCon
+[GblId, Unf=OtherCon []]
T26615a.$tc'Array
= GHC.Internal.Types.TyCon
12424115309881832159#Word64
15542868641947707803#Word64
T26615a.$trModule
- T26615a.$tc'Array2
+ $tc'Array2
1#
- T26615a.$tc'Array1
+ $krep13
-- RHS size: {terms: 3, types: 2, coercions: 0, joins: 0/0}
-$krep12 :: [GHC.Internal.Types.KindRep]
+$krep14 :: [GHC.Internal.Types.KindRep]
[GblId, Unf=OtherCon []]
-$krep12
+$krep14
= GHC.Internal.Types.:
@GHC.Internal.Types.KindRep
$krep9
(GHC.Internal.Types.[] @GHC.Internal.Types.KindRep)
-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0}
-$krep13 :: GHC.Internal.Types.KindRep
+$krep15 :: GHC.Internal.Types.KindRep
[GblId, Unf=OtherCon []]
-$krep13
- = GHC.Internal.Types.KindRepTyConApp T26615a.$tcArray $krep12
+$krep15
+ = GHC.Internal.Types.KindRepTyConApp T26615a.$tcArray $krep14
-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
-T26615a.$tcHashMap2 :: Addr#
-[GblId,
- Unf=Unf{Src=<vanilla>, TopLvl=True,
- Value=True, ConLike=True, WorkFree=True, Expandable=True,
- Guidance=IF_ARGS [] 30 0}]
-T26615a.$tcHashMap2 = "HashMap"#
+$tcHashMap1 :: Addr#
+[GblId, Unf=OtherCon []]
+$tcHashMap1 = "HashMap"#
-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
-T26615a.$tcHashMap1 :: GHC.Internal.Types.TrName
-[GblId,
- Unf=Unf{Src=<vanilla>, TopLvl=True,
- Value=True, ConLike=True, WorkFree=True, Expandable=True,
- Guidance=IF_ARGS [] 10 10}]
-T26615a.$tcHashMap1
- = GHC.Internal.Types.TrNameS T26615a.$tcHashMap2
+$tcHashMap2 :: GHC.Internal.Types.TrName
+[GblId, Unf=OtherCon []]
+$tcHashMap2 = GHC.Internal.Types.TrNameS $tcHashMap1
-- RHS size: {terms: 7, types: 0, coercions: 0, joins: 0/0}
-T26615a.$tcHashMap :: GHC.Internal.Types.TyCon
-[GblId,
- Unf=Unf{Src=<vanilla>, TopLvl=True,
- Value=True, ConLike=True, WorkFree=True, Expandable=True,
- Guidance=IF_ARGS [] 10 10}]
+T26615a.$tcHashMap [InlPrag=[~]] :: GHC.Internal.Types.TyCon
+[GblId, Unf=OtherCon []]
T26615a.$tcHashMap
= GHC.Internal.Types.TyCon
2021755758654901686#Word64
8209241086311595496#Word64
T26615a.$trModule
- T26615a.$tcHashMap1
+ $tcHashMap2
0#
GHC.Internal.Types.krep$*->*->*
-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0}
-T26615a.$tc'Empty1 [InlPrag=[~]] :: GHC.Internal.Types.KindRep
+$krep16 :: GHC.Internal.Types.KindRep
[GblId, Unf=OtherCon []]
-T26615a.$tc'Empty1
+$krep16
= GHC.Internal.Types.KindRepTyConApp T26615a.$tcHashMap $krep8
-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
-T26615a.$tc'Empty3 :: Addr#
-[GblId,
- Unf=Unf{Src=<vanilla>, TopLvl=True,
- Value=True, ConLike=True, WorkFree=True, Expandable=True,
- Guidance=IF_ARGS [] 30 0}]
-T26615a.$tc'Empty3 = "'Empty"#
+$tc'Empty1 :: Addr#
+[GblId, Unf=OtherCon []]
+$tc'Empty1 = "'Empty"#
-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
-T26615a.$tc'Empty2 :: GHC.Internal.Types.TrName
-[GblId,
- Unf=Unf{Src=<vanilla>, TopLvl=True,
- Value=True, ConLike=True, WorkFree=True, Expandable=True,
- Guidance=IF_ARGS [] 10 10}]
-T26615a.$tc'Empty2 = GHC.Internal.Types.TrNameS T26615a.$tc'Empty3
+$tc'Empty2 :: GHC.Internal.Types.TrName
+[GblId, Unf=OtherCon []]
+$tc'Empty2 = GHC.Internal.Types.TrNameS $tc'Empty1
-- RHS size: {terms: 7, types: 0, coercions: 0, joins: 0/0}
-T26615a.$tc'Empty :: GHC.Internal.Types.TyCon
-[GblId,
- Unf=Unf{Src=<vanilla>, TopLvl=True,
- Value=True, ConLike=True, WorkFree=True, Expandable=True,
- Guidance=IF_ARGS [] 10 10}]
+T26615a.$tc'Empty [InlPrag=[~]] :: GHC.Internal.Types.TyCon
+[GblId, Unf=OtherCon []]
T26615a.$tc'Empty
= GHC.Internal.Types.TyCon
2520556399233147460#Word64
17224648764450205443#Word64
T26615a.$trModule
- T26615a.$tc'Empty2
+ $tc'Empty2
2#
- T26615a.$tc'Empty1
+ $krep16
-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0}
-$krep14 :: GHC.Internal.Types.KindRep
+$krep17 :: GHC.Internal.Types.KindRep
[GblId, Unf=OtherCon []]
-$krep14 = GHC.Internal.Types.KindRepFun $krep9 T26615a.$tc'Empty1
+$krep17 = GHC.Internal.Types.KindRepFun $krep9 $krep16
-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0}
-T26615a.$tc'Leaf1 [InlPrag=[~]] :: GHC.Internal.Types.KindRep
+$krep18 :: GHC.Internal.Types.KindRep
[GblId, Unf=OtherCon []]
-T26615a.$tc'Leaf1 = GHC.Internal.Types.KindRepFun $krep1 $krep14
+$krep18 = GHC.Internal.Types.KindRepFun $krep1 $krep17
-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
-T26615a.$tc'Leaf3 :: Addr#
-[GblId,
- Unf=Unf{Src=<vanilla>, TopLvl=True,
- Value=True, ConLike=True, WorkFree=True, Expandable=True,
- Guidance=IF_ARGS [] 30 0}]
-T26615a.$tc'Leaf3 = "'Leaf"#
+$tc'Leaf1 :: Addr#
+[GblId, Unf=OtherCon []]
+$tc'Leaf1 = "'Leaf"#
-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
-T26615a.$tc'Leaf2 :: GHC.Internal.Types.TrName
-[GblId,
- Unf=Unf{Src=<vanilla>, TopLvl=True,
- Value=True, ConLike=True, WorkFree=True, Expandable=True,
- Guidance=IF_ARGS [] 10 10}]
-T26615a.$tc'Leaf2 = GHC.Internal.Types.TrNameS T26615a.$tc'Leaf3
+$tc'Leaf2 :: GHC.Internal.Types.TrName
+[GblId, Unf=OtherCon []]
+$tc'Leaf2 = GHC.Internal.Types.TrNameS $tc'Leaf1
-- RHS size: {terms: 7, types: 0, coercions: 0, joins: 0/0}
-T26615a.$tc'Leaf :: GHC.Internal.Types.TyCon
-[GblId,
- Unf=Unf{Src=<vanilla>, TopLvl=True,
- Value=True, ConLike=True, WorkFree=True, Expandable=True,
- Guidance=IF_ARGS [] 10 10}]
+T26615a.$tc'Leaf [InlPrag=[~]] :: GHC.Internal.Types.TyCon
+[GblId, Unf=OtherCon []]
T26615a.$tc'Leaf
= GHC.Internal.Types.TyCon
5773656560257991946#Word64
17028074687139582545#Word64
T26615a.$trModule
- T26615a.$tc'Leaf2
+ $tc'Leaf2
2#
- T26615a.$tc'Leaf1
+ $krep18
-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0}
-$krep15 :: GHC.Internal.Types.KindRep
+$krep19 :: GHC.Internal.Types.KindRep
[GblId, Unf=OtherCon []]
-$krep15 = GHC.Internal.Types.KindRepFun $krep13 T26615a.$tc'Empty1
+$krep19 = GHC.Internal.Types.KindRepFun $krep15 $krep16
-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0}
-T26615a.$tc'Collision1 [InlPrag=[~]] :: GHC.Internal.Types.KindRep
+$krep20 :: GHC.Internal.Types.KindRep
[GblId, Unf=OtherCon []]
-T26615a.$tc'Collision1
- = GHC.Internal.Types.KindRepFun $krep1 $krep15
+$krep20 = GHC.Internal.Types.KindRepFun $krep1 $krep19
-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
-T26615a.$tc'Collision3 :: Addr#
-[GblId,
- Unf=Unf{Src=<vanilla>, TopLvl=True,
- Value=True, ConLike=True, WorkFree=True, Expandable=True,
- Guidance=IF_ARGS [] 40 0}]
-T26615a.$tc'Collision3 = "'Collision"#
+$tc'Collision1 :: Addr#
+[GblId, Unf=OtherCon []]
+$tc'Collision1 = "'Collision"#
-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
-T26615a.$tc'Collision2 :: GHC.Internal.Types.TrName
-[GblId,
- Unf=Unf{Src=<vanilla>, TopLvl=True,
- Value=True, ConLike=True, WorkFree=True, Expandable=True,
- Guidance=IF_ARGS [] 10 10}]
-T26615a.$tc'Collision2
- = GHC.Internal.Types.TrNameS T26615a.$tc'Collision3
+$tc'Collision2 :: GHC.Internal.Types.TrName
+[GblId, Unf=OtherCon []]
+$tc'Collision2 = GHC.Internal.Types.TrNameS $tc'Collision1
-- RHS size: {terms: 7, types: 0, coercions: 0, joins: 0/0}
-T26615a.$tc'Collision :: GHC.Internal.Types.TyCon
-[GblId,
- Unf=Unf{Src=<vanilla>, TopLvl=True,
- Value=True, ConLike=True, WorkFree=True, Expandable=True,
- Guidance=IF_ARGS [] 10 10}]
+T26615a.$tc'Collision [InlPrag=[~]] :: GHC.Internal.Types.TyCon
+[GblId, Unf=OtherCon []]
T26615a.$tc'Collision
= GHC.Internal.Types.TyCon
18175105753528304021#Word64
13986842878006680511#Word64
T26615a.$trModule
- T26615a.$tc'Collision2
+ $tc'Collision2
2#
- T26615a.$tc'Collision1
+ $krep20
-- RHS size: {terms: 3, types: 2, coercions: 0, joins: 0/0}
-$krep16 :: [GHC.Internal.Types.KindRep]
+$krep21 :: [GHC.Internal.Types.KindRep]
[GblId, Unf=OtherCon []]
-$krep16
+$krep21
= GHC.Internal.Types.:
@GHC.Internal.Types.KindRep
- T26615a.$tc'Empty1
+ $krep16
(GHC.Internal.Types.[] @GHC.Internal.Types.KindRep)
-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0}
-$krep17 :: GHC.Internal.Types.KindRep
+$krep22 :: GHC.Internal.Types.KindRep
[GblId, Unf=OtherCon []]
-$krep17
- = GHC.Internal.Types.KindRepTyConApp T26615a.$tcArray $krep16
+$krep22
+ = GHC.Internal.Types.KindRepTyConApp T26615a.$tcArray $krep21
-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0}
-T26615a.$tc'Full1 [InlPrag=[~]] :: GHC.Internal.Types.KindRep
+$krep23 :: GHC.Internal.Types.KindRep
[GblId, Unf=OtherCon []]
-T26615a.$tc'Full1
- = GHC.Internal.Types.KindRepFun $krep17 T26615a.$tc'Empty1
+$krep23 = GHC.Internal.Types.KindRepFun $krep22 $krep16
-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
-T26615a.$tc'Full3 :: Addr#
-[GblId,
- Unf=Unf{Src=<vanilla>, TopLvl=True,
- Value=True, ConLike=True, WorkFree=True, Expandable=True,
- Guidance=IF_ARGS [] 30 0}]
-T26615a.$tc'Full3 = "'Full"#
+$tc'Full1 :: Addr#
+[GblId, Unf=OtherCon []]
+$tc'Full1 = "'Full"#
-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
-T26615a.$tc'Full2 :: GHC.Internal.Types.TrName
-[GblId,
- Unf=Unf{Src=<vanilla>, TopLvl=True,
- Value=True, ConLike=True, WorkFree=True, Expandable=True,
- Guidance=IF_ARGS [] 10 10}]
-T26615a.$tc'Full2 = GHC.Internal.Types.TrNameS T26615a.$tc'Full3
+$tc'Full2 :: GHC.Internal.Types.TrName
+[GblId, Unf=OtherCon []]
+$tc'Full2 = GHC.Internal.Types.TrNameS $tc'Full1
-- RHS size: {terms: 7, types: 0, coercions: 0, joins: 0/0}
-T26615a.$tc'Full :: GHC.Internal.Types.TyCon
-[GblId,
- Unf=Unf{Src=<vanilla>, TopLvl=True,
- Value=True, ConLike=True, WorkFree=True, Expandable=True,
- Guidance=IF_ARGS [] 10 10}]
+T26615a.$tc'Full [InlPrag=[~]] :: GHC.Internal.Types.TyCon
+[GblId, Unf=OtherCon []]
T26615a.$tc'Full
= GHC.Internal.Types.TyCon
12008762105994325570#Word64
13514145886440831186#Word64
T26615a.$trModule
- T26615a.$tc'Full2
+ $tc'Full2
2#
- T26615a.$tc'Full1
+ $krep23
-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0}
-T26615a.$tc'BitmapIndexed1 [InlPrag=[~]]
- :: GHC.Internal.Types.KindRep
+$krep24 :: GHC.Internal.Types.KindRep
[GblId, Unf=OtherCon []]
-T26615a.$tc'BitmapIndexed1
- = GHC.Internal.Types.KindRepFun $krep1 T26615a.$tc'Full1
+$krep24 = GHC.Internal.Types.KindRepFun $krep1 $krep23
-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
-T26615a.$tc'BitmapIndexed3 :: Addr#
-[GblId,
- Unf=Unf{Src=<vanilla>, TopLvl=True,
- Value=True, ConLike=True, WorkFree=True, Expandable=True,
- Guidance=IF_ARGS [] 50 0}]
-T26615a.$tc'BitmapIndexed3 = "'BitmapIndexed"#
+$tc'BitmapIndexed1 :: Addr#
+[GblId, Unf=OtherCon []]
+$tc'BitmapIndexed1 = "'BitmapIndexed"#
-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
-T26615a.$tc'BitmapIndexed2 :: GHC.Internal.Types.TrName
-[GblId,
- Unf=Unf{Src=<vanilla>, TopLvl=True,
- Value=True, ConLike=True, WorkFree=True, Expandable=True,
- Guidance=IF_ARGS [] 10 10}]
-T26615a.$tc'BitmapIndexed2
- = GHC.Internal.Types.TrNameS T26615a.$tc'BitmapIndexed3
+$tc'BitmapIndexed2 :: GHC.Internal.Types.TrName
+[GblId, Unf=OtherCon []]
+$tc'BitmapIndexed2 = GHC.Internal.Types.TrNameS $tc'BitmapIndexed1
-- RHS size: {terms: 7, types: 0, coercions: 0, joins: 0/0}
-T26615a.$tc'BitmapIndexed :: GHC.Internal.Types.TyCon
-[GblId,
- Unf=Unf{Src=<vanilla>, TopLvl=True,
- Value=True, ConLike=True, WorkFree=True, Expandable=True,
- Guidance=IF_ARGS [] 10 10}]
+T26615a.$tc'BitmapIndexed [InlPrag=[~]] :: GHC.Internal.Types.TyCon
+[GblId, Unf=OtherCon []]
T26615a.$tc'BitmapIndexed
= GHC.Internal.Types.TyCon
15226751910432948177#Word64
957331387129868915#Word64
T26615a.$trModule
- T26615a.$tc'BitmapIndexed2
+ $tc'BitmapIndexed2
2#
- T26615a.$tc'BitmapIndexed1
+ $krep24
-- RHS size: {terms: 98, types: 109, coercions: 0, joins: 3/4}
T26615a.$wdisjointCollisions [InlPrag=INLINABLE[2]]
@@ -538,7 +425,7 @@ T26615a.$wdisjointCollisions [InlPrag=INLINABLE[2]]
Str=<LP(SC(S,C(1,L)),A)><L><1L><L><L>,
Unf=Unf{Src=StableUser, TopLvl=True,
Value=True, ConLike=True, WorkFree=True, Expandable=True,
- Guidance=IF_ARGS [30 0 20 0 0] 406 10
+ Guidance=IF_ARGS [90 0 20 0 0] 406 10
Tmpl= \ (@k)
(@a)
(@b)
@@ -586,7 +473,7 @@ T26615a.$wdisjointCollisions [InlPrag=INLINABLE[2]]
Arity=5,
Str=<L><L><L><L><L>,
Unf=OtherCon []]
- lookupInArrayCont_ _ [Occ=Dead]
+ lookupInArrayCont_ ($dEq1 [Occ=Dead] :: Eq k)
(k1 [Occ=Once1] :: k)
(ary1 [Occ=Once1!] :: Array (Leaf k b))
(i1 [Occ=Once1!] :: Int)
@@ -654,24 +541,23 @@ T26615a.$wdisjointCollisions
$s$wfoldr_ [InlPrag=[2],
Occ=LoopBreaker,
Dmd=SC(S,C(1,C(1,C(1,L))))]
- :: Bool -> Int# -> Int# -> SmallArray# (Leaf k a) -> Bool
+ :: SmallArray# (Leaf k a) -> Int# -> Int# -> Bool -> Bool
[LclId[JoinId(4)(Nothing)],
Arity=4,
Str=<L><L><L><L>,
Unf=OtherCon []]
- $s$wfoldr_ (sc :: Bool)
+ $s$wfoldr_ (sc :: SmallArray# (Leaf k a))
(sc1 :: Int#)
(sc2 :: Int#)
- (sc3 :: SmallArray# (Leaf k a))
- = case >=# sc1 sc2 of {
+ (sc3 :: Bool)
+ = case >=# sc2 sc1 of {
__DEFAULT ->
- case indexSmallArray# @Lifted @(Leaf k a) sc3 sc1 of
- { (# ipv1 #) ->
+ case indexSmallArray# @Lifted @(Leaf k a) sc sc2 of { (# ipv1 #) ->
case ipv1 of { L kA ds1 ->
join {
$j :: Bool
[LclId[JoinId(0)(Nothing)]]
- $j = jump $s$wfoldr_ sc (+# sc1 1#) sc2 sc3 } in
+ $j = jump $s$wfoldr_ sc sc1 (+# sc2 1#) sc3 } in
joinrec {
$wlookupInArrayCont_ [InlPrag=[2],
Occ=LoopBreaker,
@@ -703,13 +589,13 @@ T26615a.$wdisjointCollisions
jump $wlookupInArrayCont_ kA ww2 0# lvl2
}
};
- 1# -> sc
+ 1# -> sc3
}; } in
jump $s$wfoldr_
- GHC.Internal.Types.True
- 0#
- (sizeofSmallArray# @Lifted @(Leaf k a) ipv)
ipv
+ (sizeofSmallArray# @Lifted @(Leaf k a) ipv)
+ 0#
+ GHC.Internal.Types.True
}
}
@@ -728,28 +614,28 @@ Rec {
-- RHS size: {terms: 133, types: 126, coercions: 0, joins: 1/2}
T26615a.disjointSubtrees_$s$wdisjointSubtrees [InlPrag=INLINABLE[2],
Occ=LoopBreaker]
- :: forall b a k.
- Word#
- -> SmallArray# (Leaf k a) -> Int# -> Eq k => HashMap k b -> Bool
+ :: forall k a b.
+ Eq k =>
+ Int# -> Word# -> SmallArray# (Leaf k a) -> HashMap k b -> Bool
[GblId[StrictWorker([~, ~, ~, ~, !])],
Arity=5,
- Str=<L><L><L><LP(SC(S,C(1,L)),A)><1L>,
+ Str=<LP(SC(S,C(1,L)),A)><L><L><L><1L>,
Unf=OtherCon []]
T26615a.disjointSubtrees_$s$wdisjointSubtrees
- = \ (@b)
+ = \ (@k)
(@a)
- (@k)
- (sc :: Word#)
- (sc1 :: SmallArray# (Leaf k a))
- (sc2 :: Int#)
- (sc3 :: Eq k)
+ (@b)
+ (sc :: Eq k)
+ (sc1 :: Int#)
+ (sc2 :: Word#)
+ (sc3 :: SmallArray# (Leaf k a))
(_b :: HashMap k b) ->
case _b of {
Empty -> GHC.Internal.Types.True;
Leaf bx ds ->
case ds of { L kB ds1 ->
case kB of k0 { __DEFAULT ->
- case eqWord# bx sc of {
+ case eqWord# bx sc2 of {
__DEFAULT -> GHC.Internal.Types.True;
1# ->
joinrec {
@@ -770,7 +656,7 @@ T26615a.disjointSubtrees_$s$wdisjointSubtrees
__DEFAULT ->
case indexSmallArray# @Lifted @(Leaf k a) ww ww1 of { (# ipv #) ->
case ipv of { L kx v ->
- case == @k sc3 k2 kx of {
+ case == @k sc k2 kx of {
False -> jump $wlookupInArrayCont_ k2 ww (+# ww1 1#) ww2;
True -> GHC.Internal.Types.False
}
@@ -780,19 +666,19 @@ T26615a.disjointSubtrees_$s$wdisjointSubtrees
}
}; } in
jump $wlookupInArrayCont_
- k0 sc1 0# (sizeofSmallArray# @Lifted @(Leaf k a) sc1)
+ k0 sc3 0# (sizeofSmallArray# @Lifted @(Leaf k a) sc3)
}
}
};
Collision bx bx1 ->
T26615a.$wdisjointCollisions
- @k @a @b sc3 sc (T26615a.Array @(Leaf k a) sc1) bx bx1;
+ @k @a @b sc sc2 (T26615a.Array @(Leaf k a) sc3) bx bx1;
BitmapIndexed bx bx1 ->
let {
m :: Word#
[LclId]
m = uncheckedShiftL#
- 1## (word2Int# (and# (uncheckedShiftRL# sc sc2) 31##)) } in
+ 1## (word2Int# (and# (uncheckedShiftRL# sc2 sc1) 31##)) } in
case and# m bx of {
__DEFAULT ->
case indexSmallArray#
@@ -803,7 +689,7 @@ T26615a.disjointSubtrees_$s$wdisjointSubtrees
of
{ (# ipv #) ->
T26615a.disjointSubtrees_$s$wdisjointSubtrees
- @b @a @k sc sc1 (+# sc2 5#) sc3 ipv
+ @k @a @b sc (+# sc1 5#) sc2 sc3 ipv
};
0## -> GHC.Internal.Types.True
};
@@ -812,17 +698,17 @@ T26615a.disjointSubtrees_$s$wdisjointSubtrees
@Lifted
@(HashMap k b)
bx
- (word2Int# (and# (uncheckedShiftRL# sc sc2) 31##))
+ (word2Int# (and# (uncheckedShiftRL# sc2 sc1) 31##))
of
{ (# ipv #) ->
T26615a.disjointSubtrees_$s$wdisjointSubtrees
- @b @a @k sc sc1 (+# sc2 5#) sc3 ipv
+ @k @a @b sc (+# sc1 5#) sc2 sc3 ipv
}
}
end Rec }
Rec {
--- RHS size: {terms: 705, types: 732, coercions: 18, joins: 13/23}
+-- RHS size: {terms: 705, types: 748, coercions: 18, joins: 13/23}
T26615a.$wdisjointSubtrees [InlPrag=INLINABLE[2], Occ=LoopBreaker]
:: forall k a b. Eq k => Int# -> HashMap k a -> HashMap k b -> Bool
[GblId[StrictWorker([~, ~, !])],
@@ -841,7 +727,7 @@ T26615a.$wdisjointSubtrees [InlPrag=INLINABLE[2], Occ=LoopBreaker]
join {
fail [Occ=Once3!T[1]] :: (# #) -> Bool
[LclId[JoinId(1)(Nothing)], Arity=1, Str=<L>, Unf=OtherCon []]
- fail _ [Occ=Dead, OS=OneShot]
+ fail (ds1 [Occ=Dead, OS=OneShot] :: (# #))
= case _b of wild [Occ=Once1] {
__DEFAULT ->
case GHC.Internal.Control.Exception.Base.patError
@@ -860,7 +746,7 @@ T26615a.$wdisjointSubtrees [InlPrag=INLINABLE[2], Occ=LoopBreaker]
Arity=5,
Str=<L><L><L><L><L>,
Unf=OtherCon []]
- lookupCont_ _ [Occ=Dead]
+ lookupCont_ ($dEq1 [Occ=Dead] :: Eq k)
(ds4 [Occ=Once1!] :: Word)
(ds5 [Occ=Once1] :: k)
(ds6 [Occ=Once1!] :: Int)
@@ -896,7 +782,7 @@ T26615a.$wdisjointSubtrees [InlPrag=INLINABLE[2], Occ=LoopBreaker]
Arity=5,
Str=<L><L><L><L><L>,
Unf=OtherCon []]
- lookupInArrayCont_ _ [Occ=Dead]
+ lookupInArrayCont_ ($dEq2 [Occ=Dead] :: Eq k)
(k1 [Occ=Once1] :: k)
(ary [Occ=Once1!] :: Array (Leaf k a))
(i [Occ=Once1!] :: Int)
@@ -1000,7 +886,7 @@ T26615a.$wdisjointSubtrees [InlPrag=INLINABLE[2], Occ=LoopBreaker]
Arity=5,
Str=<L><L><L><L><L>,
Unf=OtherCon []]
- lookupCont_ _ [Occ=Dead]
+ lookupCont_ ($dEq1 [Occ=Dead] :: Eq k)
(ds3 [Occ=Once1!] :: Word)
(ds4 [Occ=Once1] :: k)
(ds5 [Occ=Once1!] :: Int)
@@ -1034,7 +920,7 @@ T26615a.$wdisjointSubtrees [InlPrag=INLINABLE[2], Occ=LoopBreaker]
Arity=5,
Str=<L><L><L><L><L>,
Unf=OtherCon []]
- lookupInArrayCont_ _ [Occ=Dead]
+ lookupInArrayCont_ ($dEq2 [Occ=Dead] :: Eq k)
(k1 [Occ=Once1] :: k)
(ary [Occ=Once1!] :: Array (Leaf k b))
(i [Occ=Once1!] :: Int)
@@ -1179,23 +1065,23 @@ T26615a.$wdisjointSubtrees [InlPrag=INLINABLE[2], Occ=LoopBreaker]
@(*)
@(SmallArray# (HashMap k a)
-> SmallArray# (HashMap k b) -> Int#)
- @(GHC.Internal.Types.ZonkAny 0
- -> GHC.Internal.Types.ZonkAny 1 -> Int#)
+ @(GHC.Internal.Types.UnusedType 0 "a"
+ -> GHC.Internal.Types.UnusedType 1 "b" -> Int#)
of
{ GHC.Internal.Unsafe.Coerce.UnsafeRefl v2 ->
case reallyUnsafePtrEquality#
@Lifted
@Lifted
- @(GHC.Internal.Types.ZonkAny 0)
- @(GHC.Internal.Types.ZonkAny 1)
+ @(GHC.Internal.Types.UnusedType 0 "a")
+ @(GHC.Internal.Types.UnusedType 1 "b")
(bx1
`cast` (SelCo:Fun(arg) (Sub (Sym v2))
:: SmallArray# (HashMap k a)
- ~R# GHC.Internal.Types.ZonkAny 0))
+ ~R# GHC.Internal.Types.UnusedType 0 "a"))
(bx3
`cast` (SelCo:Fun(arg) (SelCo:Fun(res) (Sub (Sym v2)))
:: SmallArray# (HashMap k b)
- ~R# GHC.Internal.Types.ZonkAny 1))
+ ~R# GHC.Internal.Types.UnusedType 1 "b"))
of {
__DEFAULT ->
joinrec {
@@ -1324,51 +1210,49 @@ T26615a.$wdisjointSubtrees [InlPrag=INLINABLE[2], Occ=LoopBreaker]
}; } in
jump go (GHC.Internal.Types.W# (and# 4294967295## bx1));
Full bx1 ->
+ joinrec {
+ go [Occ=LoopBreakerT[1]] :: Int -> Bool
+ [LclId[JoinId(1)(Nothing)], Arity=1, Str=<L>, Unf=OtherCon []]
+ go (i :: Int)
+ = case GHC.Internal.Classes.ltInt i (GHC.Internal.Types.I# 0#) of {
+ False ->
+ case i of { I# i# ->
+ case indexSmallArray# @Lifted @(HashMap k a) bx i# of
+ { (# ipv [Occ=Once1] #) ->
+ case indexSmallArray# @Lifted @(HashMap k b) bx1 i# of
+ { (# ipv1 [Occ=Once1] #) ->
+ case T26615a.$wdisjointSubtrees @k @a @b $dEq (+# ww 5#) ipv ipv1
+ of {
+ False -> GHC.Internal.Types.False;
+ True -> jump go (GHC.Internal.Types.I# (-# i# 1#))
+ }
+ }
+ }
+ };
+ True -> GHC.Internal.Types.True
+ }; } in
case GHC.Internal.Unsafe.Coerce.unsafeEqualityProof
@(*)
@(SmallArray# (HashMap k a) -> SmallArray# (HashMap k b) -> Int#)
- @(GHC.Internal.Types.ZonkAny 0
- -> GHC.Internal.Types.ZonkAny 1 -> Int#)
+ @(GHC.Internal.Types.UnusedType 0 "a"
+ -> GHC.Internal.Types.UnusedType 1 "b" -> Int#)
of
{ GHC.Internal.Unsafe.Coerce.UnsafeRefl v2 ->
case reallyUnsafePtrEquality#
@Lifted
@Lifted
- @(GHC.Internal.Types.ZonkAny 0)
- @(GHC.Internal.Types.ZonkAny 1)
+ @(GHC.Internal.Types.UnusedType 0 "a")
+ @(GHC.Internal.Types.UnusedType 1 "b")
(bx
`cast` (SelCo:Fun(arg) (Sub (Sym v2))
:: SmallArray# (HashMap k a)
- ~R# GHC.Internal.Types.ZonkAny 0))
+ ~R# GHC.Internal.Types.UnusedType 0 "a"))
(bx1
`cast` (SelCo:Fun(arg) (SelCo:Fun(res) (Sub (Sym v2)))
:: SmallArray# (HashMap k b)
- ~R# GHC.Internal.Types.ZonkAny 1))
+ ~R# GHC.Internal.Types.UnusedType 1 "b"))
of {
- __DEFAULT ->
- joinrec {
- go [Occ=LoopBreakerT[1]] :: Int -> Bool
- [LclId[JoinId(1)(Nothing)], Arity=1, Str=<L>, Unf=OtherCon []]
- go (i :: Int)
- = case GHC.Internal.Classes.ltInt i (GHC.Internal.Types.I# 0#) of {
- False ->
- case i of { I# i# ->
- case indexSmallArray# @Lifted @(HashMap k a) bx i# of
- { (# ipv [Occ=Once1] #) ->
- case indexSmallArray# @Lifted @(HashMap k b) bx1 i# of
- { (# ipv1 [Occ=Once1] #) ->
- case T26615a.$wdisjointSubtrees
- @k @a @b $dEq (+# ww 5#) ipv ipv1
- of {
- False -> GHC.Internal.Types.False;
- True -> jump go (GHC.Internal.Types.I# (-# i# 1#))
- }
- }
- }
- };
- True -> GHC.Internal.Types.True
- }; } in
- jump go (GHC.Internal.Types.I# 31#);
+ __DEFAULT -> jump go (GHC.Internal.Types.I# 31#);
1# -> GHC.Internal.Types.False
}
}
@@ -1385,7 +1269,7 @@ T26615a.$wdisjointSubtrees
join {
fail [Dmd=MC(1,L)] :: (# #) -> Bool
[LclId[JoinId(1)(Nothing)], Arity=1, Str=<A>, Unf=OtherCon []]
- fail _ [Occ=Dead, OS=OneShot]
+ fail (ds1 [Occ=Dead, OS=OneShot] :: (# #))
= case _b of {
__DEFAULT -> case lvl1 of {};
Empty -> GHC.Internal.Types.True;
@@ -1508,7 +1392,7 @@ T26615a.$wdisjointSubtrees
};
Collision bx bx1 ->
T26615a.disjointSubtrees_$s$wdisjointSubtrees
- @a @b @k bx bx1 ww $dEq ds
+ @k @b @a $dEq ww bx bx1 ds
} } in
case ds of {
Empty -> GHC.Internal.Types.True;
@@ -1661,7 +1545,7 @@ T26615a.$wdisjointSubtrees
of
{ (# ipv #) ->
T26615a.disjointSubtrees_$s$wdisjointSubtrees
- @b @a @k bx bx1 (+# ww 5#) $dEq ipv
+ @k @a @b $dEq (+# ww 5#) bx bx1 ipv
};
0## -> GHC.Internal.Types.True
};
@@ -1674,7 +1558,7 @@ T26615a.$wdisjointSubtrees
of
{ (# ipv #) ->
T26615a.disjointSubtrees_$s$wdisjointSubtrees
- @b @a @k bx bx1 (+# ww 5#) $dEq ipv
+ @k @a @b $dEq (+# ww 5#) bx bx1 ipv
}
};
BitmapIndexed bx bx1 ->
@@ -1686,21 +1570,23 @@ T26615a.$wdisjointSubtrees
case GHC.Internal.Unsafe.Coerce.unsafeEqualityProof
@(*)
@(SmallArray# (HashMap k a) -> SmallArray# (HashMap k b) -> Int#)
- @(GHC.Internal.Types.ZonkAny 0
- -> GHC.Internal.Types.ZonkAny 1 -> Int#)
+ @(GHC.Internal.Types.UnusedType 0 "a"
+ -> GHC.Internal.Types.UnusedType 1 "b" -> Int#)
of
{ GHC.Internal.Unsafe.Coerce.UnsafeRefl v2 ->
case reallyUnsafePtrEquality#
@Lifted
@Lifted
- @(GHC.Internal.Types.ZonkAny 0)
- @(GHC.Internal.Types.ZonkAny 1)
+ @(GHC.Internal.Types.UnusedType 0 "a")
+ @(GHC.Internal.Types.UnusedType 1 "b")
(bx1
`cast` (SelCo:Fun(arg) (Sub (Sym v2))
- :: SmallArray# (HashMap k a) ~R# GHC.Internal.Types.ZonkAny 0))
+ :: SmallArray# (HashMap k a)
+ ~R# GHC.Internal.Types.UnusedType 0 "a"))
(bx3
`cast` (SelCo:Fun(arg) (SelCo:Fun(res) (Sub (Sym v2)))
- :: SmallArray# (HashMap k b) ~R# GHC.Internal.Types.ZonkAny 1))
+ :: SmallArray# (HashMap k b)
+ ~R# GHC.Internal.Types.UnusedType 1 "b"))
of {
__DEFAULT ->
let {
@@ -1829,21 +1715,23 @@ T26615a.$wdisjointSubtrees
case GHC.Internal.Unsafe.Coerce.unsafeEqualityProof
@(*)
@(SmallArray# (HashMap k a) -> SmallArray# (HashMap k b) -> Int#)
- @(GHC.Internal.Types.ZonkAny 0
- -> GHC.Internal.Types.ZonkAny 1 -> Int#)
+ @(GHC.Internal.Types.UnusedType 0 "a"
+ -> GHC.Internal.Types.UnusedType 1 "b" -> Int#)
of
{ GHC.Internal.Unsafe.Coerce.UnsafeRefl v2 ->
case reallyUnsafePtrEquality#
@Lifted
@Lifted
- @(GHC.Internal.Types.ZonkAny 0)
- @(GHC.Internal.Types.ZonkAny 1)
+ @(GHC.Internal.Types.UnusedType 0 "a")
+ @(GHC.Internal.Types.UnusedType 1 "b")
(bx
`cast` (SelCo:Fun(arg) (Sub (Sym v2))
- :: SmallArray# (HashMap k a) ~R# GHC.Internal.Types.ZonkAny 0))
+ :: SmallArray# (HashMap k a)
+ ~R# GHC.Internal.Types.UnusedType 0 "a"))
(bx1
`cast` (SelCo:Fun(arg) (SelCo:Fun(res) (Sub (Sym v2)))
- :: SmallArray# (HashMap k b) ~R# GHC.Internal.Types.ZonkAny 1))
+ :: SmallArray# (HashMap k b)
+ ~R# GHC.Internal.Types.UnusedType 1 "b"))
of {
__DEFAULT ->
let {
@@ -1910,88 +1798,72 @@ disjointSubtrees
------ Local rules for imported ids --------
"SC:$wdisjointSubtrees1" [1]
- forall (@a)
+ forall (@k)
(@b)
- (@k)
- (sc :: Word#)
- (sc1 :: SmallArray# (Leaf k a))
+ (@a)
+ (sc :: Eq k)
+ (sc1 :: Int#)
(sc2 :: Word#)
(sc3 :: SmallArray# (Leaf k b))
- (sc4 :: Int#)
- (sc5 :: Eq k).
+ (sc4 :: Word#)
+ (sc5 :: SmallArray# (Leaf k a)).
T26615a.$wdisjointSubtrees @k
@b
@a
- sc5
- sc4
+ sc
+ sc1
(T26615a.Collision @k @b sc2 sc3)
- (T26615a.Collision @k @a sc sc1)
+ (T26615a.Collision @k @a sc4 sc5)
= T26615a.$wdisjointCollisions
- @k @b @a sc5 sc2 (T26615a.Array @(Leaf k b) sc3) sc sc1
+ @k @b @a sc sc2 (T26615a.Array @(Leaf k b) sc3) sc4 sc5
"SC:$wdisjointSubtrees0" [1]
- forall (@b)
+ forall (@k)
(@a)
- (@k)
- (sc :: Word#)
- (sc1 :: SmallArray# (Leaf k a))
- (sc2 :: Int#)
- (sc3 :: Eq k).
+ (@b)
+ (sc :: Eq k)
+ (sc1 :: Int#)
+ (sc2 :: Word#)
+ (sc3 :: SmallArray# (Leaf k a)).
T26615a.$wdisjointSubtrees @k
@a
@b
- sc3
- sc2
- (T26615a.Collision @k @a sc sc1)
+ sc
+ sc1
+ (T26615a.Collision @k @a sc2 sc3)
= T26615a.disjointSubtrees_$s$wdisjointSubtrees
- @b @a @k sc sc1 sc2 sc3
+ @k @a @b sc sc1 sc2 sc3
[2 of 2] Compiling T26615 ( T26615.hs, T26615.o )
==================== Tidy Core ====================
Result size of Tidy Core
- = {terms: 614, types: 666, coercions: 18, joins: 8/14}
+ = {terms: 614, types: 682, coercions: 18, joins: 8/14}
-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
-T26615.$trModule2 :: GHC.Internal.Prim.Addr#
-[GblId,
- Unf=Unf{Src=<vanilla>, TopLvl=True,
- Value=True, ConLike=True, WorkFree=True, Expandable=True,
- Guidance=IF_ARGS [] 30 0}]
-T26615.$trModule2 = "T26615"#
+$trModule1 :: GHC.Internal.Prim.Addr#
+[GblId, Unf=OtherCon []]
+$trModule1 = "T26615"#
-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
-T26615.$trModule1 :: GHC.Internal.Types.TrName
-[GblId,
- Unf=Unf{Src=<vanilla>, TopLvl=True,
- Value=True, ConLike=True, WorkFree=True, Expandable=True,
- Guidance=IF_ARGS [] 10 10}]
-T26615.$trModule1 = GHC.Internal.Types.TrNameS T26615.$trModule2
+$trModule2 :: GHC.Internal.Types.TrName
+[GblId, Unf=OtherCon []]
+$trModule2 = GHC.Internal.Types.TrNameS $trModule1
-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
-T26615.$trModule4 :: GHC.Internal.Prim.Addr#
-[GblId,
- Unf=Unf{Src=<vanilla>, TopLvl=True,
- Value=True, ConLike=True, WorkFree=True, Expandable=True,
- Guidance=IF_ARGS [] 20 0}]
-T26615.$trModule4 = "main"#
+$trModule3 :: GHC.Internal.Prim.Addr#
+[GblId, Unf=OtherCon []]
+$trModule3 = "main"#
-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
-T26615.$trModule3 :: GHC.Internal.Types.TrName
-[GblId,
- Unf=Unf{Src=<vanilla>, TopLvl=True,
- Value=True, ConLike=True, WorkFree=True, Expandable=True,
- Guidance=IF_ARGS [] 10 10}]
-T26615.$trModule3 = GHC.Internal.Types.TrNameS T26615.$trModule4
+$trModule4 :: GHC.Internal.Types.TrName
+[GblId, Unf=OtherCon []]
+$trModule4 = GHC.Internal.Types.TrNameS $trModule3
-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0}
-T26615.$trModule :: GHC.Internal.Types.Module
-[GblId,
- Unf=Unf{Src=<vanilla>, TopLvl=True,
- Value=True, ConLike=True, WorkFree=True, Expandable=True,
- Guidance=IF_ARGS [] 10 10}]
-T26615.$trModule
- = GHC.Internal.Types.Module T26615.$trModule3 T26615.$trModule1
+T26615.$trModule [InlPrag=[~]] :: GHC.Internal.Types.Module
+[GblId, Unf=OtherCon []]
+T26615.$trModule = GHC.Internal.Types.Module $trModule4 $trModule2
-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
lvl :: GHC.Internal.Prim.Addr#
@@ -2128,7 +2000,7 @@ $wpoly_lookupCont_
end Rec }
Rec {
--- RHS size: {terms: 448, types: 507, coercions: 18, joins: 8/13}
+-- RHS size: {terms: 448, types: 523, coercions: 18, joins: 8/13}
T26615.$s$wdisjointSubtrees [InlPrag=[~], Occ=LoopBreaker]
:: forall a b.
GHC.Internal.Prim.Int#
@@ -2143,7 +2015,7 @@ T26615.$s$wdisjointSubtrees
join {
fail [Dmd=MC(1,L)] :: (# #) -> Bool
[LclId[JoinId(1)(Nothing)], Arity=1, Str=<A>, Unf=OtherCon []]
- fail _ [Occ=Dead, OS=OneShot]
+ fail (ds1 [Occ=Dead, OS=OneShot] :: (# #))
= case _b of wild {
__DEFAULT -> case lvl1 of {};
T26615a.Empty -> GHC.Internal.Types.True;
@@ -2190,30 +2062,28 @@ T26615.$s$wdisjointSubtrees
$s$wfoldr_ [InlPrag=[2],
Occ=LoopBreaker,
Dmd=SC(S,C(1,C(1,C(1,L))))]
- :: Bool
- -> GHC.Internal.Prim.Int#
- -> GHC.Internal.Prim.Int#
- -> GHC.Internal.Prim.SmallArray# (T26615a.Leaf [Char] a)
- -> Bool
+ :: GHC.Internal.Prim.SmallArray# (T26615a.Leaf [Char] a)
+ -> GHC.Internal.Prim.Int# -> GHC.Internal.Prim.Int# -> Bool -> Bool
[LclId[JoinId(4)(Nothing)],
Arity=4,
Str=<L><L><L><L>,
Unf=OtherCon []]
- $s$wfoldr_ (sc :: Bool)
+ $s$wfoldr_ (sc
+ :: GHC.Internal.Prim.SmallArray# (T26615a.Leaf [Char] a))
(sc1 :: GHC.Internal.Prim.Int#)
(sc2 :: GHC.Internal.Prim.Int#)
- (sc3 :: GHC.Internal.Prim.SmallArray# (T26615a.Leaf [Char] a))
- = case GHC.Internal.Prim.>=# sc1 sc2 of {
+ (sc3 :: Bool)
+ = case GHC.Internal.Prim.>=# sc2 sc1 of {
__DEFAULT ->
case GHC.Internal.Prim.indexSmallArray#
- @GHC.Internal.Types.Lifted @(T26615a.Leaf String a) sc3 sc1
+ @GHC.Internal.Types.Lifted @(T26615a.Leaf String a) sc sc2
of
{ (# ipv1 #) ->
case ipv1 of { T26615a.L kA ds2 ->
join {
$j :: Bool
[LclId[JoinId(0)(Nothing)]]
- $j = jump $s$wfoldr_ sc (GHC.Internal.Prim.+# sc1 1#) sc2 sc3 } in
+ $j = jump $s$wfoldr_ sc sc1 (GHC.Internal.Prim.+# sc2 1#) sc3 } in
joinrec {
$wlookupInArrayCont_ [InlPrag=[2],
Occ=LoopBreaker,
@@ -2258,14 +2128,14 @@ T26615.$s$wdisjointSubtrees
jump $wlookupInArrayCont_ kA bx3 0# lvl2
}
};
- 1# -> sc
+ 1# -> sc3
}; } in
jump $s$wfoldr_
- GHC.Internal.Types.True
- 0#
+ bx1
(GHC.Internal.Prim.sizeofSmallArray#
@GHC.Internal.Types.Lifted @(T26615a.Leaf String a) bx1)
- bx1
+ 0#
+ GHC.Internal.Types.True
};
T26615a.BitmapIndexed bx2 bx3 ->
let {
@@ -2317,23 +2187,23 @@ T26615.$s$wdisjointSubtrees
@(GHC.Internal.Prim.SmallArray# (HashMap String a)
-> GHC.Internal.Prim.SmallArray# (HashMap String b)
-> GHC.Internal.Prim.Int#)
- @(GHC.Internal.Types.ZonkAny 0
- -> GHC.Internal.Types.ZonkAny 1 -> GHC.Internal.Prim.Int#)
+ @(GHC.Internal.Types.UnusedType 0 "a"
+ -> GHC.Internal.Types.UnusedType 1 "b" -> GHC.Internal.Prim.Int#)
of
{ GHC.Internal.Unsafe.Coerce.UnsafeRefl v2 ->
case GHC.Internal.Prim.reallyUnsafePtrEquality#
@GHC.Internal.Types.Lifted
@GHC.Internal.Types.Lifted
- @(GHC.Internal.Types.ZonkAny 0)
- @(GHC.Internal.Types.ZonkAny 1)
+ @(GHC.Internal.Types.UnusedType 0 "a")
+ @(GHC.Internal.Types.UnusedType 1 "b")
(bx1
`cast` (SelCo:Fun(arg) (Sub (Sym v2))
:: GHC.Internal.Prim.SmallArray# (HashMap String a)
- ~R# GHC.Internal.Types.ZonkAny 0))
+ ~R# GHC.Internal.Types.UnusedType 0 "a"))
(bx3
`cast` (SelCo:Fun(arg) (SelCo:Fun(res) (Sub (Sym v2)))
:: GHC.Internal.Prim.SmallArray# (HashMap String b)
- ~R# GHC.Internal.Types.ZonkAny 1))
+ ~R# GHC.Internal.Types.UnusedType 1 "b"))
of {
__DEFAULT ->
joinrec {
@@ -2495,23 +2365,23 @@ T26615.$s$wdisjointSubtrees
@(GHC.Internal.Prim.SmallArray# (HashMap String a)
-> GHC.Internal.Prim.SmallArray# (HashMap String b)
-> GHC.Internal.Prim.Int#)
- @(GHC.Internal.Types.ZonkAny 0
- -> GHC.Internal.Types.ZonkAny 1 -> GHC.Internal.Prim.Int#)
+ @(GHC.Internal.Types.UnusedType 0 "a"
+ -> GHC.Internal.Types.UnusedType 1 "b" -> GHC.Internal.Prim.Int#)
of
{ GHC.Internal.Unsafe.Coerce.UnsafeRefl v2 ->
case GHC.Internal.Prim.reallyUnsafePtrEquality#
@GHC.Internal.Types.Lifted
@GHC.Internal.Types.Lifted
- @(GHC.Internal.Types.ZonkAny 0)
- @(GHC.Internal.Types.ZonkAny 1)
+ @(GHC.Internal.Types.UnusedType 0 "a")
+ @(GHC.Internal.Types.UnusedType 1 "b")
(bx
`cast` (SelCo:Fun(arg) (Sub (Sym v2))
:: GHC.Internal.Prim.SmallArray# (HashMap String a)
- ~R# GHC.Internal.Types.ZonkAny 0))
+ ~R# GHC.Internal.Types.UnusedType 0 "a"))
(bx1
`cast` (SelCo:Fun(arg) (SelCo:Fun(res) (Sub (Sym v2)))
:: GHC.Internal.Prim.SmallArray# (HashMap String b)
- ~R# GHC.Internal.Types.ZonkAny 1))
+ ~R# GHC.Internal.Types.UnusedType 1 "b"))
of {
__DEFAULT ->
joinrec {
@@ -2564,7 +2434,7 @@ f = \ (@a)
------ Local rules for imported ids --------
"SPEC/T26615 $wdisjointSubtrees @String @_ @_" [2]
- forall (@a) (@b) ($dEq :: Eq String).
+ forall (@a) (@b) ($dEq [Occ=Dead] :: Eq String).
T26615a.$wdisjointSubtrees @String @a @b $dEq
= T26615.$s$wdisjointSubtrees @a @b
=====================================
testsuite/tests/typecheck/should_fail/T13292.stderr
=====================================
@@ -14,15 +14,15 @@ T13292a.hs:4:12: warning: [GHC-39999] [-Wdeferred-type-errors (in -Wdefault)]
In an equation for ‘someFunc’: someFunc = return ()
T13292.hs:6:1: warning: [GHC-83865] [-Wdeferred-type-errors (in -Wdefault)]
- • Couldn't match type ‘GHC.Internal.Types.ZonkAny 0’ with ‘IO’
+ • Couldn't match type ‘m0_0’ with ‘IO’
Expected: IO ()
- Actual: GHC.Internal.Types.ZonkAny 0 ()
+ Actual: m0_0 ()
• When checking the type of the IO action ‘main’
T13292.hs:6:1: warning: [GHC-83865] [-Wdeferred-type-errors (in -Wdefault)]
- • Couldn't match type ‘GHC.Internal.Types.ZonkAny 0’ with ‘IO’
+ • Couldn't match type ‘m0_0’ with ‘IO’
Expected: IO ()
- Actual: GHC.Internal.Types.ZonkAny 0 ()
+ Actual: m0_0 ()
• In the expression: main
When checking the type of the IO action ‘main’
=====================================
testsuite/tests/typecheck/should_fail/T27390-explicit-kinds.stderr
=====================================
@@ -0,0 +1,28 @@
+T27390a.hs:4:12: warning: [GHC-39999] [-Wdeferred-type-errors (in -Wdefault)]
+ • Ambiguous type variable ‘m0’ arising from a use of ‘return’
+ prevents the constraint ‘(Monad m0)’ from being solved.
+ Relevant bindings include
+ someFunc :: m0 () (bound at T27390a.hs:4:1)
+ Probable fix: use a type annotation to specify what ‘m0’ should be.
+ Potentially matching instances:
+ instance Monad IO -- Defined in ‘GHC.Internal.Base’
+ instance Monad Maybe -- Defined in ‘GHC.Internal.Base’
+ ...plus six others
+ ...plus one instance involving out-of-scope types
+ (use -fprint-potential-instances to see them all)
+ • In the expression: return ()
+ In an equation for ‘someFunc’: someFunc = return ()
+
+T27390.hs:6:1: warning: [GHC-83865] [-Wdeferred-type-errors (in -Wdefault)]
+ • Couldn't match type ‘m0_0 :: Type -> Type’ with ‘IO’
+ Expected: IO ()
+ Actual: (m0_0 :: Type -> Type) ()
+ • When checking the type of the IO action ‘main’
+
+T27390.hs:6:1: warning: [GHC-83865] [-Wdeferred-type-errors (in -Wdefault)]
+ • Couldn't match type ‘m0_0 :: Type -> Type’ with ‘IO’
+ Expected: IO ()
+ Actual: (m0_0 :: Type -> Type) ()
+ • In the expression: main
+ When checking the type of the IO action ‘main’
+
=====================================
testsuite/tests/typecheck/should_fail/T27390.hs
=====================================
@@ -0,0 +1,6 @@
+{-# language NoStarIsType #-}
+module Main where
+
+import T27390a
+
+main = someFunc
=====================================
testsuite/tests/typecheck/should_fail/T27390.stderr
=====================================
@@ -0,0 +1,28 @@
+T27390a.hs:4:12: warning: [GHC-39999] [-Wdeferred-type-errors (in -Wdefault)]
+ • Ambiguous type variable ‘m0’ arising from a use of ‘return’
+ prevents the constraint ‘(Monad m0)’ from being solved.
+ Relevant bindings include
+ someFunc :: m0 () (bound at T27390a.hs:4:1)
+ Probable fix: use a type annotation to specify what ‘m0’ should be.
+ Potentially matching instances:
+ instance Monad IO -- Defined in ‘GHC.Internal.Base’
+ instance Monad Maybe -- Defined in ‘GHC.Internal.Base’
+ ...plus six others
+ ...plus one instance involving out-of-scope types
+ (use -fprint-potential-instances to see them all)
+ • In the expression: return ()
+ In an equation for ‘someFunc’: someFunc = return ()
+
+T27390.hs:6:1: warning: [GHC-83865] [-Wdeferred-type-errors (in -Wdefault)]
+ • Couldn't match type ‘m0_0’ with ‘IO’
+ Expected: IO ()
+ Actual: m0_0 ()
+ • When checking the type of the IO action ‘main’
+
+T27390.hs:6:1: warning: [GHC-83865] [-Wdeferred-type-errors (in -Wdefault)]
+ • Couldn't match type ‘m0_0’ with ‘IO’
+ Expected: IO ()
+ Actual: m0_0 ()
+ • In the expression: main
+ When checking the type of the IO action ‘main’
+
=====================================
testsuite/tests/typecheck/should_fail/T27390a.hs
=====================================
@@ -0,0 +1,4 @@
+module T27390a where
+
+
+someFunc = return ()
=====================================
testsuite/tests/typecheck/should_fail/all.T
=====================================
@@ -448,6 +448,8 @@ test('T13075', normal, compile_fail, [''])
test('LevPolyBounded', normal, compile_fail, [''])
test('T13487', normal, compile, [''])
test('T13292', normal, multimod_compile, ['T13292', '-v0 -fdefer-type-errors'])
+test('T27390', normal, multimod_compile, ['T27390', '-v0 -fdefer-type-errors'])
+test('T27390-explicit-kinds', [extra_files(['T27390.hs', 'T27390a.hs'])], multimod_compile, ['T27390', '-v0 -fdefer-type-errors -fprint-explicit-kinds'])
test('T13300', normal, compile_fail, [''])
test('T13311', normal, compile_fail, [''])
test('T13446', normal, compile_fail, [''])
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/a72ff58fa86172b1557e405f7246d27…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/a72ff58fa86172b1557e405f7246d27…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][master] haddock: use Text in documentation pipeline
by Marge Bot (@marge-bot) 25 Jun '26
by Marge Bot (@marge-bot) 25 Jun '26
25 Jun '26
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
202ed264 by Marc Scholten at 2026-06-25T05:52:21-04:00
haddock: use Text in documentation pipeline
This patch moves Haddock's documentation pipeline from String to Text
where the data is already textual. It avoids repeated conversions while
keeping the existing decoding behavior for invalid UTF-8 docstring
chunks.
The main changes are:
* Render and carry docstrings as Text in Haddock-facing paths.
* Use the Binary Text instance from GHC.Utils.Binary for Haddock
interface files, and bump the Haddock binary interface version.
* Add a FastString HTML instance so XHTML rendering avoids
intermediate String allocation.
* Keep HsDocStringChunk decoding lenient, matching the previous
unpackHDSC behavior on invalid UTF-8 input.
* Update the xhtml submodule to 3000.4.1.0, which contains the
apostrophe escaping fix used by the Haddock test output.
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot(a)users.noreply.github.com>
Co-authored-by: Claude Opus 4.5 <noreply(a)anthropic.com>
Assisted-by: Codex <codex(a)openai.com>
- - - - -
31 changed files:
- compiler/GHC/Hs/DocString.hs
- libraries/xhtml
- utils/haddock/haddock-api/src/Haddock.hs
- utils/haddock/haddock-api/src/Haddock/Backends/Hoogle.hs
- utils/haddock/haddock-api/src/Haddock/Backends/LaTeX.hs
- utils/haddock/haddock-api/src/Haddock/Backends/Xhtml.hs
- utils/haddock/haddock-api/src/Haddock/Backends/Xhtml/DocMarkup.hs
- utils/haddock/haddock-api/src/Haddock/Backends/Xhtml/Meta.hs
- utils/haddock/haddock-api/src/Haddock/Backends/Xhtml/Names.hs
- utils/haddock/haddock-api/src/Haddock/Backends/Xhtml/Utils.hs
- utils/haddock/haddock-api/src/Haddock/Doc.hs
- utils/haddock/haddock-api/src/Haddock/GhcUtils.hs
- utils/haddock/haddock-api/src/Haddock/Interface/AttachInstances.hs
- utils/haddock/haddock-api/src/Haddock/Interface/Create.hs
- utils/haddock/haddock-api/src/Haddock/Interface/Json.hs
- utils/haddock/haddock-api/src/Haddock/Interface/LexParseRn.hs
- utils/haddock/haddock-api/src/Haddock/Interface/ParseModuleHeader.hs
- utils/haddock/haddock-api/src/Haddock/Interface/Rename.hs
- utils/haddock/haddock-api/src/Haddock/InterfaceFile.hs
- utils/haddock/haddock-api/src/Haddock/Options.hs
- utils/haddock/haddock-api/src/Haddock/Parser.hs
- utils/haddock/haddock-api/src/Haddock/Types.hs
- utils/haddock/haddock-api/src/Haddock/Utils/Json.hs
- utils/haddock/haddock-api/src/Haddock/Utils/Json/Parser.hs
- utils/haddock/haddock-api/src/Haddock/Utils/Json/Types.hs
- utils/haddock/haddock-library/src/Documentation/Haddock/Doc.hs
- utils/haddock/haddock-library/src/Documentation/Haddock/Markup.hs
- utils/haddock/haddock-library/src/Documentation/Haddock/Parser.hs
- utils/haddock/haddock-library/src/Documentation/Haddock/Parser/Util.hs
- utils/haddock/haddock-library/src/Documentation/Haddock/Types.hs
- utils/haddock/haddock-library/test/Documentation/Haddock/ParserSpec.hs
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/202ed264141ce73928f8d74b1b529cf…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/202ed264141ce73928f8d74b1b529cf…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][master] Add explicit setBit/clearBit/complementBit for instance Bits Integer (#21176)
by Marge Bot (@marge-bot) 25 Jun '26
by Marge Bot (@marge-bot) 25 Jun '26
25 Jun '26
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
f235d183 by Simon Jakobi at 2026-06-25T05:51:18-04:00
Add explicit setBit/clearBit/complementBit for instance Bits Integer (#21176)
The default setBit, clearBit, and complementBit methods allocate
intermediate Integers per call. Define them explicitly via the new
integerSetBit[#], integerClearBit[#] and integerComplementBit[#], built
on the BigNat# primitives, which avoid those allocations. Allocation is not
eliminated entirely -- the negative (IN) cases would need in-place mutation,
which is left as future work.
The default methods constant-folded on literal arguments via the
integerOr/integerAnd/integerXor rules, which fold literal Integers of any
size. The explicit functions have no such rule, so they (their Word-argument
wrappers, and the Bits Integer methods) are marked INLINE to expose the
underlying primops to the simplifier; see Note [INLINE for constant folding
of bit operations]. This restores folding only on the small-int (IS) path --
large literal Integers (IP/IN) are no longer constant-folded, a minor
regression for that case. T8832 covers the IS-path folding.
The new golden-output test T21176 checks all three operations against the
default implementations across the sign/size boundaries, recording each
result plus its integerCheck validity. The base and ghc-bignum interface-
stability export goldens gain the new functions.
The main changelog entry lives in changelog.d under a new ghc-internal
section (renamed from ghc-prim).
CLC proposal: https://github.com/haskell/core-libraries-committee/issues/423
Co-Authored-By: Claude Opus 4.7 <noreply(a)anthropic.com>
- - - - -
13 changed files:
- + changelog.d/T21176
- changelog.d/config
- libraries/base/changelog.md
- libraries/ghc-bignum/changelog.md
- libraries/ghc-internal/src/GHC/Internal/Bignum/Integer.hs
- libraries/ghc-internal/src/GHC/Internal/Bits.hs
- testsuite/tests/interface-stability/ghc-bignum-exports.stdout
- + testsuite/tests/numeric/should_run/T21176.hs
- + testsuite/tests/numeric/should_run/T21176.stdout
- + testsuite/tests/numeric/should_run/T21176.stdout-ws-32
- testsuite/tests/numeric/should_run/all.T
- testsuite/tests/simplCore/should_compile/T8832.hs
- testsuite/tests/simplCore/should_compile/T8832.stdout
Changes:
=====================================
changelog.d/T21176
=====================================
@@ -0,0 +1,4 @@
+section: ghc-internal
+synopsis: Give ``setBit``, ``clearBit`` and ``complementBit`` explicit definitions in ``instance Bits Integer``, backed by new ``integerSetBit[#]``, ``integerClearBit[#]`` and ``integerComplementBit[#]`` functions. These avoid the intermediate ``Integer`` allocations of the previous default methods, although allocation is not eliminated entirely — notably the negative (``IN``) cases would require in-place mutation, which is left as future work. As a trade-off, constant folding of these operations now applies only to small (machine-word-sized) literal arguments; the previous default methods folded literal ``Integer`` arguments of any size via the ``integerOr``/``integerAnd``/``integerXor`` rules.
+issues: #21176
+mrs: !7772
=====================================
changelog.d/config
=====================================
@@ -27,7 +27,7 @@ sections: {
cmm Cmm
build-tools Build tools
base ``base`` library
- ghc-prim ``ghc-prim`` library
+ ghc-internal ``ghc-internal`` library
ghc-lib ``ghc`` library
ghc-heap ``ghc-heap`` library
ghc-experimental ``ghc-experimental`` library
=====================================
libraries/base/changelog.md
=====================================
@@ -1,6 +1,7 @@
# Changelog for [`base` package](http://hackage.haskell.org/package/base)
## 4.24.0.0 *TBA*
+ * Give `setBit`, `clearBit` and `complementBit` explicit definitions in `instance Bits Integer`, reducing intermediate allocations. ([CLC proposal #423](https://github.com/haskell/core-libraries-committee/issues/423))
* Add `Bounded` instances for `Double`, `Float`, `CDouble` and `CFloat`. ([CLC proposal #402](https://github.com/haskell/core-libraries-committee/issues/402))
* Add `Data.List.NonEmpty.{zip{3..7},zipWith{3..7},unzip{3..7}}` ([CLC proposal #409)(https://github.com/haskell/core-libraries-committee/issues/409))
* Ensure that `Data.List.elem` and `notElem` can be specialized even when no list fusion happens. ([CLC proposal #412)(https://github.com/haskell/core-libraries-committee/issues/412))
=====================================
libraries/ghc-bignum/changelog.md
=====================================
@@ -1,5 +1,9 @@
# Changelog for `ghc-bignum` package
+## UNRELEASED
+
+- Add `integerSetBit[#]`, `integerClearBit[#]`, `integerComplementBit[#]` (#21176)
+
## 1.4
- `ghc-bignum`'s implementation has been merged into `ghc-internal`.
=====================================
libraries/ghc-internal/src/GHC/Internal/Bignum/Integer.hs
=====================================
@@ -133,6 +133,12 @@ module GHC.Internal.Bignum.Integer
, integerBit
, integerTestBit#
, integerTestBit
+ , integerSetBit#
+ , integerSetBit
+ , integerClearBit#
+ , integerClearBit
+ , integerComplementBit#
+ , integerComplementBit
, integerShiftR#
, integerShiftR
, integerShiftL#
@@ -707,6 +713,113 @@ integerTestBit# (IN x) i
integerTestBit :: Integer -> Word -> Bool
integerTestBit !i (W# n) = isTrue# (integerTestBit# i n)
+{- Note [INLINE for constant folding of bit operations]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+While there are no dedicated constant-folding rules for
+integerSetBit#/integerClearBit#/integerComplementBit#, we do INLINE them (and
+their Word-argument wrappers and the corresponding Bits Integer methods) to make
+the underlying primops accessible for constant folding, e.g. so that
+`clearBit (bit 0) 0 :: Integer` folds to `IS 0#`. Test T8832 checks the folding
+for all three operations.
+-}
+
+-- | Set the /n/-th bit.
+--
+-- Fake 2's complement for negative values (might be slow)
+--
+-- @since 10.201.0
+integerSetBit# :: Integer -> Word# -> Integer
+{-# INLINE integerSetBit# #-} -- See Note [INLINE for constant folding of bit operations]
+integerSetBit# n@(IS x) i
+ | isTrue# (i `ltWord#` (WORD_SIZE_IN_BITS## `minusWord#` 1##))
+ = IS (x `orI#` uncheckedIShiftL# 1# (word2Int# i))
+ | isTrue# (x >=# 0#)
+ = IP (bigNatSetBit# (bigNatFromWord# (int2Word# x)) i)
+ | True
+ = n
+integerSetBit# (IP x) i = IP (bigNatSetBit# x i)
+integerSetBit# (IN x) i = integerFromBigNatNeg#
+ (bigNatAddWord#
+ (bigNatClearBit# (bigNatSubWordUnsafe# x 1##) i)
+ 1##)
+
+-- | Set the /n/-th bit.
+--
+-- Fake 2's complement for negative values (might be slow)
+--
+-- @since 10.201.0
+integerSetBit :: Integer -> Word -> Integer
+{-# INLINE integerSetBit #-} -- See Note [INLINE for constant folding of bit operations]
+integerSetBit !i (W# n) = integerSetBit# i n
+
+-- | Clear the /n/-th bit.
+--
+-- Fake 2's complement for negative values (might be slow)
+--
+-- @since 10.201.0
+integerClearBit# :: Integer -> Word# -> Integer
+{-# INLINE integerClearBit# #-} -- See Note [INLINE for constant folding of bit operations]
+integerClearBit# n@(IS x) i
+ | isTrue# (i `ltWord#` (WORD_SIZE_IN_BITS## `minusWord#` 1##))
+ = IS (x `andI#` notI# (uncheckedIShiftL# 1# (word2Int# i)))
+ | isTrue# (x >=# 0#)
+ = n
+ | True
+ = IN (bigNatAddWord#
+ (bigNatSetBit#
+ (bigNatFromWord#
+ (minusWord# (int2Word# (negateInt# x)) 1##))
+ i)
+ 1##)
+integerClearBit# (IP x) i = integerFromBigNat# (bigNatClearBit# x i)
+integerClearBit# (IN x) i = IN (bigNatAddWord#
+ (bigNatSetBit# (bigNatSubWordUnsafe# x 1##) i)
+ 1##)
+
+-- | Clear the /n/-th bit.
+--
+-- Fake 2's complement for negative values (might be slow)
+--
+-- @since 10.201.0
+integerClearBit :: Integer -> Word -> Integer
+{-# INLINE integerClearBit #-} -- See Note [INLINE for constant folding of bit operations]
+integerClearBit !i (W# n) = integerClearBit# i n
+
+-- | Reverse the /n/-th bit.
+--
+-- Fake 2's complement for negative values (might be slow)
+--
+-- @since 10.201.0
+integerComplementBit# :: Integer -> Word# -> Integer
+{-# INLINE integerComplementBit# #-} -- See Note [INLINE for constant folding of bit operations]
+integerComplementBit# (IS x) i
+ | isTrue# (i `ltWord#` (WORD_SIZE_IN_BITS## `minusWord#` 1##))
+ = IS (x `xorI#` uncheckedIShiftL# 1# (word2Int# i))
+ | isTrue# (x >=# 0#)
+ = IP (bigNatSetBit# (bigNatFromWord# (int2Word# x)) i)
+ | True
+ = IN (bigNatAddWord#
+ (bigNatSetBit#
+ (bigNatFromWord# (minusWord# (int2Word# (negateInt# x)) 1##))
+ i)
+ 1##)
+integerComplementBit# (IP x) i = integerFromBigNat# (bigNatComplementBit# x i)
+integerComplementBit# (IN x) i = integerFromBigNatNeg#
+ (bigNatAddWord#
+ (bigNatComplementBit#
+ (bigNatSubWordUnsafe# x 1##)
+ i)
+ 1##)
+
+-- | Reverse the /n/-th bit.
+--
+-- Fake 2's complement for negative values (might be slow)
+--
+-- @since 10.201.0
+integerComplementBit :: Integer -> Word -> Integer
+{-# INLINE integerComplementBit #-} -- See Note [INLINE for constant folding of bit operations]
+integerComplementBit !i (W# n) = integerComplementBit# i n
+
-- | Shift-right operation
--
-- Fake 2's complement for negative values (might be slow)
=====================================
libraries/ghc-internal/src/GHC/Internal/Bits.hs
=====================================
@@ -564,6 +564,15 @@ instance Bits Integer where
| otherwise = integerShiftR x (fromIntegral (negate i))
testBit x i = integerTestBit x (fromIntegral i)
zeroBits = integerZero
+ -- INLINE on setBit/clearBit/complementBit preserves constant folding;
+ -- see Note [INLINE for constant folding of bit operations] in
+ -- GHC.Internal.Bignum.Integer.
+ setBit x i = integerSetBit x (fromIntegral i)
+ {-# INLINE setBit #-}
+ clearBit x i = integerClearBit x (fromIntegral i)
+ {-# INLINE clearBit #-}
+ complementBit x i = integerComplementBit x (fromIntegral i)
+ {-# INLINE complementBit #-}
bit (I# i) = integerBit# (int2Word# i)
popCount x = I# (integerPopCount# x)
=====================================
testsuite/tests/interface-stability/ghc-bignum-exports.stdout
=====================================
@@ -201,8 +201,12 @@ module GHC.Num.Integer where
integerBit# :: GHC.Internal.Prim.Word# -> Integer
integerCheck :: Integer -> GHC.Internal.Types.Bool
integerCheck# :: Integer -> GHC.Internal.Bignum.Primitives.Bool#
+ integerClearBit :: Integer -> GHC.Internal.Types.Word -> Integer
+ integerClearBit# :: Integer -> GHC.Internal.Prim.Word# -> Integer
integerCompare :: Integer -> Integer -> GHC.Internal.Types.Ordering
integerComplement :: Integer -> Integer
+ integerComplementBit :: Integer -> GHC.Internal.Types.Word -> Integer
+ integerComplementBit# :: Integer -> GHC.Internal.Prim.Word# -> Integer
integerDecodeDouble# :: GHC.Internal.Prim.Double# -> (# Integer, GHC.Internal.Prim.Int# #)
integerDiv :: Integer -> Integer -> Integer
integerDivMod :: Integer -> Integer -> (Integer, Integer)
@@ -266,6 +270,8 @@ module GHC.Num.Integer where
integerQuotRem# :: Integer -> Integer -> (# Integer, Integer #)
integerRecipMod# :: Integer -> GHC.Internal.Bignum.Natural.Natural -> (# GHC.Internal.Bignum.Natural.Natural | () #)
integerRem :: Integer -> Integer -> Integer
+ integerSetBit :: Integer -> GHC.Internal.Types.Word -> Integer
+ integerSetBit# :: Integer -> GHC.Internal.Prim.Word# -> Integer
integerShiftL :: Integer -> GHC.Internal.Types.Word -> Integer
integerShiftL# :: Integer -> GHC.Internal.Prim.Word# -> Integer
integerShiftR :: Integer -> GHC.Internal.Types.Word -> Integer
=====================================
testsuite/tests/numeric/should_run/T21176.hs
=====================================
@@ -0,0 +1,38 @@
+module Main where
+
+import Data.Bits
+import Data.Int (Int32, Int64)
+import Data.Foldable (for_)
+import GHC.Num.Integer (integerCheck)
+
+integers :: [Integer]
+integers = concatMap neighbours [minInt64, minInt32, 0, maxInt32, maxInt64]
+ where
+ neighbours i = [i - 2, i - 1, i, i + 1, i + 2]
+ minInt64 = toInteger (minBound :: Int64)
+ minInt32 = toInteger (minBound :: Int32)
+ maxInt32 = toInteger (maxBound :: Int32)
+ maxInt64 = toInteger (maxBound :: Int64)
+
+bits :: [Int]
+bits = [0, 1, x - 1, x, x + 1]
+ where x = finiteBitSize (0 :: Int) - 1
+
+testXBit :: String -> (Integer -> Int -> Integer) -> (Integer -> Int -> Integer) -> IO ()
+testXBit name f model = do
+ putStrLn name
+ for_ integers $ \i ->
+ for_ bits $ \b -> do
+ let actual = f i b
+ expected = model i b
+ valid = if integerCheck actual then "valid" else "invalid"
+ matches = if actual == expected then "matches" else "differs"
+ putStrLn $ " " ++ show i ++ " " ++ show b ++ " -> " ++ show actual
+ ++ " [" ++ valid ++ ", " ++ matches ++ "]"
+ putStrLn ""
+
+main :: IO ()
+main = do
+ testXBit "setBit" setBit (\i b -> i .|. bit b)
+ testXBit "clearBit" clearBit (\i b -> i .&. complement (bit b))
+ testXBit "complementBit" complementBit (\i b -> i `xor` bit b)
=====================================
testsuite/tests/numeric/should_run/T21176.stdout
=====================================
@@ -0,0 +1,381 @@
+setBit
+ -9223372036854775810 0 -> -9223372036854775809 [valid, matches]
+ -9223372036854775810 1 -> -9223372036854775810 [valid, matches]
+ -9223372036854775810 62 -> -9223372036854775810 [valid, matches]
+ -9223372036854775810 63 -> -2 [valid, matches]
+ -9223372036854775810 64 -> -9223372036854775810 [valid, matches]
+ -9223372036854775809 0 -> -9223372036854775809 [valid, matches]
+ -9223372036854775809 1 -> -9223372036854775809 [valid, matches]
+ -9223372036854775809 62 -> -9223372036854775809 [valid, matches]
+ -9223372036854775809 63 -> -1 [valid, matches]
+ -9223372036854775809 64 -> -9223372036854775809 [valid, matches]
+ -9223372036854775808 0 -> -9223372036854775807 [valid, matches]
+ -9223372036854775808 1 -> -9223372036854775806 [valid, matches]
+ -9223372036854775808 62 -> -4611686018427387904 [valid, matches]
+ -9223372036854775808 63 -> -9223372036854775808 [valid, matches]
+ -9223372036854775808 64 -> -9223372036854775808 [valid, matches]
+ -9223372036854775807 0 -> -9223372036854775807 [valid, matches]
+ -9223372036854775807 1 -> -9223372036854775805 [valid, matches]
+ -9223372036854775807 62 -> -4611686018427387903 [valid, matches]
+ -9223372036854775807 63 -> -9223372036854775807 [valid, matches]
+ -9223372036854775807 64 -> -9223372036854775807 [valid, matches]
+ -9223372036854775806 0 -> -9223372036854775805 [valid, matches]
+ -9223372036854775806 1 -> -9223372036854775806 [valid, matches]
+ -9223372036854775806 62 -> -4611686018427387902 [valid, matches]
+ -9223372036854775806 63 -> -9223372036854775806 [valid, matches]
+ -9223372036854775806 64 -> -9223372036854775806 [valid, matches]
+ -2147483650 0 -> -2147483649 [valid, matches]
+ -2147483650 1 -> -2147483650 [valid, matches]
+ -2147483650 62 -> -2147483650 [valid, matches]
+ -2147483650 63 -> -2147483650 [valid, matches]
+ -2147483650 64 -> -2147483650 [valid, matches]
+ -2147483649 0 -> -2147483649 [valid, matches]
+ -2147483649 1 -> -2147483649 [valid, matches]
+ -2147483649 62 -> -2147483649 [valid, matches]
+ -2147483649 63 -> -2147483649 [valid, matches]
+ -2147483649 64 -> -2147483649 [valid, matches]
+ -2147483648 0 -> -2147483647 [valid, matches]
+ -2147483648 1 -> -2147483646 [valid, matches]
+ -2147483648 62 -> -2147483648 [valid, matches]
+ -2147483648 63 -> -2147483648 [valid, matches]
+ -2147483648 64 -> -2147483648 [valid, matches]
+ -2147483647 0 -> -2147483647 [valid, matches]
+ -2147483647 1 -> -2147483645 [valid, matches]
+ -2147483647 62 -> -2147483647 [valid, matches]
+ -2147483647 63 -> -2147483647 [valid, matches]
+ -2147483647 64 -> -2147483647 [valid, matches]
+ -2147483646 0 -> -2147483645 [valid, matches]
+ -2147483646 1 -> -2147483646 [valid, matches]
+ -2147483646 62 -> -2147483646 [valid, matches]
+ -2147483646 63 -> -2147483646 [valid, matches]
+ -2147483646 64 -> -2147483646 [valid, matches]
+ -2 0 -> -1 [valid, matches]
+ -2 1 -> -2 [valid, matches]
+ -2 62 -> -2 [valid, matches]
+ -2 63 -> -2 [valid, matches]
+ -2 64 -> -2 [valid, matches]
+ -1 0 -> -1 [valid, matches]
+ -1 1 -> -1 [valid, matches]
+ -1 62 -> -1 [valid, matches]
+ -1 63 -> -1 [valid, matches]
+ -1 64 -> -1 [valid, matches]
+ 0 0 -> 1 [valid, matches]
+ 0 1 -> 2 [valid, matches]
+ 0 62 -> 4611686018427387904 [valid, matches]
+ 0 63 -> 9223372036854775808 [valid, matches]
+ 0 64 -> 18446744073709551616 [valid, matches]
+ 1 0 -> 1 [valid, matches]
+ 1 1 -> 3 [valid, matches]
+ 1 62 -> 4611686018427387905 [valid, matches]
+ 1 63 -> 9223372036854775809 [valid, matches]
+ 1 64 -> 18446744073709551617 [valid, matches]
+ 2 0 -> 3 [valid, matches]
+ 2 1 -> 2 [valid, matches]
+ 2 62 -> 4611686018427387906 [valid, matches]
+ 2 63 -> 9223372036854775810 [valid, matches]
+ 2 64 -> 18446744073709551618 [valid, matches]
+ 2147483645 0 -> 2147483645 [valid, matches]
+ 2147483645 1 -> 2147483647 [valid, matches]
+ 2147483645 62 -> 4611686020574871549 [valid, matches]
+ 2147483645 63 -> 9223372039002259453 [valid, matches]
+ 2147483645 64 -> 18446744075857035261 [valid, matches]
+ 2147483646 0 -> 2147483647 [valid, matches]
+ 2147483646 1 -> 2147483646 [valid, matches]
+ 2147483646 62 -> 4611686020574871550 [valid, matches]
+ 2147483646 63 -> 9223372039002259454 [valid, matches]
+ 2147483646 64 -> 18446744075857035262 [valid, matches]
+ 2147483647 0 -> 2147483647 [valid, matches]
+ 2147483647 1 -> 2147483647 [valid, matches]
+ 2147483647 62 -> 4611686020574871551 [valid, matches]
+ 2147483647 63 -> 9223372039002259455 [valid, matches]
+ 2147483647 64 -> 18446744075857035263 [valid, matches]
+ 2147483648 0 -> 2147483649 [valid, matches]
+ 2147483648 1 -> 2147483650 [valid, matches]
+ 2147483648 62 -> 4611686020574871552 [valid, matches]
+ 2147483648 63 -> 9223372039002259456 [valid, matches]
+ 2147483648 64 -> 18446744075857035264 [valid, matches]
+ 2147483649 0 -> 2147483649 [valid, matches]
+ 2147483649 1 -> 2147483651 [valid, matches]
+ 2147483649 62 -> 4611686020574871553 [valid, matches]
+ 2147483649 63 -> 9223372039002259457 [valid, matches]
+ 2147483649 64 -> 18446744075857035265 [valid, matches]
+ 9223372036854775805 0 -> 9223372036854775805 [valid, matches]
+ 9223372036854775805 1 -> 9223372036854775807 [valid, matches]
+ 9223372036854775805 62 -> 9223372036854775805 [valid, matches]
+ 9223372036854775805 63 -> 18446744073709551613 [valid, matches]
+ 9223372036854775805 64 -> 27670116110564327421 [valid, matches]
+ 9223372036854775806 0 -> 9223372036854775807 [valid, matches]
+ 9223372036854775806 1 -> 9223372036854775806 [valid, matches]
+ 9223372036854775806 62 -> 9223372036854775806 [valid, matches]
+ 9223372036854775806 63 -> 18446744073709551614 [valid, matches]
+ 9223372036854775806 64 -> 27670116110564327422 [valid, matches]
+ 9223372036854775807 0 -> 9223372036854775807 [valid, matches]
+ 9223372036854775807 1 -> 9223372036854775807 [valid, matches]
+ 9223372036854775807 62 -> 9223372036854775807 [valid, matches]
+ 9223372036854775807 63 -> 18446744073709551615 [valid, matches]
+ 9223372036854775807 64 -> 27670116110564327423 [valid, matches]
+ 9223372036854775808 0 -> 9223372036854775809 [valid, matches]
+ 9223372036854775808 1 -> 9223372036854775810 [valid, matches]
+ 9223372036854775808 62 -> 13835058055282163712 [valid, matches]
+ 9223372036854775808 63 -> 9223372036854775808 [valid, matches]
+ 9223372036854775808 64 -> 27670116110564327424 [valid, matches]
+ 9223372036854775809 0 -> 9223372036854775809 [valid, matches]
+ 9223372036854775809 1 -> 9223372036854775811 [valid, matches]
+ 9223372036854775809 62 -> 13835058055282163713 [valid, matches]
+ 9223372036854775809 63 -> 9223372036854775809 [valid, matches]
+ 9223372036854775809 64 -> 27670116110564327425 [valid, matches]
+
+clearBit
+ -9223372036854775810 0 -> -9223372036854775810 [valid, matches]
+ -9223372036854775810 1 -> -9223372036854775812 [valid, matches]
+ -9223372036854775810 62 -> -13835058055282163714 [valid, matches]
+ -9223372036854775810 63 -> -9223372036854775810 [valid, matches]
+ -9223372036854775810 64 -> -27670116110564327426 [valid, matches]
+ -9223372036854775809 0 -> -9223372036854775810 [valid, matches]
+ -9223372036854775809 1 -> -9223372036854775811 [valid, matches]
+ -9223372036854775809 62 -> -13835058055282163713 [valid, matches]
+ -9223372036854775809 63 -> -9223372036854775809 [valid, matches]
+ -9223372036854775809 64 -> -27670116110564327425 [valid, matches]
+ -9223372036854775808 0 -> -9223372036854775808 [valid, matches]
+ -9223372036854775808 1 -> -9223372036854775808 [valid, matches]
+ -9223372036854775808 62 -> -9223372036854775808 [valid, matches]
+ -9223372036854775808 63 -> -18446744073709551616 [valid, matches]
+ -9223372036854775808 64 -> -27670116110564327424 [valid, matches]
+ -9223372036854775807 0 -> -9223372036854775808 [valid, matches]
+ -9223372036854775807 1 -> -9223372036854775807 [valid, matches]
+ -9223372036854775807 62 -> -9223372036854775807 [valid, matches]
+ -9223372036854775807 63 -> -18446744073709551615 [valid, matches]
+ -9223372036854775807 64 -> -27670116110564327423 [valid, matches]
+ -9223372036854775806 0 -> -9223372036854775806 [valid, matches]
+ -9223372036854775806 1 -> -9223372036854775808 [valid, matches]
+ -9223372036854775806 62 -> -9223372036854775806 [valid, matches]
+ -9223372036854775806 63 -> -18446744073709551614 [valid, matches]
+ -9223372036854775806 64 -> -27670116110564327422 [valid, matches]
+ -2147483650 0 -> -2147483650 [valid, matches]
+ -2147483650 1 -> -2147483652 [valid, matches]
+ -2147483650 62 -> -4611686020574871554 [valid, matches]
+ -2147483650 63 -> -9223372039002259458 [valid, matches]
+ -2147483650 64 -> -18446744075857035266 [valid, matches]
+ -2147483649 0 -> -2147483650 [valid, matches]
+ -2147483649 1 -> -2147483651 [valid, matches]
+ -2147483649 62 -> -4611686020574871553 [valid, matches]
+ -2147483649 63 -> -9223372039002259457 [valid, matches]
+ -2147483649 64 -> -18446744075857035265 [valid, matches]
+ -2147483648 0 -> -2147483648 [valid, matches]
+ -2147483648 1 -> -2147483648 [valid, matches]
+ -2147483648 62 -> -4611686020574871552 [valid, matches]
+ -2147483648 63 -> -9223372039002259456 [valid, matches]
+ -2147483648 64 -> -18446744075857035264 [valid, matches]
+ -2147483647 0 -> -2147483648 [valid, matches]
+ -2147483647 1 -> -2147483647 [valid, matches]
+ -2147483647 62 -> -4611686020574871551 [valid, matches]
+ -2147483647 63 -> -9223372039002259455 [valid, matches]
+ -2147483647 64 -> -18446744075857035263 [valid, matches]
+ -2147483646 0 -> -2147483646 [valid, matches]
+ -2147483646 1 -> -2147483648 [valid, matches]
+ -2147483646 62 -> -4611686020574871550 [valid, matches]
+ -2147483646 63 -> -9223372039002259454 [valid, matches]
+ -2147483646 64 -> -18446744075857035262 [valid, matches]
+ -2 0 -> -2 [valid, matches]
+ -2 1 -> -4 [valid, matches]
+ -2 62 -> -4611686018427387906 [valid, matches]
+ -2 63 -> -9223372036854775810 [valid, matches]
+ -2 64 -> -18446744073709551618 [valid, matches]
+ -1 0 -> -2 [valid, matches]
+ -1 1 -> -3 [valid, matches]
+ -1 62 -> -4611686018427387905 [valid, matches]
+ -1 63 -> -9223372036854775809 [valid, matches]
+ -1 64 -> -18446744073709551617 [valid, matches]
+ 0 0 -> 0 [valid, matches]
+ 0 1 -> 0 [valid, matches]
+ 0 62 -> 0 [valid, matches]
+ 0 63 -> 0 [valid, matches]
+ 0 64 -> 0 [valid, matches]
+ 1 0 -> 0 [valid, matches]
+ 1 1 -> 1 [valid, matches]
+ 1 62 -> 1 [valid, matches]
+ 1 63 -> 1 [valid, matches]
+ 1 64 -> 1 [valid, matches]
+ 2 0 -> 2 [valid, matches]
+ 2 1 -> 0 [valid, matches]
+ 2 62 -> 2 [valid, matches]
+ 2 63 -> 2 [valid, matches]
+ 2 64 -> 2 [valid, matches]
+ 2147483645 0 -> 2147483644 [valid, matches]
+ 2147483645 1 -> 2147483645 [valid, matches]
+ 2147483645 62 -> 2147483645 [valid, matches]
+ 2147483645 63 -> 2147483645 [valid, matches]
+ 2147483645 64 -> 2147483645 [valid, matches]
+ 2147483646 0 -> 2147483646 [valid, matches]
+ 2147483646 1 -> 2147483644 [valid, matches]
+ 2147483646 62 -> 2147483646 [valid, matches]
+ 2147483646 63 -> 2147483646 [valid, matches]
+ 2147483646 64 -> 2147483646 [valid, matches]
+ 2147483647 0 -> 2147483646 [valid, matches]
+ 2147483647 1 -> 2147483645 [valid, matches]
+ 2147483647 62 -> 2147483647 [valid, matches]
+ 2147483647 63 -> 2147483647 [valid, matches]
+ 2147483647 64 -> 2147483647 [valid, matches]
+ 2147483648 0 -> 2147483648 [valid, matches]
+ 2147483648 1 -> 2147483648 [valid, matches]
+ 2147483648 62 -> 2147483648 [valid, matches]
+ 2147483648 63 -> 2147483648 [valid, matches]
+ 2147483648 64 -> 2147483648 [valid, matches]
+ 2147483649 0 -> 2147483648 [valid, matches]
+ 2147483649 1 -> 2147483649 [valid, matches]
+ 2147483649 62 -> 2147483649 [valid, matches]
+ 2147483649 63 -> 2147483649 [valid, matches]
+ 2147483649 64 -> 2147483649 [valid, matches]
+ 9223372036854775805 0 -> 9223372036854775804 [valid, matches]
+ 9223372036854775805 1 -> 9223372036854775805 [valid, matches]
+ 9223372036854775805 62 -> 4611686018427387901 [valid, matches]
+ 9223372036854775805 63 -> 9223372036854775805 [valid, matches]
+ 9223372036854775805 64 -> 9223372036854775805 [valid, matches]
+ 9223372036854775806 0 -> 9223372036854775806 [valid, matches]
+ 9223372036854775806 1 -> 9223372036854775804 [valid, matches]
+ 9223372036854775806 62 -> 4611686018427387902 [valid, matches]
+ 9223372036854775806 63 -> 9223372036854775806 [valid, matches]
+ 9223372036854775806 64 -> 9223372036854775806 [valid, matches]
+ 9223372036854775807 0 -> 9223372036854775806 [valid, matches]
+ 9223372036854775807 1 -> 9223372036854775805 [valid, matches]
+ 9223372036854775807 62 -> 4611686018427387903 [valid, matches]
+ 9223372036854775807 63 -> 9223372036854775807 [valid, matches]
+ 9223372036854775807 64 -> 9223372036854775807 [valid, matches]
+ 9223372036854775808 0 -> 9223372036854775808 [valid, matches]
+ 9223372036854775808 1 -> 9223372036854775808 [valid, matches]
+ 9223372036854775808 62 -> 9223372036854775808 [valid, matches]
+ 9223372036854775808 63 -> 0 [valid, matches]
+ 9223372036854775808 64 -> 9223372036854775808 [valid, matches]
+ 9223372036854775809 0 -> 9223372036854775808 [valid, matches]
+ 9223372036854775809 1 -> 9223372036854775809 [valid, matches]
+ 9223372036854775809 62 -> 9223372036854775809 [valid, matches]
+ 9223372036854775809 63 -> 1 [valid, matches]
+ 9223372036854775809 64 -> 9223372036854775809 [valid, matches]
+
+complementBit
+ -9223372036854775810 0 -> -9223372036854775809 [valid, matches]
+ -9223372036854775810 1 -> -9223372036854775812 [valid, matches]
+ -9223372036854775810 62 -> -13835058055282163714 [valid, matches]
+ -9223372036854775810 63 -> -2 [valid, matches]
+ -9223372036854775810 64 -> -27670116110564327426 [valid, matches]
+ -9223372036854775809 0 -> -9223372036854775810 [valid, matches]
+ -9223372036854775809 1 -> -9223372036854775811 [valid, matches]
+ -9223372036854775809 62 -> -13835058055282163713 [valid, matches]
+ -9223372036854775809 63 -> -1 [valid, matches]
+ -9223372036854775809 64 -> -27670116110564327425 [valid, matches]
+ -9223372036854775808 0 -> -9223372036854775807 [valid, matches]
+ -9223372036854775808 1 -> -9223372036854775806 [valid, matches]
+ -9223372036854775808 62 -> -4611686018427387904 [valid, matches]
+ -9223372036854775808 63 -> -18446744073709551616 [valid, matches]
+ -9223372036854775808 64 -> -27670116110564327424 [valid, matches]
+ -9223372036854775807 0 -> -9223372036854775808 [valid, matches]
+ -9223372036854775807 1 -> -9223372036854775805 [valid, matches]
+ -9223372036854775807 62 -> -4611686018427387903 [valid, matches]
+ -9223372036854775807 63 -> -18446744073709551615 [valid, matches]
+ -9223372036854775807 64 -> -27670116110564327423 [valid, matches]
+ -9223372036854775806 0 -> -9223372036854775805 [valid, matches]
+ -9223372036854775806 1 -> -9223372036854775808 [valid, matches]
+ -9223372036854775806 62 -> -4611686018427387902 [valid, matches]
+ -9223372036854775806 63 -> -18446744073709551614 [valid, matches]
+ -9223372036854775806 64 -> -27670116110564327422 [valid, matches]
+ -2147483650 0 -> -2147483649 [valid, matches]
+ -2147483650 1 -> -2147483652 [valid, matches]
+ -2147483650 62 -> -4611686020574871554 [valid, matches]
+ -2147483650 63 -> -9223372039002259458 [valid, matches]
+ -2147483650 64 -> -18446744075857035266 [valid, matches]
+ -2147483649 0 -> -2147483650 [valid, matches]
+ -2147483649 1 -> -2147483651 [valid, matches]
+ -2147483649 62 -> -4611686020574871553 [valid, matches]
+ -2147483649 63 -> -9223372039002259457 [valid, matches]
+ -2147483649 64 -> -18446744075857035265 [valid, matches]
+ -2147483648 0 -> -2147483647 [valid, matches]
+ -2147483648 1 -> -2147483646 [valid, matches]
+ -2147483648 62 -> -4611686020574871552 [valid, matches]
+ -2147483648 63 -> -9223372039002259456 [valid, matches]
+ -2147483648 64 -> -18446744075857035264 [valid, matches]
+ -2147483647 0 -> -2147483648 [valid, matches]
+ -2147483647 1 -> -2147483645 [valid, matches]
+ -2147483647 62 -> -4611686020574871551 [valid, matches]
+ -2147483647 63 -> -9223372039002259455 [valid, matches]
+ -2147483647 64 -> -18446744075857035263 [valid, matches]
+ -2147483646 0 -> -2147483645 [valid, matches]
+ -2147483646 1 -> -2147483648 [valid, matches]
+ -2147483646 62 -> -4611686020574871550 [valid, matches]
+ -2147483646 63 -> -9223372039002259454 [valid, matches]
+ -2147483646 64 -> -18446744075857035262 [valid, matches]
+ -2 0 -> -1 [valid, matches]
+ -2 1 -> -4 [valid, matches]
+ -2 62 -> -4611686018427387906 [valid, matches]
+ -2 63 -> -9223372036854775810 [valid, matches]
+ -2 64 -> -18446744073709551618 [valid, matches]
+ -1 0 -> -2 [valid, matches]
+ -1 1 -> -3 [valid, matches]
+ -1 62 -> -4611686018427387905 [valid, matches]
+ -1 63 -> -9223372036854775809 [valid, matches]
+ -1 64 -> -18446744073709551617 [valid, matches]
+ 0 0 -> 1 [valid, matches]
+ 0 1 -> 2 [valid, matches]
+ 0 62 -> 4611686018427387904 [valid, matches]
+ 0 63 -> 9223372036854775808 [valid, matches]
+ 0 64 -> 18446744073709551616 [valid, matches]
+ 1 0 -> 0 [valid, matches]
+ 1 1 -> 3 [valid, matches]
+ 1 62 -> 4611686018427387905 [valid, matches]
+ 1 63 -> 9223372036854775809 [valid, matches]
+ 1 64 -> 18446744073709551617 [valid, matches]
+ 2 0 -> 3 [valid, matches]
+ 2 1 -> 0 [valid, matches]
+ 2 62 -> 4611686018427387906 [valid, matches]
+ 2 63 -> 9223372036854775810 [valid, matches]
+ 2 64 -> 18446744073709551618 [valid, matches]
+ 2147483645 0 -> 2147483644 [valid, matches]
+ 2147483645 1 -> 2147483647 [valid, matches]
+ 2147483645 62 -> 4611686020574871549 [valid, matches]
+ 2147483645 63 -> 9223372039002259453 [valid, matches]
+ 2147483645 64 -> 18446744075857035261 [valid, matches]
+ 2147483646 0 -> 2147483647 [valid, matches]
+ 2147483646 1 -> 2147483644 [valid, matches]
+ 2147483646 62 -> 4611686020574871550 [valid, matches]
+ 2147483646 63 -> 9223372039002259454 [valid, matches]
+ 2147483646 64 -> 18446744075857035262 [valid, matches]
+ 2147483647 0 -> 2147483646 [valid, matches]
+ 2147483647 1 -> 2147483645 [valid, matches]
+ 2147483647 62 -> 4611686020574871551 [valid, matches]
+ 2147483647 63 -> 9223372039002259455 [valid, matches]
+ 2147483647 64 -> 18446744075857035263 [valid, matches]
+ 2147483648 0 -> 2147483649 [valid, matches]
+ 2147483648 1 -> 2147483650 [valid, matches]
+ 2147483648 62 -> 4611686020574871552 [valid, matches]
+ 2147483648 63 -> 9223372039002259456 [valid, matches]
+ 2147483648 64 -> 18446744075857035264 [valid, matches]
+ 2147483649 0 -> 2147483648 [valid, matches]
+ 2147483649 1 -> 2147483651 [valid, matches]
+ 2147483649 62 -> 4611686020574871553 [valid, matches]
+ 2147483649 63 -> 9223372039002259457 [valid, matches]
+ 2147483649 64 -> 18446744075857035265 [valid, matches]
+ 9223372036854775805 0 -> 9223372036854775804 [valid, matches]
+ 9223372036854775805 1 -> 9223372036854775807 [valid, matches]
+ 9223372036854775805 62 -> 4611686018427387901 [valid, matches]
+ 9223372036854775805 63 -> 18446744073709551613 [valid, matches]
+ 9223372036854775805 64 -> 27670116110564327421 [valid, matches]
+ 9223372036854775806 0 -> 9223372036854775807 [valid, matches]
+ 9223372036854775806 1 -> 9223372036854775804 [valid, matches]
+ 9223372036854775806 62 -> 4611686018427387902 [valid, matches]
+ 9223372036854775806 63 -> 18446744073709551614 [valid, matches]
+ 9223372036854775806 64 -> 27670116110564327422 [valid, matches]
+ 9223372036854775807 0 -> 9223372036854775806 [valid, matches]
+ 9223372036854775807 1 -> 9223372036854775805 [valid, matches]
+ 9223372036854775807 62 -> 4611686018427387903 [valid, matches]
+ 9223372036854775807 63 -> 18446744073709551615 [valid, matches]
+ 9223372036854775807 64 -> 27670116110564327423 [valid, matches]
+ 9223372036854775808 0 -> 9223372036854775809 [valid, matches]
+ 9223372036854775808 1 -> 9223372036854775810 [valid, matches]
+ 9223372036854775808 62 -> 13835058055282163712 [valid, matches]
+ 9223372036854775808 63 -> 0 [valid, matches]
+ 9223372036854775808 64 -> 27670116110564327424 [valid, matches]
+ 9223372036854775809 0 -> 9223372036854775808 [valid, matches]
+ 9223372036854775809 1 -> 9223372036854775811 [valid, matches]
+ 9223372036854775809 62 -> 13835058055282163713 [valid, matches]
+ 9223372036854775809 63 -> 1 [valid, matches]
+ 9223372036854775809 64 -> 27670116110564327425 [valid, matches]
+
=====================================
testsuite/tests/numeric/should_run/T21176.stdout-ws-32
=====================================
@@ -0,0 +1,381 @@
+setBit
+ -9223372036854775810 0 -> -9223372036854775809 [valid, matches]
+ -9223372036854775810 1 -> -9223372036854775810 [valid, matches]
+ -9223372036854775810 30 -> -9223372036854775810 [valid, matches]
+ -9223372036854775810 31 -> -9223372036854775810 [valid, matches]
+ -9223372036854775810 32 -> -9223372036854775810 [valid, matches]
+ -9223372036854775809 0 -> -9223372036854775809 [valid, matches]
+ -9223372036854775809 1 -> -9223372036854775809 [valid, matches]
+ -9223372036854775809 30 -> -9223372036854775809 [valid, matches]
+ -9223372036854775809 31 -> -9223372036854775809 [valid, matches]
+ -9223372036854775809 32 -> -9223372036854775809 [valid, matches]
+ -9223372036854775808 0 -> -9223372036854775807 [valid, matches]
+ -9223372036854775808 1 -> -9223372036854775806 [valid, matches]
+ -9223372036854775808 30 -> -9223372035781033984 [valid, matches]
+ -9223372036854775808 31 -> -9223372034707292160 [valid, matches]
+ -9223372036854775808 32 -> -9223372032559808512 [valid, matches]
+ -9223372036854775807 0 -> -9223372036854775807 [valid, matches]
+ -9223372036854775807 1 -> -9223372036854775805 [valid, matches]
+ -9223372036854775807 30 -> -9223372035781033983 [valid, matches]
+ -9223372036854775807 31 -> -9223372034707292159 [valid, matches]
+ -9223372036854775807 32 -> -9223372032559808511 [valid, matches]
+ -9223372036854775806 0 -> -9223372036854775805 [valid, matches]
+ -9223372036854775806 1 -> -9223372036854775806 [valid, matches]
+ -9223372036854775806 30 -> -9223372035781033982 [valid, matches]
+ -9223372036854775806 31 -> -9223372034707292158 [valid, matches]
+ -9223372036854775806 32 -> -9223372032559808510 [valid, matches]
+ -2147483650 0 -> -2147483649 [valid, matches]
+ -2147483650 1 -> -2147483650 [valid, matches]
+ -2147483650 30 -> -2147483650 [valid, matches]
+ -2147483650 31 -> -2 [valid, matches]
+ -2147483650 32 -> -2147483650 [valid, matches]
+ -2147483649 0 -> -2147483649 [valid, matches]
+ -2147483649 1 -> -2147483649 [valid, matches]
+ -2147483649 30 -> -2147483649 [valid, matches]
+ -2147483649 31 -> -1 [valid, matches]
+ -2147483649 32 -> -2147483649 [valid, matches]
+ -2147483648 0 -> -2147483647 [valid, matches]
+ -2147483648 1 -> -2147483646 [valid, matches]
+ -2147483648 30 -> -1073741824 [valid, matches]
+ -2147483648 31 -> -2147483648 [valid, matches]
+ -2147483648 32 -> -2147483648 [valid, matches]
+ -2147483647 0 -> -2147483647 [valid, matches]
+ -2147483647 1 -> -2147483645 [valid, matches]
+ -2147483647 30 -> -1073741823 [valid, matches]
+ -2147483647 31 -> -2147483647 [valid, matches]
+ -2147483647 32 -> -2147483647 [valid, matches]
+ -2147483646 0 -> -2147483645 [valid, matches]
+ -2147483646 1 -> -2147483646 [valid, matches]
+ -2147483646 30 -> -1073741822 [valid, matches]
+ -2147483646 31 -> -2147483646 [valid, matches]
+ -2147483646 32 -> -2147483646 [valid, matches]
+ -2 0 -> -1 [valid, matches]
+ -2 1 -> -2 [valid, matches]
+ -2 30 -> -2 [valid, matches]
+ -2 31 -> -2 [valid, matches]
+ -2 32 -> -2 [valid, matches]
+ -1 0 -> -1 [valid, matches]
+ -1 1 -> -1 [valid, matches]
+ -1 30 -> -1 [valid, matches]
+ -1 31 -> -1 [valid, matches]
+ -1 32 -> -1 [valid, matches]
+ 0 0 -> 1 [valid, matches]
+ 0 1 -> 2 [valid, matches]
+ 0 30 -> 1073741824 [valid, matches]
+ 0 31 -> 2147483648 [valid, matches]
+ 0 32 -> 4294967296 [valid, matches]
+ 1 0 -> 1 [valid, matches]
+ 1 1 -> 3 [valid, matches]
+ 1 30 -> 1073741825 [valid, matches]
+ 1 31 -> 2147483649 [valid, matches]
+ 1 32 -> 4294967297 [valid, matches]
+ 2 0 -> 3 [valid, matches]
+ 2 1 -> 2 [valid, matches]
+ 2 30 -> 1073741826 [valid, matches]
+ 2 31 -> 2147483650 [valid, matches]
+ 2 32 -> 4294967298 [valid, matches]
+ 2147483645 0 -> 2147483645 [valid, matches]
+ 2147483645 1 -> 2147483647 [valid, matches]
+ 2147483645 30 -> 2147483645 [valid, matches]
+ 2147483645 31 -> 4294967293 [valid, matches]
+ 2147483645 32 -> 6442450941 [valid, matches]
+ 2147483646 0 -> 2147483647 [valid, matches]
+ 2147483646 1 -> 2147483646 [valid, matches]
+ 2147483646 30 -> 2147483646 [valid, matches]
+ 2147483646 31 -> 4294967294 [valid, matches]
+ 2147483646 32 -> 6442450942 [valid, matches]
+ 2147483647 0 -> 2147483647 [valid, matches]
+ 2147483647 1 -> 2147483647 [valid, matches]
+ 2147483647 30 -> 2147483647 [valid, matches]
+ 2147483647 31 -> 4294967295 [valid, matches]
+ 2147483647 32 -> 6442450943 [valid, matches]
+ 2147483648 0 -> 2147483649 [valid, matches]
+ 2147483648 1 -> 2147483650 [valid, matches]
+ 2147483648 30 -> 3221225472 [valid, matches]
+ 2147483648 31 -> 2147483648 [valid, matches]
+ 2147483648 32 -> 6442450944 [valid, matches]
+ 2147483649 0 -> 2147483649 [valid, matches]
+ 2147483649 1 -> 2147483651 [valid, matches]
+ 2147483649 30 -> 3221225473 [valid, matches]
+ 2147483649 31 -> 2147483649 [valid, matches]
+ 2147483649 32 -> 6442450945 [valid, matches]
+ 9223372036854775805 0 -> 9223372036854775805 [valid, matches]
+ 9223372036854775805 1 -> 9223372036854775807 [valid, matches]
+ 9223372036854775805 30 -> 9223372036854775805 [valid, matches]
+ 9223372036854775805 31 -> 9223372036854775805 [valid, matches]
+ 9223372036854775805 32 -> 9223372036854775805 [valid, matches]
+ 9223372036854775806 0 -> 9223372036854775807 [valid, matches]
+ 9223372036854775806 1 -> 9223372036854775806 [valid, matches]
+ 9223372036854775806 30 -> 9223372036854775806 [valid, matches]
+ 9223372036854775806 31 -> 9223372036854775806 [valid, matches]
+ 9223372036854775806 32 -> 9223372036854775806 [valid, matches]
+ 9223372036854775807 0 -> 9223372036854775807 [valid, matches]
+ 9223372036854775807 1 -> 9223372036854775807 [valid, matches]
+ 9223372036854775807 30 -> 9223372036854775807 [valid, matches]
+ 9223372036854775807 31 -> 9223372036854775807 [valid, matches]
+ 9223372036854775807 32 -> 9223372036854775807 [valid, matches]
+ 9223372036854775808 0 -> 9223372036854775809 [valid, matches]
+ 9223372036854775808 1 -> 9223372036854775810 [valid, matches]
+ 9223372036854775808 30 -> 9223372037928517632 [valid, matches]
+ 9223372036854775808 31 -> 9223372039002259456 [valid, matches]
+ 9223372036854775808 32 -> 9223372041149743104 [valid, matches]
+ 9223372036854775809 0 -> 9223372036854775809 [valid, matches]
+ 9223372036854775809 1 -> 9223372036854775811 [valid, matches]
+ 9223372036854775809 30 -> 9223372037928517633 [valid, matches]
+ 9223372036854775809 31 -> 9223372039002259457 [valid, matches]
+ 9223372036854775809 32 -> 9223372041149743105 [valid, matches]
+
+clearBit
+ -9223372036854775810 0 -> -9223372036854775810 [valid, matches]
+ -9223372036854775810 1 -> -9223372036854775812 [valid, matches]
+ -9223372036854775810 30 -> -9223372037928517634 [valid, matches]
+ -9223372036854775810 31 -> -9223372039002259458 [valid, matches]
+ -9223372036854775810 32 -> -9223372041149743106 [valid, matches]
+ -9223372036854775809 0 -> -9223372036854775810 [valid, matches]
+ -9223372036854775809 1 -> -9223372036854775811 [valid, matches]
+ -9223372036854775809 30 -> -9223372037928517633 [valid, matches]
+ -9223372036854775809 31 -> -9223372039002259457 [valid, matches]
+ -9223372036854775809 32 -> -9223372041149743105 [valid, matches]
+ -9223372036854775808 0 -> -9223372036854775808 [valid, matches]
+ -9223372036854775808 1 -> -9223372036854775808 [valid, matches]
+ -9223372036854775808 30 -> -9223372036854775808 [valid, matches]
+ -9223372036854775808 31 -> -9223372036854775808 [valid, matches]
+ -9223372036854775808 32 -> -9223372036854775808 [valid, matches]
+ -9223372036854775807 0 -> -9223372036854775808 [valid, matches]
+ -9223372036854775807 1 -> -9223372036854775807 [valid, matches]
+ -9223372036854775807 30 -> -9223372036854775807 [valid, matches]
+ -9223372036854775807 31 -> -9223372036854775807 [valid, matches]
+ -9223372036854775807 32 -> -9223372036854775807 [valid, matches]
+ -9223372036854775806 0 -> -9223372036854775806 [valid, matches]
+ -9223372036854775806 1 -> -9223372036854775808 [valid, matches]
+ -9223372036854775806 30 -> -9223372036854775806 [valid, matches]
+ -9223372036854775806 31 -> -9223372036854775806 [valid, matches]
+ -9223372036854775806 32 -> -9223372036854775806 [valid, matches]
+ -2147483650 0 -> -2147483650 [valid, matches]
+ -2147483650 1 -> -2147483652 [valid, matches]
+ -2147483650 30 -> -3221225474 [valid, matches]
+ -2147483650 31 -> -2147483650 [valid, matches]
+ -2147483650 32 -> -6442450946 [valid, matches]
+ -2147483649 0 -> -2147483650 [valid, matches]
+ -2147483649 1 -> -2147483651 [valid, matches]
+ -2147483649 30 -> -3221225473 [valid, matches]
+ -2147483649 31 -> -2147483649 [valid, matches]
+ -2147483649 32 -> -6442450945 [valid, matches]
+ -2147483648 0 -> -2147483648 [valid, matches]
+ -2147483648 1 -> -2147483648 [valid, matches]
+ -2147483648 30 -> -2147483648 [valid, matches]
+ -2147483648 31 -> -4294967296 [valid, matches]
+ -2147483648 32 -> -6442450944 [valid, matches]
+ -2147483647 0 -> -2147483648 [valid, matches]
+ -2147483647 1 -> -2147483647 [valid, matches]
+ -2147483647 30 -> -2147483647 [valid, matches]
+ -2147483647 31 -> -4294967295 [valid, matches]
+ -2147483647 32 -> -6442450943 [valid, matches]
+ -2147483646 0 -> -2147483646 [valid, matches]
+ -2147483646 1 -> -2147483648 [valid, matches]
+ -2147483646 30 -> -2147483646 [valid, matches]
+ -2147483646 31 -> -4294967294 [valid, matches]
+ -2147483646 32 -> -6442450942 [valid, matches]
+ -2 0 -> -2 [valid, matches]
+ -2 1 -> -4 [valid, matches]
+ -2 30 -> -1073741826 [valid, matches]
+ -2 31 -> -2147483650 [valid, matches]
+ -2 32 -> -4294967298 [valid, matches]
+ -1 0 -> -2 [valid, matches]
+ -1 1 -> -3 [valid, matches]
+ -1 30 -> -1073741825 [valid, matches]
+ -1 31 -> -2147483649 [valid, matches]
+ -1 32 -> -4294967297 [valid, matches]
+ 0 0 -> 0 [valid, matches]
+ 0 1 -> 0 [valid, matches]
+ 0 30 -> 0 [valid, matches]
+ 0 31 -> 0 [valid, matches]
+ 0 32 -> 0 [valid, matches]
+ 1 0 -> 0 [valid, matches]
+ 1 1 -> 1 [valid, matches]
+ 1 30 -> 1 [valid, matches]
+ 1 31 -> 1 [valid, matches]
+ 1 32 -> 1 [valid, matches]
+ 2 0 -> 2 [valid, matches]
+ 2 1 -> 0 [valid, matches]
+ 2 30 -> 2 [valid, matches]
+ 2 31 -> 2 [valid, matches]
+ 2 32 -> 2 [valid, matches]
+ 2147483645 0 -> 2147483644 [valid, matches]
+ 2147483645 1 -> 2147483645 [valid, matches]
+ 2147483645 30 -> 1073741821 [valid, matches]
+ 2147483645 31 -> 2147483645 [valid, matches]
+ 2147483645 32 -> 2147483645 [valid, matches]
+ 2147483646 0 -> 2147483646 [valid, matches]
+ 2147483646 1 -> 2147483644 [valid, matches]
+ 2147483646 30 -> 1073741822 [valid, matches]
+ 2147483646 31 -> 2147483646 [valid, matches]
+ 2147483646 32 -> 2147483646 [valid, matches]
+ 2147483647 0 -> 2147483646 [valid, matches]
+ 2147483647 1 -> 2147483645 [valid, matches]
+ 2147483647 30 -> 1073741823 [valid, matches]
+ 2147483647 31 -> 2147483647 [valid, matches]
+ 2147483647 32 -> 2147483647 [valid, matches]
+ 2147483648 0 -> 2147483648 [valid, matches]
+ 2147483648 1 -> 2147483648 [valid, matches]
+ 2147483648 30 -> 2147483648 [valid, matches]
+ 2147483648 31 -> 0 [valid, matches]
+ 2147483648 32 -> 2147483648 [valid, matches]
+ 2147483649 0 -> 2147483648 [valid, matches]
+ 2147483649 1 -> 2147483649 [valid, matches]
+ 2147483649 30 -> 2147483649 [valid, matches]
+ 2147483649 31 -> 1 [valid, matches]
+ 2147483649 32 -> 2147483649 [valid, matches]
+ 9223372036854775805 0 -> 9223372036854775804 [valid, matches]
+ 9223372036854775805 1 -> 9223372036854775805 [valid, matches]
+ 9223372036854775805 30 -> 9223372035781033981 [valid, matches]
+ 9223372036854775805 31 -> 9223372034707292157 [valid, matches]
+ 9223372036854775805 32 -> 9223372032559808509 [valid, matches]
+ 9223372036854775806 0 -> 9223372036854775806 [valid, matches]
+ 9223372036854775806 1 -> 9223372036854775804 [valid, matches]
+ 9223372036854775806 30 -> 9223372035781033982 [valid, matches]
+ 9223372036854775806 31 -> 9223372034707292158 [valid, matches]
+ 9223372036854775806 32 -> 9223372032559808510 [valid, matches]
+ 9223372036854775807 0 -> 9223372036854775806 [valid, matches]
+ 9223372036854775807 1 -> 9223372036854775805 [valid, matches]
+ 9223372036854775807 30 -> 9223372035781033983 [valid, matches]
+ 9223372036854775807 31 -> 9223372034707292159 [valid, matches]
+ 9223372036854775807 32 -> 9223372032559808511 [valid, matches]
+ 9223372036854775808 0 -> 9223372036854775808 [valid, matches]
+ 9223372036854775808 1 -> 9223372036854775808 [valid, matches]
+ 9223372036854775808 30 -> 9223372036854775808 [valid, matches]
+ 9223372036854775808 31 -> 9223372036854775808 [valid, matches]
+ 9223372036854775808 32 -> 9223372036854775808 [valid, matches]
+ 9223372036854775809 0 -> 9223372036854775808 [valid, matches]
+ 9223372036854775809 1 -> 9223372036854775809 [valid, matches]
+ 9223372036854775809 30 -> 9223372036854775809 [valid, matches]
+ 9223372036854775809 31 -> 9223372036854775809 [valid, matches]
+ 9223372036854775809 32 -> 9223372036854775809 [valid, matches]
+
+complementBit
+ -9223372036854775810 0 -> -9223372036854775809 [valid, matches]
+ -9223372036854775810 1 -> -9223372036854775812 [valid, matches]
+ -9223372036854775810 30 -> -9223372037928517634 [valid, matches]
+ -9223372036854775810 31 -> -9223372039002259458 [valid, matches]
+ -9223372036854775810 32 -> -9223372041149743106 [valid, matches]
+ -9223372036854775809 0 -> -9223372036854775810 [valid, matches]
+ -9223372036854775809 1 -> -9223372036854775811 [valid, matches]
+ -9223372036854775809 30 -> -9223372037928517633 [valid, matches]
+ -9223372036854775809 31 -> -9223372039002259457 [valid, matches]
+ -9223372036854775809 32 -> -9223372041149743105 [valid, matches]
+ -9223372036854775808 0 -> -9223372036854775807 [valid, matches]
+ -9223372036854775808 1 -> -9223372036854775806 [valid, matches]
+ -9223372036854775808 30 -> -9223372035781033984 [valid, matches]
+ -9223372036854775808 31 -> -9223372034707292160 [valid, matches]
+ -9223372036854775808 32 -> -9223372032559808512 [valid, matches]
+ -9223372036854775807 0 -> -9223372036854775808 [valid, matches]
+ -9223372036854775807 1 -> -9223372036854775805 [valid, matches]
+ -9223372036854775807 30 -> -9223372035781033983 [valid, matches]
+ -9223372036854775807 31 -> -9223372034707292159 [valid, matches]
+ -9223372036854775807 32 -> -9223372032559808511 [valid, matches]
+ -9223372036854775806 0 -> -9223372036854775805 [valid, matches]
+ -9223372036854775806 1 -> -9223372036854775808 [valid, matches]
+ -9223372036854775806 30 -> -9223372035781033982 [valid, matches]
+ -9223372036854775806 31 -> -9223372034707292158 [valid, matches]
+ -9223372036854775806 32 -> -9223372032559808510 [valid, matches]
+ -2147483650 0 -> -2147483649 [valid, matches]
+ -2147483650 1 -> -2147483652 [valid, matches]
+ -2147483650 30 -> -3221225474 [valid, matches]
+ -2147483650 31 -> -2 [valid, matches]
+ -2147483650 32 -> -6442450946 [valid, matches]
+ -2147483649 0 -> -2147483650 [valid, matches]
+ -2147483649 1 -> -2147483651 [valid, matches]
+ -2147483649 30 -> -3221225473 [valid, matches]
+ -2147483649 31 -> -1 [valid, matches]
+ -2147483649 32 -> -6442450945 [valid, matches]
+ -2147483648 0 -> -2147483647 [valid, matches]
+ -2147483648 1 -> -2147483646 [valid, matches]
+ -2147483648 30 -> -1073741824 [valid, matches]
+ -2147483648 31 -> -4294967296 [valid, matches]
+ -2147483648 32 -> -6442450944 [valid, matches]
+ -2147483647 0 -> -2147483648 [valid, matches]
+ -2147483647 1 -> -2147483645 [valid, matches]
+ -2147483647 30 -> -1073741823 [valid, matches]
+ -2147483647 31 -> -4294967295 [valid, matches]
+ -2147483647 32 -> -6442450943 [valid, matches]
+ -2147483646 0 -> -2147483645 [valid, matches]
+ -2147483646 1 -> -2147483648 [valid, matches]
+ -2147483646 30 -> -1073741822 [valid, matches]
+ -2147483646 31 -> -4294967294 [valid, matches]
+ -2147483646 32 -> -6442450942 [valid, matches]
+ -2 0 -> -1 [valid, matches]
+ -2 1 -> -4 [valid, matches]
+ -2 30 -> -1073741826 [valid, matches]
+ -2 31 -> -2147483650 [valid, matches]
+ -2 32 -> -4294967298 [valid, matches]
+ -1 0 -> -2 [valid, matches]
+ -1 1 -> -3 [valid, matches]
+ -1 30 -> -1073741825 [valid, matches]
+ -1 31 -> -2147483649 [valid, matches]
+ -1 32 -> -4294967297 [valid, matches]
+ 0 0 -> 1 [valid, matches]
+ 0 1 -> 2 [valid, matches]
+ 0 30 -> 1073741824 [valid, matches]
+ 0 31 -> 2147483648 [valid, matches]
+ 0 32 -> 4294967296 [valid, matches]
+ 1 0 -> 0 [valid, matches]
+ 1 1 -> 3 [valid, matches]
+ 1 30 -> 1073741825 [valid, matches]
+ 1 31 -> 2147483649 [valid, matches]
+ 1 32 -> 4294967297 [valid, matches]
+ 2 0 -> 3 [valid, matches]
+ 2 1 -> 0 [valid, matches]
+ 2 30 -> 1073741826 [valid, matches]
+ 2 31 -> 2147483650 [valid, matches]
+ 2 32 -> 4294967298 [valid, matches]
+ 2147483645 0 -> 2147483644 [valid, matches]
+ 2147483645 1 -> 2147483647 [valid, matches]
+ 2147483645 30 -> 1073741821 [valid, matches]
+ 2147483645 31 -> 4294967293 [valid, matches]
+ 2147483645 32 -> 6442450941 [valid, matches]
+ 2147483646 0 -> 2147483647 [valid, matches]
+ 2147483646 1 -> 2147483644 [valid, matches]
+ 2147483646 30 -> 1073741822 [valid, matches]
+ 2147483646 31 -> 4294967294 [valid, matches]
+ 2147483646 32 -> 6442450942 [valid, matches]
+ 2147483647 0 -> 2147483646 [valid, matches]
+ 2147483647 1 -> 2147483645 [valid, matches]
+ 2147483647 30 -> 1073741823 [valid, matches]
+ 2147483647 31 -> 4294967295 [valid, matches]
+ 2147483647 32 -> 6442450943 [valid, matches]
+ 2147483648 0 -> 2147483649 [valid, matches]
+ 2147483648 1 -> 2147483650 [valid, matches]
+ 2147483648 30 -> 3221225472 [valid, matches]
+ 2147483648 31 -> 0 [valid, matches]
+ 2147483648 32 -> 6442450944 [valid, matches]
+ 2147483649 0 -> 2147483648 [valid, matches]
+ 2147483649 1 -> 2147483651 [valid, matches]
+ 2147483649 30 -> 3221225473 [valid, matches]
+ 2147483649 31 -> 1 [valid, matches]
+ 2147483649 32 -> 6442450945 [valid, matches]
+ 9223372036854775805 0 -> 9223372036854775804 [valid, matches]
+ 9223372036854775805 1 -> 9223372036854775807 [valid, matches]
+ 9223372036854775805 30 -> 9223372035781033981 [valid, matches]
+ 9223372036854775805 31 -> 9223372034707292157 [valid, matches]
+ 9223372036854775805 32 -> 9223372032559808509 [valid, matches]
+ 9223372036854775806 0 -> 9223372036854775807 [valid, matches]
+ 9223372036854775806 1 -> 9223372036854775804 [valid, matches]
+ 9223372036854775806 30 -> 9223372035781033982 [valid, matches]
+ 9223372036854775806 31 -> 9223372034707292158 [valid, matches]
+ 9223372036854775806 32 -> 9223372032559808510 [valid, matches]
+ 9223372036854775807 0 -> 9223372036854775806 [valid, matches]
+ 9223372036854775807 1 -> 9223372036854775805 [valid, matches]
+ 9223372036854775807 30 -> 9223372035781033983 [valid, matches]
+ 9223372036854775807 31 -> 9223372034707292159 [valid, matches]
+ 9223372036854775807 32 -> 9223372032559808511 [valid, matches]
+ 9223372036854775808 0 -> 9223372036854775809 [valid, matches]
+ 9223372036854775808 1 -> 9223372036854775810 [valid, matches]
+ 9223372036854775808 30 -> 9223372037928517632 [valid, matches]
+ 9223372036854775808 31 -> 9223372039002259456 [valid, matches]
+ 9223372036854775808 32 -> 9223372041149743104 [valid, matches]
+ 9223372036854775809 0 -> 9223372036854775808 [valid, matches]
+ 9223372036854775809 1 -> 9223372036854775811 [valid, matches]
+ 9223372036854775809 30 -> 9223372037928517633 [valid, matches]
+ 9223372036854775809 31 -> 9223372039002259457 [valid, matches]
+ 9223372036854775809 32 -> 9223372041149743105 [valid, matches]
+
=====================================
testsuite/tests/numeric/should_run/all.T
=====================================
@@ -101,3 +101,4 @@ test('T24245', normal, compile_and_run, [''])
test('T25653', normal, compile_and_run, [''])
test('T18619', exit_code(1), compile_and_run, [''])
test('T26230', normal, compile_and_run, [''])
+test('T21176', normal, compile_and_run, [''])
=====================================
testsuite/tests/simplCore/should_compile/T8832.hs
=====================================
@@ -23,3 +23,9 @@ T(w32,Word32)
T(w64,Word64)
T(z,Integer)
+
+zset :: Integer
+zset = setBit (bit 0) 0
+
+zcompl :: Integer
+zcompl = complementBit (bit 0) 0
=====================================
testsuite/tests/simplCore/should_compile/T8832.stdout
=====================================
@@ -8,4 +8,6 @@ w8 = GHC.Internal.Word.W8# 0#Word8
w16 = GHC.Internal.Word.W16# 0#Word16
w32 = GHC.Internal.Word.W32# 0#Word32
w64 = GHC.Internal.Word.W64# 0#Word64
-z = GHC.Internal.Bignum.Integer.IS 0#
+zcompl = GHC.Internal.Bignum.Integer.IS 0#
+zset = GHC.Internal.Bignum.Integer.IS 1#
+z = zcompl
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f235d18328567a1f4ec5eebbbab4575…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f235d18328567a1f4ec5eebbbab4575…
You're receiving this email because of your account on gitlab.haskell.org.
1
0