Teo Camarasu pushed to branch wip/T26848 at Glasgow Haskell Compiler / GHC
Commits:
-
770ccc9b
by Teo Camarasu at 2026-01-30T13:42:19+00:00
7 changed files:
- libraries/base/src/Data/Ix.hs
- libraries/ghc-internal/ghc-internal.cabal.in
- − libraries/ghc-internal/src/GHC/Internal/Data/Ix.hs
- testsuite/tests/interface-stability/base-exports.stdout
- testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs
- testsuite/tests/interface-stability/base-exports.stdout-mingw32
- testsuite/tests/interface-stability/base-exports.stdout-ws-32
Changes:
| 1 | -{-# LANGUAGE Safe #-}
|
|
| 1 | +{-# LANGUAGE Trustworthy #-}
|
|
| 2 | 2 | |
| 3 | 3 | -- |
|
| 4 | 4 | --
|
| ... | ... | @@ -42,4 +42,4 @@ module Data.Ix |
| 42 | 42 | -- <https://www.haskell.org/onlinereport/haskell2010/haskellch19.html>.
|
| 43 | 43 | ) where
|
| 44 | 44 | |
| 45 | -import GHC.Internal.Data.Ix |
|
| 45 | +import GHC.Internal.Ix |
| ... | ... | @@ -153,7 +153,6 @@ Library |
| 153 | 153 | GHC.Internal.Data.Functor.Identity
|
| 154 | 154 | GHC.Internal.Data.Functor.Utils
|
| 155 | 155 | GHC.Internal.Data.IORef
|
| 156 | - GHC.Internal.Data.Ix
|
|
| 157 | 156 | GHC.Internal.Data.List
|
| 158 | 157 | GHC.Internal.Data.List.NonEmpty
|
| 159 | 158 | GHC.Internal.Data.Maybe
|
| 1 | -{-# LANGUAGE Trustworthy #-}
|
|
| 2 | - |
|
| 3 | ------------------------------------------------------------------------------
|
|
| 4 | --- |
|
|
| 5 | --- Module : GHC.Internal.Data.Ix
|
|
| 6 | --- Copyright : (c) The University of Glasgow 2001
|
|
| 7 | --- License : BSD-style (see the file libraries/base/LICENSE)
|
|
| 8 | ---
|
|
| 9 | --- Maintainer : libraries@haskell.org
|
|
| 10 | --- Stability : stable
|
|
| 11 | --- Portability : portable
|
|
| 12 | ---
|
|
| 13 | --- The 'Ix' class is used to map a contiguous subrange of values in
|
|
| 14 | --- type onto integers. It is used primarily for array indexing
|
|
| 15 | --- (see the array package). 'Ix' uses row-major order.
|
|
| 16 | ---
|
|
| 17 | ------------------------------------------------------------------------------
|
|
| 18 | - |
|
| 19 | -module GHC.Internal.Data.Ix
|
|
| 20 | - (
|
|
| 21 | - -- * The 'Ix' class
|
|
| 22 | - Ix
|
|
| 23 | - ( range
|
|
| 24 | - , index
|
|
| 25 | - , inRange
|
|
| 26 | - , rangeSize
|
|
| 27 | - )
|
|
| 28 | - -- Ix instances:
|
|
| 29 | - --
|
|
| 30 | - -- Ix Char
|
|
| 31 | - -- Ix Int
|
|
| 32 | - -- Ix Integer
|
|
| 33 | - -- Ix Bool
|
|
| 34 | - -- Ix Ordering
|
|
| 35 | - -- Ix ()
|
|
| 36 | - -- (Ix a, Ix b) => Ix (a, b)
|
|
| 37 | - -- ...
|
|
| 38 | - |
|
| 39 | - -- * Deriving Instances of 'Ix'
|
|
| 40 | - -- | Derived instance declarations for the class 'Ix' are only possible
|
|
| 41 | - -- for enumerations (i.e. datatypes having only nullary constructors)
|
|
| 42 | - -- and single-constructor datatypes, including arbitrarily large tuples,
|
|
| 43 | - -- whose constituent types are instances of 'Ix'.
|
|
| 44 | - --
|
|
| 45 | - -- * For an enumeration, the nullary constructors are assumed to be
|
|
| 46 | - -- numbered left-to-right with the indices being 0 to n-1 inclusive. This
|
|
| 47 | - -- is the same numbering defined by the 'Enum' class. For example, given
|
|
| 48 | - -- the datatype:
|
|
| 49 | - --
|
|
| 50 | - -- > data Colour = Red | Orange | Yellow | Green | Blue | Indigo | Violet
|
|
| 51 | - --
|
|
| 52 | - -- we would have:
|
|
| 53 | - --
|
|
| 54 | - -- > range (Yellow,Blue) == [Yellow,Green,Blue]
|
|
| 55 | - -- > index (Yellow,Blue) Green == 1
|
|
| 56 | - -- > inRange (Yellow,Blue) Red == False
|
|
| 57 | - --
|
|
| 58 | - -- * For single-constructor datatypes, the derived instance declarations
|
|
| 59 | - -- are as shown for tuples in chapter 19, section 2 of the Haskell 2010 report:
|
|
| 60 | - -- <https://www.haskell.org/onlinereport/haskell2010/haskellch19.html>.
|
|
| 61 | - |
|
| 62 | - ) where
|
|
| 63 | - |
|
| 64 | -import GHC.Internal.Ix |
| ... | ... | @@ -1286,7 +1286,7 @@ module Data.Int where |
| 1286 | 1286 | data Int8 = ...
|
| 1287 | 1287 | |
| 1288 | 1288 | module Data.Ix where
|
| 1289 | - -- Safety: Safe
|
|
| 1289 | + -- Safety: Trustworthy
|
|
| 1290 | 1290 | type Ix :: * -> Constraint
|
| 1291 | 1291 | class GHC.Internal.Classes.Ord a => Ix a where
|
| 1292 | 1292 | range :: (a, a) -> [a]
|
| ... | ... | @@ -1286,7 +1286,7 @@ module Data.Int where |
| 1286 | 1286 | data Int8 = ...
|
| 1287 | 1287 | |
| 1288 | 1288 | module Data.Ix where
|
| 1289 | - -- Safety: Safe
|
|
| 1289 | + -- Safety: Trustworthy
|
|
| 1290 | 1290 | type Ix :: * -> Constraint
|
| 1291 | 1291 | class GHC.Internal.Classes.Ord a => Ix a where
|
| 1292 | 1292 | range :: (a, a) -> [a]
|
| ... | ... | @@ -1286,7 +1286,7 @@ module Data.Int where |
| 1286 | 1286 | data Int8 = ...
|
| 1287 | 1287 | |
| 1288 | 1288 | module Data.Ix where
|
| 1289 | - -- Safety: Safe
|
|
| 1289 | + -- Safety: Trustworthy
|
|
| 1290 | 1290 | type Ix :: * -> Constraint
|
| 1291 | 1291 | class GHC.Internal.Classes.Ord a => Ix a where
|
| 1292 | 1292 | range :: (a, a) -> [a]
|
| ... | ... | @@ -1286,7 +1286,7 @@ module Data.Int where |
| 1286 | 1286 | data Int8 = ...
|
| 1287 | 1287 | |
| 1288 | 1288 | module Data.Ix where
|
| 1289 | - -- Safety: Safe
|
|
| 1289 | + -- Safety: Trustworthy
|
|
| 1290 | 1290 | type Ix :: * -> Constraint
|
| 1291 | 1291 | class GHC.Internal.Classes.Ord a => Ix a where
|
| 1292 | 1292 | range :: (a, a) -> [a]
|