Wolfgang Jeltsch pushed to branch wip/jeltsch/text-read-implementation-into-base at Glasgow Haskell Compiler / GHC

Commits:

27 changed files:

Changes:

  • libraries/base/src/Data/Data.hs
    ... ... @@ -99,3 +99,38 @@ module Data.Data (
    99 99
     
    
    100 100
     import GHC.Internal.Data.Data
    
    101 101
     import Data.Typeable
    
    102
    +
    
    103
    +import GHC.Real (toRational)
    
    104
    +import GHC.Float (Double)
    
    105
    +import Data.Eq ((==))
    
    106
    +import Data.Function ((.))
    
    107
    +import Data.Maybe (Maybe (Nothing, Just))
    
    108
    +import Data.List (filter)
    
    109
    +import Data.String (String)
    
    110
    +import Text.Read (Read, reads)
    
    111
    +
    
    112
    +-- | Lookup a constructor via a string
    
    113
    +readConstr :: DataType -> String -> Maybe Constr
    
    114
    +readConstr dt str =
    
    115
    +      case dataTypeRep dt of
    
    116
    +        AlgRep cons -> idx cons
    
    117
    +        IntRep      -> mkReadCon (\i -> (mkPrimCon dt str (IntConstr i)))
    
    118
    +        FloatRep    -> mkReadCon ffloat
    
    119
    +        CharRep     -> mkReadCon (\c -> (mkPrimCon dt str (CharConstr c)))
    
    120
    +        NoRep       -> Nothing
    
    121
    +  where
    
    122
    +
    
    123
    +    -- Read a value and build a constructor
    
    124
    +    mkReadCon :: Read t => (t -> Constr) -> Maybe Constr
    
    125
    +    mkReadCon f = case (reads str) of
    
    126
    +                    [(t,"")] -> Just (f t)
    
    127
    +                    _ -> Nothing
    
    128
    +
    
    129
    +    -- Traverse list of algebraic datatype constructors
    
    130
    +    idx :: [Constr] -> Maybe Constr
    
    131
    +    idx cons = case filter ((==) str . showConstr) cons of
    
    132
    +                [] -> Nothing
    
    133
    +                hd : _ -> Just hd
    
    134
    +
    
    135
    +    ffloat :: Double -> Constr
    
    136
    +    ffloat =  mkPrimCon dt str . FloatConstr . toRational

  • libraries/base/src/Data/Functor/Classes.hs
    ... ... @@ -85,7 +85,7 @@ import GHC.Internal.Read (expectP, list, paren, readField)
    85 85
     import GHC.Internal.Show (appPrec)
    
    86 86
     
    
    87 87
     import GHC.Internal.Text.ParserCombinators.ReadPrec (ReadPrec, readPrec_to_S, readS_to_Prec, pfail)
    
    88
    -import GHC.Internal.Text.Read (Read(..), parens, prec, step, reset)
    
    88
    +import Text.Read (Read(..), parens, prec, step, reset)
    
    89 89
     import GHC.Internal.Text.Read.Lex (Lexeme(..))
    
    90 90
     import GHC.Internal.Text.Show (showListWith)
    
    91 91
     import Prelude
    

  • libraries/base/src/Data/Functor/Compose.hs
    ... ... @@ -35,7 +35,7 @@ import GHC.Internal.Data.Foldable (Foldable(..))
    35 35
     import GHC.Internal.Data.Monoid (Sum(..), All(..), Any(..), Product(..))
    
    36 36
     import GHC.Internal.Data.Type.Equality (TestEquality(..), (:~:)(..))
    
    37 37
     import GHC.Generics (Generic, Generic1)
    
    38
    -import GHC.Internal.Text.Read (Read(..), ReadPrec, readListDefault, readListPrecDefault)
    
    38
    +import Text.Read (Read(..), ReadPrec, readListDefault, readListPrecDefault)
    
    39 39
     import Prelude
    
    40 40
     
    
    41 41
     infixr 9 `Compose`
    

  • libraries/base/src/Data/Version.hs
    1 1
     {-# LANGUAGE Safe #-}
    
    2 2
     
    
    3
    +{-# LANGUAGE StandaloneDeriving #-}
    
    4
    +
    
    5
    +{-# OPTIONS_GHC -Wno-orphans #-}
    
    6
    +
    
    3 7
     -- |
    
    4 8
     -- Module      :  Data.Version
    
    5 9
     -- Copyright   :  (c) The University of Glasgow 2004
    
    ... ... @@ -33,3 +37,25 @@ module Data.Version (
    33 37
           ) where
    
    34 38
     
    
    35 39
     import GHC.Internal.Data.Version
    
    40
    +
    
    41
    +import Control.Applicative (pure, (*>))
    
    42
    +import Data.Functor (fmap)
    
    43
    +import Data.Char (isDigit, isAlphaNum)
    
    44
    +import Text.ParserCombinators.ReadP (ReadP, char, munch1, sepBy1, many)
    
    45
    +import Text.Read (Read, read)
    
    46
    +
    
    47
    +{-NOTE:
    
    48
    +    The following instance is technically an orphan, but practically it is not,
    
    49
    +    since ordinary users should not use @ghc-internal@ directly and thus get
    
    50
    +    'Version' only through this module.
    
    51
    +-}
    
    52
    +
    
    53
    +-- | @since base-2.01
    
    54
    +deriving instance Read Version
    
    55
    +
    
    56
    +-- | A parser for versions in the format produced by 'showVersion'.
    
    57
    +--
    
    58
    +parseVersion :: ReadP Version
    
    59
    +parseVersion = do branch <- sepBy1 (fmap read (munch1 isDigit)) (char '.')
    
    60
    +                  tags   <- many (char '-' *> munch1 isAlphaNum)
    
    61
    +                  pure (Version branch tags)

  • libraries/base/src/GHC/ByteOrder.hs
    1 1
     {-# LANGUAGE Safe #-}
    
    2 2
     
    
    3
    +{-# LANGUAGE StandaloneDeriving #-}
    
    4
    +
    
    5
    +{-# OPTIONS_GHC -Wno-orphans #-}
    
    6
    +
    
    3 7
     -- |
    
    4 8
     --
    
    5 9
     -- Module      :  GHC.ByteOrder
    
    ... ... @@ -19,4 +23,15 @@ module GHC.ByteOrder
    19 23
          targetByteOrder
    
    20 24
          ) where
    
    21 25
     
    
    22
    -import GHC.Internal.ByteOrder
    \ No newline at end of file
    26
    +import GHC.Internal.ByteOrder
    
    27
    +
    
    28
    +import Text.Read
    
    29
    +
    
    30
    +{-NOTE:
    
    31
    +    The following instance is technically an orphan, but practically it is not,
    
    32
    +    since ordinary users should not use @ghc-internal@ directly and thus get
    
    33
    +    'ByteOrder' only through this module.
    
    34
    +-}
    
    35
    +
    
    36
    +-- | @since base-4.11.0.0
    
    37
    +deriving instance Read ByteOrder

  • libraries/base/src/Numeric.hs
    1
    -{-# LANGUAGE Safe #-}
    
    1
    +{-# LANGUAGE Trustworthy #-}
    
    2
    +{-# LANGUAGE MagicHash #-}
    
    3
    +{-# LANGUAGE ImportQualifiedPost #-}
    
    2 4
     
    
    3 5
     -- |
    
    4 6
     --
    
    ... ... @@ -48,3 +50,279 @@ module Numeric
    48 50
          ) where
    
    49 51
     
    
    50 52
     import GHC.Internal.Numeric
    
    53
    +
    
    54
    +import GHC.Types (Char (C#))
    
    55
    +import GHC.Err (error, errorWithoutStackTrace)
    
    56
    +import GHC.Base (unsafeChr)
    
    57
    +import GHC.Num (Num, (+), (-), (*))
    
    58
    +import GHC.Real
    
    59
    +       (
    
    60
    +           Integral,
    
    61
    +           Real,
    
    62
    +           RealFrac,
    
    63
    +           fromIntegral,
    
    64
    +           fromRational,
    
    65
    +           quotRem,
    
    66
    +           showSigned
    
    67
    +       )
    
    68
    +import GHC.Float
    
    69
    +       (
    
    70
    +           Floating (..),
    
    71
    +           RealFloat,
    
    72
    +           Float,
    
    73
    +           Double,
    
    74
    +           isNegativeZero,
    
    75
    +           isInfinite,
    
    76
    +           isNaN,
    
    77
    +           fromRat,
    
    78
    +           floatToDigits,
    
    79
    +           FFFormat (FFExponent, FFFixed, FFGeneric),
    
    80
    +           formatRealFloat,
    
    81
    +           formatRealFloatAlt,
    
    82
    +           showFloat
    
    83
    +       )
    
    84
    +import GHC.Read (lexDigits)
    
    85
    +import Control.Monad (return)
    
    86
    +import Data.Eq (Eq, (==))
    
    87
    +import Data.Ord ((<))
    
    88
    +import Data.Function (($), (.))
    
    89
    +import Data.Bool (Bool (False, True), otherwise, (||), (&&))
    
    90
    +import Data.Maybe (Maybe)
    
    91
    +import Data.List ((++))
    
    92
    +import Data.Char (ord, intToDigit)
    
    93
    +import Data.Int (Int)
    
    94
    +import Text.ParserCombinators.ReadP (ReadP, pfail, readP_to_S)
    
    95
    +import Text.Read (ReadS, readParen, lex)
    
    96
    +import Text.Read.Lex qualified as L
    
    97
    +       (
    
    98
    +           Lexeme (Number),
    
    99
    +           lex,
    
    100
    +           numberToRational,
    
    101
    +           readIntP,
    
    102
    +           readBinP,
    
    103
    +           readOctP,
    
    104
    +           readDecP,
    
    105
    +           readHexP
    
    106
    +       )
    
    107
    +import Text.Show (ShowS, show, showString)
    
    108
    +
    
    109
    +-- $setup
    
    110
    +-- >>> import Prelude
    
    111
    +
    
    112
    +-- -----------------------------------------------------------------------------
    
    113
    +-- Reading
    
    114
    +
    
    115
    +-- | Reads an /unsigned/ integral value in an arbitrary base.
    
    116
    +readInt :: Num a
    
    117
    +  => a                  -- ^ the base
    
    118
    +  -> (Char -> Bool)     -- ^ a predicate distinguishing valid digits in this base
    
    119
    +  -> (Char -> Int)      -- ^ a function converting a valid digit character to an 'Int'
    
    120
    +  -> ReadS a
    
    121
    +readInt base isDigit valDigit = readP_to_S (L.readIntP base isDigit valDigit)
    
    122
    +
    
    123
    +-- | Read an unsigned number in binary notation.
    
    124
    +--
    
    125
    +-- >>> readBin "10011"
    
    126
    +-- [(19,"")]
    
    127
    +readBin :: (Eq a, Num a) => ReadS a
    
    128
    +readBin = readP_to_S L.readBinP
    
    129
    +
    
    130
    +-- | Read an unsigned number in octal notation.
    
    131
    +--
    
    132
    +-- >>> readOct "0644"
    
    133
    +-- [(420,"")]
    
    134
    +readOct :: (Eq a, Num a) => ReadS a
    
    135
    +readOct = readP_to_S L.readOctP
    
    136
    +
    
    137
    +-- | Read an unsigned number in decimal notation.
    
    138
    +--
    
    139
    +-- >>> readDec "0644"
    
    140
    +-- [(644,"")]
    
    141
    +readDec :: (Eq a, Num a) => ReadS a
    
    142
    +readDec = readP_to_S L.readDecP
    
    143
    +
    
    144
    +-- | Read an unsigned number in hexadecimal notation.
    
    145
    +-- Both upper or lower case letters are allowed.
    
    146
    +--
    
    147
    +-- >>> readHex "deadbeef"
    
    148
    +-- [(3735928559,"")]
    
    149
    +readHex :: (Eq a, Num a) => ReadS a
    
    150
    +readHex = readP_to_S L.readHexP
    
    151
    +
    
    152
    +-- | Reads an /unsigned/ 'RealFrac' value,
    
    153
    +-- expressed in decimal scientific notation.
    
    154
    +--
    
    155
    +-- Note that this function takes time linear in the magnitude of its input
    
    156
    +-- which can scale exponentially with input size (e.g. @"1e100000000"@ is a
    
    157
    +-- very large number while having a very small textual form).
    
    158
    +-- For this reason, users should take care to avoid using this function on
    
    159
    +-- untrusted input. Users needing to parse floating point values
    
    160
    +-- (e.g. 'Float') are encouraged to instead use 'read', which does
    
    161
    +-- not suffer from this issue.
    
    162
    +readFloat :: RealFrac a => ReadS a
    
    163
    +readFloat = readP_to_S readFloatP
    
    164
    +
    
    165
    +readFloatP :: RealFrac a => ReadP a
    
    166
    +readFloatP =
    
    167
    +  do tok <- L.lex
    
    168
    +     case tok of
    
    169
    +       L.Number n -> return $ fromRational $ L.numberToRational n
    
    170
    +       _          -> pfail
    
    171
    +
    
    172
    +-- It's turgid to have readSigned work using list comprehensions,
    
    173
    +-- but it's specified as a ReadS to ReadS transformer
    
    174
    +-- With a bit of luck no one will use it.
    
    175
    +
    
    176
    +-- | Reads a /signed/ 'Real' value, given a reader for an unsigned value.
    
    177
    +readSigned :: (Real a) => ReadS a -> ReadS a
    
    178
    +readSigned readPos = readParen False read'
    
    179
    +                     where read' r  = read'' r ++
    
    180
    +                                      (do
    
    181
    +                                        ("-",s) <- lex r
    
    182
    +                                        (x,t)   <- read'' s
    
    183
    +                                        return (-x,t))
    
    184
    +                           read'' r = do
    
    185
    +                               (str,s) <- lex r
    
    186
    +                               (n,"")  <- readPos str
    
    187
    +                               return (n,s)
    
    188
    +
    
    189
    +-- -----------------------------------------------------------------------------
    
    190
    +-- Showing
    
    191
    +
    
    192
    +-- | Show /non-negative/ 'Integral' numbers in base 10.
    
    193
    +showInt :: Integral a => a -> ShowS
    
    194
    +showInt n0 cs0
    
    195
    +    | n0 < 0    = errorWithoutStackTrace "GHC.Internal.Numeric.showInt: can't show negative numbers"
    
    196
    +    | otherwise = go n0 cs0
    
    197
    +    where
    
    198
    +    go n cs
    
    199
    +        | n < 10    = case unsafeChr (ord '0' + fromIntegral n) of
    
    200
    +            c@(C# _) -> c:cs
    
    201
    +        | otherwise = case unsafeChr (ord '0' + fromIntegral r) of
    
    202
    +            c@(C# _) -> go q (c:cs)
    
    203
    +        where
    
    204
    +        (q,r) = n `quotRem` 10
    
    205
    +
    
    206
    +-- Controlling the format and precision of floats. The code that
    
    207
    +-- implements the formatting itself is in @PrelNum@ to avoid
    
    208
    +-- mutual module deps.
    
    209
    +
    
    210
    +{-# SPECIALIZE showEFloat ::
    
    211
    +        Maybe Int -> Float  -> ShowS #-}
    
    212
    +{-# SPECIALIZE showEFloat ::
    
    213
    +        Maybe Int -> Double -> ShowS #-}
    
    214
    +{-# SPECIALIZE showFFloat ::
    
    215
    +        Maybe Int -> Float  -> ShowS #-}
    
    216
    +{-# SPECIALIZE showFFloat ::
    
    217
    +        Maybe Int -> Double -> ShowS #-}
    
    218
    +{-# SPECIALIZE showGFloat ::
    
    219
    +        Maybe Int -> Float  -> ShowS #-}
    
    220
    +{-# SPECIALIZE showGFloat ::
    
    221
    +        Maybe Int -> Double -> ShowS #-}
    
    222
    +
    
    223
    +-- | Show a signed 'RealFloat' value
    
    224
    +-- using scientific (exponential) notation (e.g. @2.45e2@, @1.5e-3@).
    
    225
    +--
    
    226
    +-- In the call @'showEFloat' digs val@, if @digs@ is 'Nothing',
    
    227
    +-- the value is shown to full precision; if @digs@ is @'Just' d@,
    
    228
    +-- then at most @d@ digits after the decimal point are shown.
    
    229
    +showEFloat    :: (RealFloat a) => Maybe Int -> a -> ShowS
    
    230
    +
    
    231
    +-- | Show a signed 'RealFloat' value
    
    232
    +-- using standard decimal notation (e.g. @245000@, @0.0015@).
    
    233
    +--
    
    234
    +-- In the call @'showFFloat' digs val@, if @digs@ is 'Nothing',
    
    235
    +-- the value is shown to full precision; if @digs@ is @'Just' d@,
    
    236
    +-- then at most @d@ digits after the decimal point are shown.
    
    237
    +showFFloat    :: (RealFloat a) => Maybe Int -> a -> ShowS
    
    238
    +
    
    239
    +-- | Show a signed 'RealFloat' value
    
    240
    +-- using standard decimal notation for arguments whose absolute value lies
    
    241
    +-- between @0.1@ and @9,999,999@, and scientific notation otherwise.
    
    242
    +--
    
    243
    +-- In the call @'showGFloat' digs val@, if @digs@ is 'Nothing',
    
    244
    +-- the value is shown to full precision; if @digs@ is @'Just' d@,
    
    245
    +-- then at most @d@ digits after the decimal point are shown.
    
    246
    +showGFloat    :: (RealFloat a) => Maybe Int -> a -> ShowS
    
    247
    +
    
    248
    +showEFloat d x =  showString (formatRealFloat FFExponent d x)
    
    249
    +showFFloat d x =  showString (formatRealFloat FFFixed d x)
    
    250
    +showGFloat d x =  showString (formatRealFloat FFGeneric d x)
    
    251
    +
    
    252
    +-- | Show a signed 'RealFloat' value
    
    253
    +-- using standard decimal notation (e.g. @245000@, @0.0015@).
    
    254
    +--
    
    255
    +-- This behaves as 'showFFloat', except that a decimal point
    
    256
    +-- is always guaranteed, even if not needed.
    
    257
    +--
    
    258
    +-- @since base-4.7.0.0
    
    259
    +showFFloatAlt    :: (RealFloat a) => Maybe Int -> a -> ShowS
    
    260
    +
    
    261
    +-- | Show a signed 'RealFloat' value
    
    262
    +-- using standard decimal notation for arguments whose absolute value lies
    
    263
    +-- between @0.1@ and @9,999,999@, and scientific notation otherwise.
    
    264
    +--
    
    265
    +-- This behaves as 'showFFloat', except that a decimal point
    
    266
    +-- is always guaranteed, even if not needed.
    
    267
    +--
    
    268
    +-- @since base-4.7.0.0
    
    269
    +showGFloatAlt    :: (RealFloat a) => Maybe Int -> a -> ShowS
    
    270
    +
    
    271
    +showFFloatAlt d x =  showString (formatRealFloatAlt FFFixed d True x)
    
    272
    +showGFloatAlt d x =  showString (formatRealFloatAlt FFGeneric d True x)
    
    273
    +
    
    274
    +{- | Show a floating-point value in the hexadecimal format,
    
    275
    +similar to the @%a@ specifier in C's printf.
    
    276
    +
    
    277
    +  >>> showHFloat (212.21 :: Double) ""
    
    278
    +  "0x1.a86b851eb851fp7"
    
    279
    +  >>> showHFloat (-12.76 :: Float) ""
    
    280
    +  "-0x1.9851ecp3"
    
    281
    +  >>> showHFloat (-0 :: Double) ""
    
    282
    +  "-0x0p+0"
    
    283
    +
    
    284
    +@since base-4.11.0.0
    
    285
    +-}
    
    286
    +showHFloat :: RealFloat a => a -> ShowS
    
    287
    +showHFloat = showString . fmt
    
    288
    +  where
    
    289
    +  fmt x
    
    290
    +    | isNaN x                   = "NaN"
    
    291
    +    | isInfinite x              = (if x < 0 then "-" else "") ++ "Infinity"
    
    292
    +    | x < 0 || isNegativeZero x = '-' : cvt (-x)
    
    293
    +    | otherwise                 = cvt x
    
    294
    +
    
    295
    +  cvt x
    
    296
    +    | x == 0 = "0x0p+0"
    
    297
    +    | otherwise =
    
    298
    +      case floatToDigits 2 x of
    
    299
    +        r@([], _) -> error $ "Impossible happened: showHFloat: " ++ show r
    
    300
    +        (d:ds, e) -> "0x" ++ show d ++ frac ds ++ "p" ++ show (e-1)
    
    301
    +
    
    302
    +  -- Given binary digits, convert them to hex in blocks of 4
    
    303
    +  -- Special case: If all 0's, just drop it.
    
    304
    +  frac digits
    
    305
    +    | allZ digits = ""
    
    306
    +    | otherwise   = "." ++ hex digits
    
    307
    +    where
    
    308
    +    hex ds =
    
    309
    +      case ds of
    
    310
    +        []                -> ""
    
    311
    +        [a]               -> hexDigit a 0 0 0 ""
    
    312
    +        [a,b]             -> hexDigit a b 0 0 ""
    
    313
    +        [a,b,c]           -> hexDigit a b c 0 ""
    
    314
    +        a : b : c : d : r -> hexDigit a b c d (hex r)
    
    315
    +
    
    316
    +  hexDigit a b c d = showHex (8*a + 4*b + 2*c + d)
    
    317
    +
    
    318
    +  allZ xs = case xs of
    
    319
    +              x : more -> x == 0 && allZ more
    
    320
    +              []       -> True
    
    321
    +
    
    322
    +-- | Show /non-negative/ 'Integral' numbers in base 8.
    
    323
    +showOct :: Integral a => a -> ShowS
    
    324
    +showOct = showIntAtBase 8  intToDigit
    
    325
    +
    
    326
    +-- | Show /non-negative/ 'Integral' numbers in base 2.
    
    327
    +showBin :: Integral a => a -> ShowS
    
    328
    +showBin = showIntAtBase 2  intToDigit

  • libraries/base/src/Prelude.hs
    ... ... @@ -179,7 +179,7 @@ import GHC.Internal.Data.Tuple
    179 179
     import GHC.Internal.Base hiding ( foldr, mapM, sequence )
    
    180 180
     import GHC.Internal.Classes
    
    181 181
     import GHC.Internal.Err
    
    182
    -import GHC.Internal.Text.Read
    
    182
    +import Text.Read
    
    183 183
     import GHC.Internal.Enum
    
    184 184
     import GHC.Internal.Num
    
    185 185
     import GHC.Internal.Prim (seq)
    

  • libraries/base/src/System/IO.hs
    1 1
     {-# LANGUAGE Trustworthy #-}
    
    2 2
     {-# LANGUAGE CPP #-}
    
    3
    +{-# LANGUAGE StandaloneDeriving #-}
    
    4
    +
    
    5
    +{-# OPTIONS_GHC -Wno-orphans #-}
    
    3 6
     
    
    4 7
     -- |
    
    5 8
     --
    
    ... ... @@ -895,3 +898,24 @@ rw_flags = output_flags .|. o_RDWR
    895 898
     -- output
    
    896 899
     -- > input^D
    
    897 900
     -- output
    
    901
    +
    
    902
    +{-NOTE:
    
    903
    +    The following instances are technically orphans, but practically they are
    
    904
    +    not, since ordinary users should not use @ghc-internal@ directly and thus
    
    905
    +    get the instantiated types only through this module.
    
    906
    +-}
    
    907
    +
    
    908
    +-- | @since base-4.2.0.0
    
    909
    +deriving instance Read IOMode
    
    910
    +
    
    911
    +-- | @since base-4.2.0.0
    
    912
    +deriving instance Read BufferMode
    
    913
    +
    
    914
    +-- | @since base-4.2.0.0
    
    915
    +deriving instance Read SeekMode
    
    916
    +
    
    917
    +-- | @since base-4.3.0.0
    
    918
    +deriving instance Read Newline
    
    919
    +
    
    920
    +-- | @since base-4.3.0.0
    
    921
    +deriving instance Read NewlineMode

  • libraries/base/src/Text/Printf.hs
    ... ... @@ -97,8 +97,8 @@ import Data.Char
    97 97
     import GHC.Internal.Int
    
    98 98
     import GHC.Internal.Data.List (stripPrefix)
    
    99 99
     import GHC.Internal.Word
    
    100
    -import GHC.Internal.Numeric
    
    101 100
     import GHC.Internal.Numeric.Natural
    
    101
    +import Numeric
    
    102 102
     import System.IO
    
    103 103
     
    
    104 104
     -- $setup
    

  • libraries/base/src/Text/Read.hs
    ... ... @@ -39,5 +39,84 @@ module Text.Read
    39 39
          readMaybe
    
    40 40
          ) where
    
    41 41
     
    
    42
    -import GHC.Internal.Text.Read
    
    42
    +import GHC.Err (errorWithoutStackTrace)
    
    43
    +import GHC.Read
    
    44
    +       (
    
    45
    +           ReadS,
    
    46
    +           Read (readsPrec, readList, readPrec, readListPrec),
    
    47
    +           lex,
    
    48
    +           readParen,
    
    49
    +           readListDefault,
    
    50
    +           lexP,
    
    51
    +           parens,
    
    52
    +           readListPrecDefault
    
    53
    +       )
    
    54
    +import Control.Monad (return)
    
    55
    +import Data.Function (id)
    
    56
    +import Data.Maybe (Maybe (Nothing, Just))
    
    57
    +import Data.Either (Either (Left, Right), either)
    
    58
    +import Data.String (String)
    
    59
    +import Text.Read.Lex (Lexeme (Char, String, Punc, Ident, Symbol, Number, EOF))
    
    60
    +import Text.ParserCombinators.ReadP (skipSpaces)
    
    43 61
     import Text.ParserCombinators.ReadPrec
    
    62
    +
    
    63
    +-- $setup
    
    64
    +-- >>> import Prelude
    
    65
    +
    
    66
    +------------------------------------------------------------------------
    
    67
    +-- utility functions
    
    68
    +
    
    69
    +-- | equivalent to 'readsPrec' with a precedence of 0.
    
    70
    +reads :: Read a => ReadS a
    
    71
    +reads = readsPrec minPrec
    
    72
    +
    
    73
    +-- | Parse a string using the 'Read' instance.
    
    74
    +-- Succeeds if there is exactly one valid result.
    
    75
    +-- A 'Left' value indicates a parse error.
    
    76
    +--
    
    77
    +-- >>> readEither "123" :: Either String Int
    
    78
    +-- Right 123
    
    79
    +--
    
    80
    +-- >>> readEither "hello" :: Either String Int
    
    81
    +-- Left "Prelude.read: no parse"
    
    82
    +--
    
    83
    +-- @since base-4.6.0.0
    
    84
    +readEither :: Read a => String -> Either String a
    
    85
    +readEither s =
    
    86
    +  case [ x | (x,"") <- readPrec_to_S read' minPrec s ] of
    
    87
    +    [x] -> Right x
    
    88
    +    []  -> Left "Prelude.read: no parse"
    
    89
    +    _   -> Left "Prelude.read: ambiguous parse"
    
    90
    + where
    
    91
    +  read' =
    
    92
    +    do x <- readPrec
    
    93
    +       lift skipSpaces
    
    94
    +       return x
    
    95
    +
    
    96
    +-- | Parse a string using the 'Read' instance.
    
    97
    +-- Succeeds if there is exactly one valid result.
    
    98
    +--
    
    99
    +-- >>> readMaybe "123" :: Maybe Int
    
    100
    +-- Just 123
    
    101
    +--
    
    102
    +-- >>> readMaybe "hello" :: Maybe Int
    
    103
    +-- Nothing
    
    104
    +--
    
    105
    +-- @since base-4.6.0.0
    
    106
    +readMaybe :: Read a => String -> Maybe a
    
    107
    +readMaybe s = case readEither s of
    
    108
    +                Left _  -> Nothing
    
    109
    +                Right a -> Just a
    
    110
    +
    
    111
    +-- | The 'read' function reads input from a string, which must be
    
    112
    +-- completely consumed by the input process. 'read' fails with an 'error' if the
    
    113
    +-- parse is unsuccessful, and it is therefore discouraged from being used in
    
    114
    +-- real applications. Use 'readMaybe' or 'readEither' for safe alternatives.
    
    115
    +--
    
    116
    +-- >>> read "123" :: Int
    
    117
    +-- 123
    
    118
    +--
    
    119
    +-- >>> read "hello" :: Int
    
    120
    +-- *** Exception: Prelude.read: no parse
    
    121
    +read :: Read a => String -> a
    
    122
    +read s = either errorWithoutStackTrace id (readEither s)

  • libraries/ghc-internal/ghc-internal.cabal.in
    ... ... @@ -329,7 +329,6 @@ Library
    329 329
             GHC.Internal.System.Posix.Types
    
    330 330
             GHC.Internal.Text.ParserCombinators.ReadP
    
    331 331
             GHC.Internal.Text.ParserCombinators.ReadPrec
    
    332
    -        GHC.Internal.Text.Read
    
    333 332
             GHC.Internal.Text.Read.Lex
    
    334 333
             GHC.Internal.Text.Show
    
    335 334
             GHC.Internal.Type.Reflection
    

  • libraries/ghc-internal/src/GHC/Internal/Data/Data.hs
    ... ... @@ -61,6 +61,7 @@ module GHC.Internal.Data.Data (
    61 61
             mkIntType,
    
    62 62
             mkFloatType,
    
    63 63
             mkCharType,
    
    64
    +        mkPrimCon,
    
    64 65
             mkNoRepType,
    
    65 66
             -- ** Observers
    
    66 67
             dataTypeName,
    
    ... ... @@ -94,7 +95,6 @@ module GHC.Internal.Data.Data (
    94 95
             constrIndex,
    
    95 96
             -- ** From strings to constructors and vice versa: all data types
    
    96 97
             showConstr,
    
    97
    -        readConstr,
    
    98 98
     
    
    99 99
             -- * Convenience functions: take type constructors apart
    
    100 100
             tyconUQname,
    
    ... ... @@ -126,10 +126,8 @@ import GHC.Internal.Base (
    126 126
     import GHC.Internal.Err (errorWithoutStackTrace)
    
    127 127
     import GHC.Internal.List
    
    128 128
     import GHC.Internal.Num
    
    129
    -import GHC.Internal.Read
    
    130 129
     import GHC.Internal.Show
    
    131 130
     import GHC.Internal.Tuple (Solo (..))
    
    132
    -import GHC.Internal.Text.Read( reads )
    
    133 131
     import GHC.Internal.Types (
    
    134 132
         Bool(..), Char, Coercible, Float, Double, Type, type (~), type (~~),
    
    135 133
       )
    
    ... ... @@ -688,32 +686,6 @@ showConstr :: Constr -> String
    688 686
     showConstr = constring
    
    689 687
     
    
    690 688
     
    
    691
    --- | Lookup a constructor via a string
    
    692
    -readConstr :: DataType -> String -> Maybe Constr
    
    693
    -readConstr dt str =
    
    694
    -      case dataTypeRep dt of
    
    695
    -        AlgRep cons -> idx cons
    
    696
    -        IntRep      -> mkReadCon (\i -> (mkPrimCon dt str (IntConstr i)))
    
    697
    -        FloatRep    -> mkReadCon ffloat
    
    698
    -        CharRep     -> mkReadCon (\c -> (mkPrimCon dt str (CharConstr c)))
    
    699
    -        NoRep       -> Nothing
    
    700
    -  where
    
    701
    -
    
    702
    -    -- Read a value and build a constructor
    
    703
    -    mkReadCon :: Read t => (t -> Constr) -> Maybe Constr
    
    704
    -    mkReadCon f = case (reads str) of
    
    705
    -                    [(t,"")] -> Just (f t)
    
    706
    -                    _ -> Nothing
    
    707
    -
    
    708
    -    -- Traverse list of algebraic datatype constructors
    
    709
    -    idx :: [Constr] -> Maybe Constr
    
    710
    -    idx cons = case filter ((==) str . showConstr) cons of
    
    711
    -                [] -> Nothing
    
    712
    -                hd : _ -> Just hd
    
    713
    -
    
    714
    -    ffloat :: Double -> Constr
    
    715
    -    ffloat =  mkPrimCon dt str . FloatConstr . toRational
    
    716
    -
    
    717 689
     ------------------------------------------------------------------------------
    
    718 690
     --
    
    719 691
     --      Convenience functions: algebraic data types
    

  • libraries/ghc-internal/src/GHC/Internal/Data/Version.hs
    ... ... @@ -10,7 +10,7 @@
    10 10
     --
    
    11 11
     -- Maintainer  :  libraries@haskell.org
    
    12 12
     -- Stability   :  stable
    
    13
    --- Portability :  non-portable (local universal quantification in ReadP)
    
    13
    +-- Portability :  non-portable
    
    14 14
     --
    
    15 15
     -- A general library for representation and manipulation of versions.
    
    16 16
     --
    
    ... ... @@ -31,23 +31,17 @@ module GHC.Internal.Data.Version (
    31 31
             -- * The @Version@ type
    
    32 32
             Version(..),
    
    33 33
             -- * A concrete representation of @Version@
    
    34
    -        showVersion, parseVersion,
    
    34
    +        showVersion,
    
    35 35
             -- * Constructor function
    
    36 36
             makeVersion
    
    37 37
       ) where
    
    38 38
     
    
    39
    -import GHC.Internal.Classes          ( Eq(..), (&&) )
    
    40
    -import GHC.Internal.Data.Functor     ( Functor(..) )
    
    39
    +import GHC.Internal.Classes          ( Eq ((==)), (&&) )
    
    41 40
     import GHC.Internal.Int              ( Int )
    
    42 41
     import GHC.Internal.Data.List        ( map, sort, concat, concatMap, intersperse, (++) )
    
    43 42
     import GHC.Internal.Data.Ord
    
    44 43
     import GHC.Internal.Data.String      ( String )
    
    45
    -import GHC.Internal.Base             ( Applicative(..) )
    
    46
    -import GHC.Internal.Unicode          ( isDigit, isAlphaNum )
    
    47
    -import GHC.Internal.Read
    
    48 44
     import GHC.Internal.Show
    
    49
    -import GHC.Internal.Text.ParserCombinators.ReadP
    
    50
    -import GHC.Internal.Text.Read        ( read )
    
    51 45
     
    
    52 46
     {- |
    
    53 47
     A 'Version' represents the version of a software entity.
    
    ... ... @@ -69,8 +63,8 @@ operations are the right thing for every 'Version'.
    69 63
     
    
    70 64
     Similarly, concrete representations of versions may differ.  One
    
    71 65
     possible concrete representation is provided (see 'showVersion' and
    
    72
    -'parseVersion'), but depending on the application a different concrete
    
    73
    -representation may be more appropriate.
    
    66
    +'Data.Version.parseVersion'), but depending on the application a
    
    67
    +different concrete representation may be more appropriate.
    
    74 68
     -}
    
    75 69
     data Version =
    
    76 70
       Version { versionBranch :: [Int],
    
    ... ... @@ -92,8 +86,7 @@ data Version =
    92 86
                     -- The interpretation of the list of tags is entirely dependent
    
    93 87
                     -- on the entity that this version applies to.
    
    94 88
             }
    
    95
    -  deriving ( Read    -- ^ @since base-2.01
    
    96
    -           , Show    -- ^ @since base-2.01
    
    89
    +  deriving ( Show    -- ^ @since base-2.01
    
    97 90
                )
    
    98 91
     {-# DEPRECATED versionTags "See GHC ticket #2496" #-}
    
    99 92
     -- TODO. Remove all references to versionTags in GHC 8.0 release.
    
    ... ... @@ -120,13 +113,6 @@ showVersion (Version branch tags)
    120 113
       = concat (intersperse "." (map show branch)) ++
    
    121 114
          concatMap ('-':) tags
    
    122 115
     
    
    123
    --- | A parser for versions in the format produced by 'showVersion'.
    
    124
    ---
    
    125
    -parseVersion :: ReadP Version
    
    126
    -parseVersion = do branch <- sepBy1 (fmap read (munch1 isDigit)) (char '.')
    
    127
    -                  tags   <- many (char '-' *> munch1 isAlphaNum)
    
    128
    -                  pure Version{versionBranch=branch, versionTags=tags}
    
    129
    -
    
    130 116
     -- | Construct tag-less 'Version'
    
    131 117
     --
    
    132 118
     -- @since base-4.8.0.0
    

  • libraries/ghc-internal/src/GHC/Internal/IO/Device.hs
    ... ... @@ -34,7 +34,6 @@ import GHC.Internal.Types ( Bool(..), Int )
    34 34
     import GHC.Internal.Word
    
    35 35
     import GHC.Internal.Arr
    
    36 36
     import GHC.Internal.Enum
    
    37
    -import GHC.Internal.Read
    
    38 37
     import GHC.Internal.Show
    
    39 38
     import GHC.Internal.Ptr
    
    40 39
     import GHC.Internal.Num
    
    ... ... @@ -182,7 +181,6 @@ data SeekMode
    182 181
                  , Ord  -- ^ @since base-4.2.0.0
    
    183 182
                  , Ix   -- ^ @since base-4.2.0.0
    
    184 183
                  , Enum -- ^ @since base-4.2.0.0
    
    185
    -             , Read -- ^ @since base-4.2.0.0
    
    186 184
                  , Show -- ^ @since base-4.2.0.0
    
    187 185
                  )
    
    188 186
     

  • libraries/ghc-internal/src/GHC/Internal/IO/Handle/Types.hs
    ... ... @@ -50,7 +50,6 @@ import GHC.Internal.IO.BufferedIO
    50 50
     import GHC.Internal.IO.Encoding.Types
    
    51 51
     import GHC.Internal.IORef
    
    52 52
     import GHC.Internal.Show
    
    53
    -import GHC.Internal.Read
    
    54 53
     import GHC.Internal.Types (Bool(..), Int)
    
    55 54
     import GHC.Internal.Word
    
    56 55
     import GHC.Internal.IO.Device
    
    ... ... @@ -273,7 +272,6 @@ data BufferMode
    273 272
                     -- is 'Just' @n@ and is otherwise implementation-dependent.
    
    274 273
        deriving ( Eq   -- ^ @since base-4.2.0.0
    
    275 274
                 , Ord  -- ^ @since base-4.2.0.0
    
    276
    -            , Read -- ^ @since base-4.2.0.0
    
    277 275
                 , Show -- ^ @since base-4.2.0.0
    
    278 276
                 )
    
    279 277
     
    
    ... ... @@ -379,7 +377,6 @@ data Newline = LF -- ^ @\'\\n\'@
    379 377
                  | CRLF  -- ^ @\'\\r\\n\'@
    
    380 378
                  deriving ( Eq   -- ^ @since base-4.2.0.0
    
    381 379
                           , Ord  -- ^ @since base-4.3.0.0
    
    382
    -                      , Read -- ^ @since base-4.3.0.0
    
    383 380
                           , Show -- ^ @since base-4.3.0.0
    
    384 381
                           )
    
    385 382
     
    
    ... ... @@ -396,7 +393,6 @@ data NewlineMode
    396 393
                      }
    
    397 394
                  deriving ( Eq   -- ^ @since base-4.2.0.0
    
    398 395
                           , Ord  -- ^ @since base-4.3.0.0
    
    399
    -                      , Read -- ^ @since base-4.3.0.0
    
    400 396
                           , Show -- ^ @since base-4.3.0.0
    
    401 397
                           )
    
    402 398
     
    

  • libraries/ghc-internal/src/GHC/Internal/IO/IOMode.hs
    ... ... @@ -20,7 +20,6 @@ module GHC.Internal.IO.IOMode (IOMode(..)) where
    20 20
     
    
    21 21
     import GHC.Internal.Classes (Eq, Ord)
    
    22 22
     import GHC.Internal.Show
    
    23
    -import GHC.Internal.Read
    
    24 23
     import GHC.Internal.Arr
    
    25 24
     import GHC.Internal.Enum
    
    26 25
     
    
    ... ... @@ -30,7 +29,6 @@ data IOMode = ReadMode | WriteMode | AppendMode | ReadWriteMode
    30 29
                                  , Ord  -- ^ @since base-4.2.0.0
    
    31 30
                                  , Ix   -- ^ @since base-4.2.0.0
    
    32 31
                                  , Enum -- ^ @since base-4.2.0.0
    
    33
    -                             , Read -- ^ @since base-4.2.0.0
    
    34 32
                                  , Show -- ^ @since base-4.2.0.0
    
    35 33
                                  )
    
    36 34
     

  • libraries/ghc-internal/src/GHC/Internal/Numeric.hs
    1 1
     {-# LANGUAGE Trustworthy #-}
    
    2
    -{-# LANGUAGE NoImplicitPrelude, MagicHash #-}
    
    3 2
     
    
    4 3
     -----------------------------------------------------------------------------
    
    5 4
     -- |
    
    ... ... @@ -16,279 +15,16 @@
    16 15
     --
    
    17 16
     -----------------------------------------------------------------------------
    
    18 17
     
    
    19
    -module GHC.Internal.Numeric (
    
    18
    +module GHC.Internal.Numeric (showIntAtBase, showHex) where
    
    20 19
     
    
    21
    -        -- * Showing
    
    22
    -
    
    23
    -        showSigned,
    
    24
    -
    
    25
    -        showIntAtBase,
    
    26
    -        showInt,
    
    27
    -        showBin,
    
    28
    -        showHex,
    
    29
    -        showOct,
    
    30
    -
    
    31
    -        showEFloat,
    
    32
    -        showFFloat,
    
    33
    -        showGFloat,
    
    34
    -        showFFloatAlt,
    
    35
    -        showGFloatAlt,
    
    36
    -        showFloat,
    
    37
    -        showHFloat,
    
    38
    -
    
    39
    -        floatToDigits,
    
    40
    -
    
    41
    -        -- * Reading
    
    42
    -
    
    43
    -        -- | /NB:/ 'readInt' is the \'dual\' of 'showIntAtBase',
    
    44
    -        -- and 'readDec' is the \`dual\' of 'showInt'.
    
    45
    -        -- The inconsistent naming is a historical accident.
    
    46
    -
    
    47
    -        readSigned,
    
    48
    -
    
    49
    -        readInt,
    
    50
    -        readBin,
    
    51
    -        readDec,
    
    52
    -        readOct,
    
    53
    -        readHex,
    
    54
    -
    
    55
    -        readFloat,
    
    56
    -
    
    57
    -        lexDigits,
    
    58
    -
    
    59
    -        -- * Miscellaneous
    
    60
    -
    
    61
    -        fromRat,
    
    62
    -        Floating(..)
    
    63
    -
    
    64
    -        ) where
    
    65
    -
    
    66
    -import GHC.Internal.Base (ord, otherwise, return, unsafeChr, ($), (.), (++))
    
    67
    -import GHC.Internal.Classes (Eq(..), Ord(..), (&&), (||))
    
    68
    -import GHC.Internal.Err (error, errorWithoutStackTrace)
    
    69
    -import GHC.Internal.Maybe (Maybe(..))
    
    70 20
     import GHC.Internal.Prim (seq)
    
    71
    -import GHC.Internal.Read
    
    72
    -import GHC.Internal.Real
    
    73
    -import GHC.Internal.Float
    
    74
    -import GHC.Internal.Num
    
    75
    -import GHC.Internal.Show
    
    76
    -import GHC.Internal.Text.ParserCombinators.ReadP( ReadP, readP_to_S, pfail )
    
    77
    -import qualified GHC.Internal.Text.Read.Lex as L
    
    78
    -import GHC.Internal.Types (Bool(..), Char(..), Int)
    
    79
    -
    
    80
    --- $setup
    
    81
    --- >>> import Prelude
    
    82
    -
    
    83
    --- -----------------------------------------------------------------------------
    
    84
    --- Reading
    
    85
    -
    
    86
    --- | Reads an /unsigned/ integral value in an arbitrary base.
    
    87
    -readInt :: Num a
    
    88
    -  => a                  -- ^ the base
    
    89
    -  -> (Char -> Bool)     -- ^ a predicate distinguishing valid digits in this base
    
    90
    -  -> (Char -> Int)      -- ^ a function converting a valid digit character to an 'Int'
    
    91
    -  -> ReadS a
    
    92
    -readInt base isDigit valDigit = readP_to_S (L.readIntP base isDigit valDigit)
    
    93
    -
    
    94
    --- | Read an unsigned number in binary notation.
    
    95
    ---
    
    96
    --- >>> readBin "10011"
    
    97
    --- [(19,"")]
    
    98
    -readBin :: (Eq a, Num a) => ReadS a
    
    99
    -readBin = readP_to_S L.readBinP
    
    100
    -
    
    101
    --- | Read an unsigned number in octal notation.
    
    102
    ---
    
    103
    --- >>> readOct "0644"
    
    104
    --- [(420,"")]
    
    105
    -readOct :: (Eq a, Num a) => ReadS a
    
    106
    -readOct = readP_to_S L.readOctP
    
    107
    -
    
    108
    --- | Read an unsigned number in decimal notation.
    
    109
    ---
    
    110
    --- >>> readDec "0644"
    
    111
    --- [(644,"")]
    
    112
    -readDec :: (Eq a, Num a) => ReadS a
    
    113
    -readDec = readP_to_S L.readDecP
    
    114
    -
    
    115
    --- | Read an unsigned number in hexadecimal notation.
    
    116
    --- Both upper or lower case letters are allowed.
    
    117
    ---
    
    118
    --- >>> readHex "deadbeef"
    
    119
    --- [(3735928559,"")]
    
    120
    -readHex :: (Eq a, Num a) => ReadS a
    
    121
    -readHex = readP_to_S L.readHexP
    
    122
    -
    
    123
    --- | Reads an /unsigned/ 'RealFrac' value,
    
    124
    --- expressed in decimal scientific notation.
    
    125
    ---
    
    126
    --- Note that this function takes time linear in the magnitude of its input
    
    127
    --- which can scale exponentially with input size (e.g. @"1e100000000"@ is a
    
    128
    --- very large number while having a very small textual form).
    
    129
    --- For this reason, users should take care to avoid using this function on
    
    130
    --- untrusted input. Users needing to parse floating point values
    
    131
    --- (e.g. 'Float') are encouraged to instead use 'read', which does
    
    132
    --- not suffer from this issue.
    
    133
    -readFloat :: RealFrac a => ReadS a
    
    134
    -readFloat = readP_to_S readFloatP
    
    135
    -
    
    136
    -readFloatP :: RealFrac a => ReadP a
    
    137
    -readFloatP =
    
    138
    -  do tok <- L.lex
    
    139
    -     case tok of
    
    140
    -       L.Number n -> return $ fromRational $ L.numberToRational n
    
    141
    -       _          -> pfail
    
    142
    -
    
    143
    --- It's turgid to have readSigned work using list comprehensions,
    
    144
    --- but it's specified as a ReadS to ReadS transformer
    
    145
    --- With a bit of luck no one will use it.
    
    146
    -
    
    147
    --- | Reads a /signed/ 'Real' value, given a reader for an unsigned value.
    
    148
    -readSigned :: (Real a) => ReadS a -> ReadS a
    
    149
    -readSigned readPos = readParen False read'
    
    150
    -                     where read' r  = read'' r ++
    
    151
    -                                      (do
    
    152
    -                                        ("-",s) <- lex r
    
    153
    -                                        (x,t)   <- read'' s
    
    154
    -                                        return (-x,t))
    
    155
    -                           read'' r = do
    
    156
    -                               (str,s) <- lex r
    
    157
    -                               (n,"")  <- readPos str
    
    158
    -                               return (n,s)
    
    159
    -
    
    160
    --- -----------------------------------------------------------------------------
    
    161
    --- Showing
    
    162
    -
    
    163
    --- | Show /non-negative/ 'Integral' numbers in base 10.
    
    164
    -showInt :: Integral a => a -> ShowS
    
    165
    -showInt n0 cs0
    
    166
    -    | n0 < 0    = errorWithoutStackTrace "GHC.Internal.Numeric.showInt: can't show negative numbers"
    
    167
    -    | otherwise = go n0 cs0
    
    168
    -    where
    
    169
    -    go n cs
    
    170
    -        | n < 10    = case unsafeChr (ord '0' + fromIntegral n) of
    
    171
    -            c@(C# _) -> c:cs
    
    172
    -        | otherwise = case unsafeChr (ord '0' + fromIntegral r) of
    
    173
    -            c@(C# _) -> go q (c:cs)
    
    174
    -        where
    
    175
    -        (q,r) = n `quotRem` 10
    
    176
    -
    
    177
    --- Controlling the format and precision of floats. The code that
    
    178
    --- implements the formatting itself is in @PrelNum@ to avoid
    
    179
    --- mutual module deps.
    
    180
    -
    
    181
    -{-# SPECIALIZE showEFloat ::
    
    182
    -        Maybe Int -> Float  -> ShowS #-}
    
    183
    -{-# SPECIALIZE showEFloat ::
    
    184
    -        Maybe Int -> Double -> ShowS #-}
    
    185
    -{-# SPECIALIZE showFFloat ::
    
    186
    -        Maybe Int -> Float  -> ShowS #-}
    
    187
    -{-# SPECIALIZE showFFloat ::
    
    188
    -        Maybe Int -> Double -> ShowS #-}
    
    189
    -{-# SPECIALIZE showGFloat ::
    
    190
    -        Maybe Int -> Float  -> ShowS #-}
    
    191
    -{-# SPECIALIZE showGFloat ::
    
    192
    -        Maybe Int -> Double -> ShowS #-}
    
    193
    -
    
    194
    --- | Show a signed 'RealFloat' value
    
    195
    --- using scientific (exponential) notation (e.g. @2.45e2@, @1.5e-3@).
    
    196
    ---
    
    197
    --- In the call @'showEFloat' digs val@, if @digs@ is 'Nothing',
    
    198
    --- the value is shown to full precision; if @digs@ is @'Just' d@,
    
    199
    --- then at most @d@ digits after the decimal point are shown.
    
    200
    -showEFloat    :: (RealFloat a) => Maybe Int -> a -> ShowS
    
    201
    -
    
    202
    --- | Show a signed 'RealFloat' value
    
    203
    --- using standard decimal notation (e.g. @245000@, @0.0015@).
    
    204
    ---
    
    205
    --- In the call @'showFFloat' digs val@, if @digs@ is 'Nothing',
    
    206
    --- the value is shown to full precision; if @digs@ is @'Just' d@,
    
    207
    --- then at most @d@ digits after the decimal point are shown.
    
    208
    -showFFloat    :: (RealFloat a) => Maybe Int -> a -> ShowS
    
    209
    -
    
    210
    --- | Show a signed 'RealFloat' value
    
    211
    --- using standard decimal notation for arguments whose absolute value lies
    
    212
    --- between @0.1@ and @9,999,999@, and scientific notation otherwise.
    
    213
    ---
    
    214
    --- In the call @'showGFloat' digs val@, if @digs@ is 'Nothing',
    
    215
    --- the value is shown to full precision; if @digs@ is @'Just' d@,
    
    216
    --- then at most @d@ digits after the decimal point are shown.
    
    217
    -showGFloat    :: (RealFloat a) => Maybe Int -> a -> ShowS
    
    218
    -
    
    219
    -showEFloat d x =  showString (formatRealFloat FFExponent d x)
    
    220
    -showFFloat d x =  showString (formatRealFloat FFFixed d x)
    
    221
    -showGFloat d x =  showString (formatRealFloat FFGeneric d x)
    
    222
    -
    
    223
    --- | Show a signed 'RealFloat' value
    
    224
    --- using standard decimal notation (e.g. @245000@, @0.0015@).
    
    225
    ---
    
    226
    --- This behaves as 'showFFloat', except that a decimal point
    
    227
    --- is always guaranteed, even if not needed.
    
    228
    ---
    
    229
    --- @since base-4.7.0.0
    
    230
    -showFFloatAlt    :: (RealFloat a) => Maybe Int -> a -> ShowS
    
    231
    -
    
    232
    --- | Show a signed 'RealFloat' value
    
    233
    --- using standard decimal notation for arguments whose absolute value lies
    
    234
    --- between @0.1@ and @9,999,999@, and scientific notation otherwise.
    
    235
    ---
    
    236
    --- This behaves as 'showFFloat', except that a decimal point
    
    237
    --- is always guaranteed, even if not needed.
    
    238
    ---
    
    239
    --- @since base-4.7.0.0
    
    240
    -showGFloatAlt    :: (RealFloat a) => Maybe Int -> a -> ShowS
    
    241
    -
    
    242
    -showFFloatAlt d x =  showString (formatRealFloatAlt FFFixed d True x)
    
    243
    -showGFloatAlt d x =  showString (formatRealFloatAlt FFGeneric d True x)
    
    244
    -
    
    245
    -{- | Show a floating-point value in the hexadecimal format,
    
    246
    -similar to the @%a@ specifier in C's printf.
    
    247
    -
    
    248
    -  >>> showHFloat (212.21 :: Double) ""
    
    249
    -  "0x1.a86b851eb851fp7"
    
    250
    -  >>> showHFloat (-12.76 :: Float) ""
    
    251
    -  "-0x1.9851ecp3"
    
    252
    -  >>> showHFloat (-0 :: Double) ""
    
    253
    -  "-0x0p+0"
    
    254
    -
    
    255
    -@since base-4.11.0.0
    
    256
    --}
    
    257
    -showHFloat :: RealFloat a => a -> ShowS
    
    258
    -showHFloat = showString . fmt
    
    259
    -  where
    
    260
    -  fmt x
    
    261
    -    | isNaN x                   = "NaN"
    
    262
    -    | isInfinite x              = (if x < 0 then "-" else "") ++ "Infinity"
    
    263
    -    | x < 0 || isNegativeZero x = '-' : cvt (-x)
    
    264
    -    | otherwise                 = cvt x
    
    265
    -
    
    266
    -  cvt x
    
    267
    -    | x == 0 = "0x0p+0"
    
    268
    -    | otherwise =
    
    269
    -      case floatToDigits 2 x of
    
    270
    -        r@([], _) -> error $ "Impossible happened: showHFloat: " ++ show r
    
    271
    -        (d:ds, e) -> "0x" ++ show d ++ frac ds ++ "p" ++ show (e-1)
    
    272
    -
    
    273
    -  -- Given binary digits, convert them to hex in blocks of 4
    
    274
    -  -- Special case: If all 0's, just drop it.
    
    275
    -  frac digits
    
    276
    -    | allZ digits = ""
    
    277
    -    | otherwise   = "." ++ hex digits
    
    278
    -    where
    
    279
    -    hex ds =
    
    280
    -      case ds of
    
    281
    -        []                -> ""
    
    282
    -        [a]               -> hexDigit a 0 0 0 ""
    
    283
    -        [a,b]             -> hexDigit a b 0 0 ""
    
    284
    -        [a,b,c]           -> hexDigit a b c 0 ""
    
    285
    -        a : b : c : d : r -> hexDigit a b c d (hex r)
    
    286
    -
    
    287
    -  hexDigit a b c d = showHex (8*a + 4*b + 2*c + d)
    
    288
    -
    
    289
    -  allZ xs = case xs of
    
    290
    -              x : more -> x == 0 && allZ more
    
    291
    -              []       -> True
    
    21
    +import GHC.Internal.Types (Char, Int)
    
    22
    +import GHC.Internal.Classes ((<), (<=))
    
    23
    +import GHC.Internal.Err (errorWithoutStackTrace)
    
    24
    +import GHC.Internal.Base (($), otherwise)
    
    25
    +import GHC.Internal.List ((++))
    
    26
    +import GHC.Internal.Real (Integral, toInteger, fromIntegral, quotRem)
    
    27
    +import GHC.Internal.Show (ShowS, show, intToDigit)
    
    292 28
     
    
    293 29
     -- ---------------------------------------------------------------------------
    
    294 30
     -- Integer printing functions
    
    ... ... @@ -312,11 +48,3 @@ showIntAtBase base toChr n0 r0
    312 48
     -- | Show /non-negative/ 'Integral' numbers in base 16.
    
    313 49
     showHex :: Integral a => a -> ShowS
    
    314 50
     showHex = showIntAtBase 16 intToDigit
    315
    -
    
    316
    --- | Show /non-negative/ 'Integral' numbers in base 8.
    
    317
    -showOct :: Integral a => a -> ShowS
    
    318
    -showOct = showIntAtBase 8  intToDigit
    
    319
    -
    
    320
    --- | Show /non-negative/ 'Integral' numbers in base 2.
    
    321
    -showBin :: Integral a => a -> ShowS
    
    322
    -showBin = showIntAtBase 2  intToDigit

  • libraries/ghc-internal/src/GHC/Internal/Read.hs
    ... ... @@ -80,7 +80,6 @@ import GHC.Internal.Types (Bool(..), Char, Int, Ordering(..))
    80 80
     import GHC.Internal.Word
    
    81 81
     import GHC.Internal.List (filter)
    
    82 82
     import GHC.Internal.Tuple (Solo (..))
    
    83
    -import GHC.Internal.ByteOrder
    
    84 83
     
    
    85 84
     
    
    86 85
     -- | @'readParen' 'True' p@ parses what @p@ parses, but surrounded with
    
    ... ... @@ -840,6 +839,3 @@ instance (Read a, Read b, Read c, Read d, Read e, Read f, Read g, Read h,
    840 839
                               ; return (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o) })
    
    841 840
       readListPrec = readListPrecDefault
    
    842 841
       readList     = readListDefault
    843
    -
    
    844
    --- | @since base-4.11.0.0
    
    845
    -deriving instance Read ByteOrder

  • libraries/ghc-internal/src/GHC/Internal/Text/Read.hs deleted
    1
    -{-# LANGUAGE Trustworthy #-}
    
    2
    -{-# LANGUAGE NoImplicitPrelude #-}
    
    3
    -
    
    4
    ------------------------------------------------------------------------------
    
    5
    --- |
    
    6
    --- Module      :  GHC.Internal.Text.Read
    
    7
    --- Copyright   :  (c) The University of Glasgow 2001
    
    8
    --- License     :  BSD-style (see the file libraries/base/LICENSE)
    
    9
    ---
    
    10
    --- Maintainer  :  libraries@haskell.org
    
    11
    --- Stability   :  provisional
    
    12
    --- Portability :  non-portable (uses Text.ParserCombinators.ReadP)
    
    13
    ---
    
    14
    --- Converting strings to values.
    
    15
    ---
    
    16
    --- The "Text.Read" library is the canonical library to import for
    
    17
    --- 'Read'-class facilities.  For GHC only, it offers an extended and much
    
    18
    --- improved 'Read' class, which constitutes a proposed alternative to the
    
    19
    --- Haskell 2010 'Read'.  In particular, writing parsers is easier, and
    
    20
    --- the parsers are much more efficient.
    
    21
    ---
    
    22
    ------------------------------------------------------------------------------
    
    23
    -
    
    24
    -module GHC.Internal.Text.Read (
    
    25
    -   -- * The 'Read' class
    
    26
    -   Read(..),
    
    27
    -   ReadS,
    
    28
    -
    
    29
    -   -- * Haskell 2010 functions
    
    30
    -   reads,
    
    31
    -   read,
    
    32
    -   readParen,
    
    33
    -   lex,
    
    34
    -
    
    35
    -   -- * New parsing functions
    
    36
    -   module GHC.Internal.Text.ParserCombinators.ReadPrec,
    
    37
    -   L.Lexeme(..),
    
    38
    -   lexP,
    
    39
    -   parens,
    
    40
    -   readListDefault,
    
    41
    -   readListPrecDefault,
    
    42
    -   readEither,
    
    43
    -   readMaybe
    
    44
    -
    
    45
    - ) where
    
    46
    -
    
    47
    -import GHC.Internal.Base (String, id, return)
    
    48
    -import GHC.Internal.Err (errorWithoutStackTrace)
    
    49
    -import GHC.Internal.Maybe (Maybe(..))
    
    50
    -import GHC.Internal.Read
    
    51
    -import GHC.Internal.Data.Either
    
    52
    -import GHC.Internal.Text.ParserCombinators.ReadP as P
    
    53
    -import GHC.Internal.Text.ParserCombinators.ReadPrec
    
    54
    -import qualified GHC.Internal.Text.Read.Lex as L
    
    55
    -
    
    56
    --- $setup
    
    57
    --- >>> import Prelude
    
    58
    -
    
    59
    -------------------------------------------------------------------------
    
    60
    --- utility functions
    
    61
    -
    
    62
    --- | equivalent to 'readsPrec' with a precedence of 0.
    
    63
    -reads :: Read a => ReadS a
    
    64
    -reads = readsPrec minPrec
    
    65
    -
    
    66
    --- | Parse a string using the 'Read' instance.
    
    67
    --- Succeeds if there is exactly one valid result.
    
    68
    --- A 'Left' value indicates a parse error.
    
    69
    ---
    
    70
    --- >>> readEither "123" :: Either String Int
    
    71
    --- Right 123
    
    72
    ---
    
    73
    --- >>> readEither "hello" :: Either String Int
    
    74
    --- Left "Prelude.read: no parse"
    
    75
    ---
    
    76
    --- @since base-4.6.0.0
    
    77
    -readEither :: Read a => String -> Either String a
    
    78
    -readEither s =
    
    79
    -  case [ x | (x,"") <- readPrec_to_S read' minPrec s ] of
    
    80
    -    [x] -> Right x
    
    81
    -    []  -> Left "Prelude.read: no parse"
    
    82
    -    _   -> Left "Prelude.read: ambiguous parse"
    
    83
    - where
    
    84
    -  read' =
    
    85
    -    do x <- readPrec
    
    86
    -       lift P.skipSpaces
    
    87
    -       return x
    
    88
    -
    
    89
    --- | Parse a string using the 'Read' instance.
    
    90
    --- Succeeds if there is exactly one valid result.
    
    91
    ---
    
    92
    --- >>> readMaybe "123" :: Maybe Int
    
    93
    --- Just 123
    
    94
    ---
    
    95
    --- >>> readMaybe "hello" :: Maybe Int
    
    96
    --- Nothing
    
    97
    ---
    
    98
    --- @since base-4.6.0.0
    
    99
    -readMaybe :: Read a => String -> Maybe a
    
    100
    -readMaybe s = case readEither s of
    
    101
    -                Left _  -> Nothing
    
    102
    -                Right a -> Just a
    
    103
    -
    
    104
    --- | The 'read' function reads input from a string, which must be
    
    105
    --- completely consumed by the input process. 'read' fails with an 'error' if the
    
    106
    --- parse is unsuccessful, and it is therefore discouraged from being used in
    
    107
    --- real applications. Use 'readMaybe' or 'readEither' for safe alternatives.
    
    108
    ---
    
    109
    --- >>> read "123" :: Int
    
    110
    --- 123
    
    111
    ---
    
    112
    --- >>> read "hello" :: Int
    
    113
    --- *** Exception: Prelude.read: no parse
    
    114
    -read :: Read a => String -> a
    
    115
    -read s = either errorWithoutStackTrace id (readEither s)

  • testsuite/tests/interface-stability/base-exports.stdout
    ... ... @@ -9453,7 +9453,7 @@ module GHC.Word where
    9453 9453
       uncheckedShiftRL64# :: GHC.Internal.Prim.Word64# -> GHC.Internal.Prim.Int# -> GHC.Internal.Prim.Word64#
    
    9454 9454
     
    
    9455 9455
     module Numeric where
    
    9456
    -  -- Safety: Safe
    
    9456
    +  -- Safety: Trustworthy
    
    9457 9457
       type Floating :: * -> Constraint
    
    9458 9458
       class GHC.Internal.Real.Fractional a => Floating a where
    
    9459 9459
         pi :: a
    
    ... ... @@ -12430,7 +12430,6 @@ instance forall a. GHC.Internal.Read.Read a => GHC.Internal.Read.Read (GHC.Inter
    12430 12430
     instance forall a. GHC.Internal.Read.Read a => GHC.Internal.Read.Read (GHC.Internal.Data.Bits.Xor a) -- Defined in ‘GHC.Internal.Data.Bits’
    
    12431 12431
     instance forall a b. (GHC.Internal.Ix.Ix a, GHC.Internal.Read.Read a, GHC.Internal.Read.Read b) => GHC.Internal.Read.Read (GHC.Internal.Arr.Array a b) -- Defined in ‘GHC.Internal.Read’
    
    12432 12432
     instance GHC.Internal.Read.Read GHC.Internal.Types.Bool -- Defined in ‘GHC.Internal.Read’
    
    12433
    -instance GHC.Internal.Read.Read GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.Read’
    
    12434 12433
     instance GHC.Internal.Read.Read GHC.Internal.Types.Char -- Defined in ‘GHC.Internal.Read’
    
    12435 12434
     instance GHC.Internal.Read.Read GHC.Internal.Types.Double -- Defined in ‘GHC.Internal.Read’
    
    12436 12435
     instance GHC.Internal.Read.Read GHC.Internal.Types.Float -- Defined in ‘GHC.Internal.Read’
    
    ... ... @@ -12497,7 +12496,7 @@ instance forall a. GHC.Internal.Read.Read a => GHC.Internal.Read.Read (Data.Semi
    12497 12496
     instance forall a. GHC.Internal.Read.Read a => GHC.Internal.Read.Read (Data.Semigroup.Min a) -- Defined in ‘Data.Semigroup’
    
    12498 12497
     instance forall m. GHC.Internal.Read.Read m => GHC.Internal.Read.Read (Data.Semigroup.WrappedMonoid m) -- Defined in ‘Data.Semigroup’
    
    12499 12498
     instance forall k (a :: k) (b :: k). Coercible a b => GHC.Internal.Read.Read (GHC.Internal.Data.Type.Coercion.Coercion a b) -- Defined in ‘GHC.Internal.Data.Type.Coercion’
    
    12500
    -instance GHC.Internal.Read.Read GHC.Internal.Data.Version.Version -- Defined in ‘GHC.Internal.Data.Version’
    
    12499
    +instance [safe] GHC.Internal.Read.Read GHC.Internal.Data.Version.Version -- Defined in ‘Data.Version’
    
    12501 12500
     instance GHC.Internal.Read.Read GHC.Internal.Foreign.Ptr.IntPtr -- Defined in ‘GHC.Internal.Foreign.Ptr’
    
    12502 12501
     instance GHC.Internal.Read.Read GHC.Internal.Foreign.Ptr.WordPtr -- Defined in ‘GHC.Internal.Foreign.Ptr’
    
    12503 12502
     instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CBool -- Defined in ‘GHC.Internal.Foreign.C.Types’
    
    ... ... @@ -12526,6 +12525,7 @@ instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CULong -- Defined i
    12526 12525
     instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CUSeconds -- Defined in ‘GHC.Internal.Foreign.C.Types’
    
    12527 12526
     instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’
    
    12528 12527
     instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’
    
    12528
    +instance [safe] GHC.Internal.Read.Read GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.ByteOrder’
    
    12529 12529
     instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Internal.Read.Read (f p), GHC.Internal.Read.Read (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:*:) f g p) -- Defined in ‘GHC.Internal.Generics’
    
    12530 12530
     instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Internal.Read.Read (f p), GHC.Internal.Read.Read (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:+:) f g p) -- Defined in ‘GHC.Internal.Generics’
    
    12531 12531
     instance forall k2 k1 (f :: k2 -> *) (g :: k1 -> k2) (p :: k1). GHC.Internal.Read.Read (f (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:.:) f g p) -- Defined in ‘GHC.Internal.Generics’
    
    ... ... @@ -12540,16 +12540,16 @@ instance GHC.Internal.Read.Read GHC.Internal.Generics.SourceStrictness -- Define
    12540 12540
     instance GHC.Internal.Read.Read GHC.Internal.Generics.SourceUnpackedness -- Defined in ‘GHC.Internal.Generics’
    
    12541 12541
     instance forall k (p :: k). GHC.Internal.Read.Read (GHC.Internal.Generics.U1 p) -- Defined in ‘GHC.Internal.Generics’
    
    12542 12542
     instance forall k (p :: k). GHC.Internal.Read.Read (GHC.Internal.Generics.V1 p) -- Defined in ‘GHC.Internal.Generics’
    
    12543
    -instance GHC.Internal.Read.Read GHC.Internal.IO.Device.SeekMode -- Defined in ‘GHC.Internal.IO.Device’
    
    12544
    -instance GHC.Internal.Read.Read GHC.Internal.IO.Handle.Types.BufferMode -- Defined in ‘GHC.Internal.IO.Handle.Types’
    
    12545
    -instance GHC.Internal.Read.Read GHC.Internal.IO.Handle.Types.Newline -- Defined in ‘GHC.Internal.IO.Handle.Types’
    
    12546
    -instance GHC.Internal.Read.Read GHC.Internal.IO.Handle.Types.NewlineMode -- Defined in ‘GHC.Internal.IO.Handle.Types’
    
    12547
    -instance GHC.Internal.Read.Read GHC.Internal.IO.IOMode.IOMode -- Defined in ‘GHC.Internal.IO.IOMode’
    
    12548 12543
     instance [safe] GHC.Internal.Read.Read GHC.Stats.GCDetails -- Defined in ‘GHC.Stats’
    
    12549 12544
     instance [safe] GHC.Internal.Read.Read GHC.Stats.RTSStats -- Defined in ‘GHC.Stats’
    
    12550 12545
     instance GHC.Internal.Read.Read GHC.Internal.TypeNats.SomeNat -- Defined in ‘GHC.Internal.TypeNats’
    
    12551 12546
     instance GHC.Internal.Read.Read GHC.Internal.TypeLits.SomeChar -- Defined in ‘GHC.Internal.TypeLits’
    
    12552 12547
     instance GHC.Internal.Read.Read GHC.Internal.TypeLits.SomeSymbol -- Defined in ‘GHC.Internal.TypeLits’
    
    12548
    +instance GHC.Internal.Read.Read GHC.Internal.IO.Handle.Types.BufferMode -- Defined in ‘System.IO’
    
    12549
    +instance GHC.Internal.Read.Read GHC.Internal.IO.IOMode.IOMode -- Defined in ‘System.IO’
    
    12550
    +instance GHC.Internal.Read.Read GHC.Internal.IO.Handle.Types.Newline -- Defined in ‘System.IO’
    
    12551
    +instance GHC.Internal.Read.Read GHC.Internal.IO.Handle.Types.NewlineMode -- Defined in ‘System.IO’
    
    12552
    +instance GHC.Internal.Read.Read GHC.Internal.IO.Device.SeekMode -- Defined in ‘System.IO’
    
    12553 12553
     instance forall k a (b :: k). GHC.Internal.Real.Fractional a => GHC.Internal.Real.Fractional (GHC.Internal.Data.Functor.Const.Const a b) -- Defined in ‘GHC.Internal.Data.Functor.Const’
    
    12554 12554
     instance forall a. GHC.Internal.Float.RealFloat a => GHC.Internal.Real.Fractional (Data.Complex.Complex a) -- Defined in ‘Data.Complex’
    
    12555 12555
     instance forall k (a :: k). Data.Fixed.HasResolution a => GHC.Internal.Real.Fractional (Data.Fixed.Fixed a) -- Defined in ‘Data.Fixed’
    

  • testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs
    ... ... @@ -9491,7 +9491,7 @@ module GHC.Word where
    9491 9491
       uncheckedShiftRL64# :: GHC.Internal.Prim.Word64# -> GHC.Internal.Prim.Int# -> GHC.Internal.Prim.Word64#
    
    9492 9492
     
    
    9493 9493
     module Numeric where
    
    9494
    -  -- Safety: Safe
    
    9494
    +  -- Safety: Trustworthy
    
    9495 9495
       type Floating :: * -> Constraint
    
    9496 9496
       class GHC.Internal.Real.Fractional a => Floating a where
    
    9497 9497
         pi :: a
    
    ... ... @@ -12459,7 +12459,6 @@ instance forall a. GHC.Internal.Read.Read a => GHC.Internal.Read.Read (GHC.Inter
    12459 12459
     instance forall a. GHC.Internal.Read.Read a => GHC.Internal.Read.Read (GHC.Internal.Data.Bits.Xor a) -- Defined in ‘GHC.Internal.Data.Bits’
    
    12460 12460
     instance forall a b. (GHC.Internal.Ix.Ix a, GHC.Internal.Read.Read a, GHC.Internal.Read.Read b) => GHC.Internal.Read.Read (GHC.Internal.Arr.Array a b) -- Defined in ‘GHC.Internal.Read’
    
    12461 12461
     instance GHC.Internal.Read.Read GHC.Internal.Types.Bool -- Defined in ‘GHC.Internal.Read’
    
    12462
    -instance GHC.Internal.Read.Read GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.Read’
    
    12463 12462
     instance GHC.Internal.Read.Read GHC.Internal.Types.Char -- Defined in ‘GHC.Internal.Read’
    
    12464 12463
     instance GHC.Internal.Read.Read GHC.Internal.Types.Double -- Defined in ‘GHC.Internal.Read’
    
    12465 12464
     instance GHC.Internal.Read.Read GHC.Internal.Types.Float -- Defined in ‘GHC.Internal.Read’
    
    ... ... @@ -12526,7 +12525,7 @@ instance forall a. GHC.Internal.Read.Read a => GHC.Internal.Read.Read (Data.Semi
    12526 12525
     instance forall a. GHC.Internal.Read.Read a => GHC.Internal.Read.Read (Data.Semigroup.Min a) -- Defined in ‘Data.Semigroup’
    
    12527 12526
     instance forall m. GHC.Internal.Read.Read m => GHC.Internal.Read.Read (Data.Semigroup.WrappedMonoid m) -- Defined in ‘Data.Semigroup’
    
    12528 12527
     instance forall k (a :: k) (b :: k). Coercible a b => GHC.Internal.Read.Read (GHC.Internal.Data.Type.Coercion.Coercion a b) -- Defined in ‘GHC.Internal.Data.Type.Coercion’
    
    12529
    -instance GHC.Internal.Read.Read GHC.Internal.Data.Version.Version -- Defined in ‘GHC.Internal.Data.Version’
    
    12528
    +instance [safe] GHC.Internal.Read.Read GHC.Internal.Data.Version.Version -- Defined in ‘Data.Version’
    
    12530 12529
     instance GHC.Internal.Read.Read GHC.Internal.Foreign.Ptr.IntPtr -- Defined in ‘GHC.Internal.Foreign.Ptr’
    
    12531 12530
     instance GHC.Internal.Read.Read GHC.Internal.Foreign.Ptr.WordPtr -- Defined in ‘GHC.Internal.Foreign.Ptr’
    
    12532 12531
     instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CBool -- Defined in ‘GHC.Internal.Foreign.C.Types’
    
    ... ... @@ -12555,6 +12554,7 @@ instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CULong -- Defined i
    12555 12554
     instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CUSeconds -- Defined in ‘GHC.Internal.Foreign.C.Types’
    
    12556 12555
     instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’
    
    12557 12556
     instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’
    
    12557
    +instance [safe] GHC.Internal.Read.Read GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.ByteOrder’
    
    12558 12558
     instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Internal.Read.Read (f p), GHC.Internal.Read.Read (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:*:) f g p) -- Defined in ‘GHC.Internal.Generics’
    
    12559 12559
     instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Internal.Read.Read (f p), GHC.Internal.Read.Read (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:+:) f g p) -- Defined in ‘GHC.Internal.Generics’
    
    12560 12560
     instance forall k2 k1 (f :: k2 -> *) (g :: k1 -> k2) (p :: k1). GHC.Internal.Read.Read (f (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:.:) f g p) -- Defined in ‘GHC.Internal.Generics’
    
    ... ... @@ -12569,16 +12569,16 @@ instance GHC.Internal.Read.Read GHC.Internal.Generics.SourceStrictness -- Define
    12569 12569
     instance GHC.Internal.Read.Read GHC.Internal.Generics.SourceUnpackedness -- Defined in ‘GHC.Internal.Generics’
    
    12570 12570
     instance forall k (p :: k). GHC.Internal.Read.Read (GHC.Internal.Generics.U1 p) -- Defined in ‘GHC.Internal.Generics’
    
    12571 12571
     instance forall k (p :: k). GHC.Internal.Read.Read (GHC.Internal.Generics.V1 p) -- Defined in ‘GHC.Internal.Generics’
    
    12572
    -instance GHC.Internal.Read.Read GHC.Internal.IO.Device.SeekMode -- Defined in ‘GHC.Internal.IO.Device’
    
    12573
    -instance GHC.Internal.Read.Read GHC.Internal.IO.Handle.Types.BufferMode -- Defined in ‘GHC.Internal.IO.Handle.Types’
    
    12574
    -instance GHC.Internal.Read.Read GHC.Internal.IO.Handle.Types.Newline -- Defined in ‘GHC.Internal.IO.Handle.Types’
    
    12575
    -instance GHC.Internal.Read.Read GHC.Internal.IO.Handle.Types.NewlineMode -- Defined in ‘GHC.Internal.IO.Handle.Types’
    
    12576
    -instance GHC.Internal.Read.Read GHC.Internal.IO.IOMode.IOMode -- Defined in ‘GHC.Internal.IO.IOMode’
    
    12577 12572
     instance [safe] GHC.Internal.Read.Read GHC.Stats.GCDetails -- Defined in ‘GHC.Stats’
    
    12578 12573
     instance [safe] GHC.Internal.Read.Read GHC.Stats.RTSStats -- Defined in ‘GHC.Stats’
    
    12579 12574
     instance GHC.Internal.Read.Read GHC.Internal.TypeNats.SomeNat -- Defined in ‘GHC.Internal.TypeNats’
    
    12580 12575
     instance GHC.Internal.Read.Read GHC.Internal.TypeLits.SomeChar -- Defined in ‘GHC.Internal.TypeLits’
    
    12581 12576
     instance GHC.Internal.Read.Read GHC.Internal.TypeLits.SomeSymbol -- Defined in ‘GHC.Internal.TypeLits’
    
    12577
    +instance GHC.Internal.Read.Read GHC.Internal.IO.Handle.Types.BufferMode -- Defined in ‘System.IO’
    
    12578
    +instance GHC.Internal.Read.Read GHC.Internal.IO.IOMode.IOMode -- Defined in ‘System.IO’
    
    12579
    +instance GHC.Internal.Read.Read GHC.Internal.IO.Handle.Types.Newline -- Defined in ‘System.IO’
    
    12580
    +instance GHC.Internal.Read.Read GHC.Internal.IO.Handle.Types.NewlineMode -- Defined in ‘System.IO’
    
    12581
    +instance GHC.Internal.Read.Read GHC.Internal.IO.Device.SeekMode -- Defined in ‘System.IO’
    
    12582 12582
     instance forall k a (b :: k). GHC.Internal.Real.Fractional a => GHC.Internal.Real.Fractional (GHC.Internal.Data.Functor.Const.Const a b) -- Defined in ‘GHC.Internal.Data.Functor.Const’
    
    12583 12583
     instance forall a. GHC.Internal.Float.RealFloat a => GHC.Internal.Real.Fractional (Data.Complex.Complex a) -- Defined in ‘Data.Complex’
    
    12584 12584
     instance forall k (a :: k). Data.Fixed.HasResolution a => GHC.Internal.Real.Fractional (Data.Fixed.Fixed a) -- Defined in ‘Data.Fixed’
    

  • testsuite/tests/interface-stability/base-exports.stdout-mingw32
    ... ... @@ -9733,7 +9733,7 @@ module GHC.Word where
    9733 9733
       uncheckedShiftRL64# :: GHC.Internal.Prim.Word64# -> GHC.Internal.Prim.Int# -> GHC.Internal.Prim.Word64#
    
    9734 9734
     
    
    9735 9735
     module Numeric where
    
    9736
    -  -- Safety: Safe
    
    9736
    +  -- Safety: Trustworthy
    
    9737 9737
       type Floating :: * -> Constraint
    
    9738 9738
       class GHC.Internal.Real.Fractional a => Floating a where
    
    9739 9739
         pi :: a
    
    ... ... @@ -12701,7 +12701,6 @@ instance forall a. GHC.Internal.Read.Read a => GHC.Internal.Read.Read (GHC.Inter
    12701 12701
     instance forall a. GHC.Internal.Read.Read a => GHC.Internal.Read.Read (GHC.Internal.Data.Bits.Xor a) -- Defined in ‘GHC.Internal.Data.Bits’
    
    12702 12702
     instance forall a b. (GHC.Internal.Ix.Ix a, GHC.Internal.Read.Read a, GHC.Internal.Read.Read b) => GHC.Internal.Read.Read (GHC.Internal.Arr.Array a b) -- Defined in ‘GHC.Internal.Read’
    
    12703 12703
     instance GHC.Internal.Read.Read GHC.Internal.Types.Bool -- Defined in ‘GHC.Internal.Read’
    
    12704
    -instance GHC.Internal.Read.Read GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.Read’
    
    12705 12704
     instance GHC.Internal.Read.Read GHC.Internal.Types.Char -- Defined in ‘GHC.Internal.Read’
    
    12706 12705
     instance GHC.Internal.Read.Read GHC.Internal.Types.Double -- Defined in ‘GHC.Internal.Read’
    
    12707 12706
     instance GHC.Internal.Read.Read GHC.Internal.Types.Float -- Defined in ‘GHC.Internal.Read’
    
    ... ... @@ -12768,7 +12767,7 @@ instance forall a. GHC.Internal.Read.Read a => GHC.Internal.Read.Read (Data.Semi
    12768 12767
     instance forall a. GHC.Internal.Read.Read a => GHC.Internal.Read.Read (Data.Semigroup.Min a) -- Defined in ‘Data.Semigroup’
    
    12769 12768
     instance forall m. GHC.Internal.Read.Read m => GHC.Internal.Read.Read (Data.Semigroup.WrappedMonoid m) -- Defined in ‘Data.Semigroup’
    
    12770 12769
     instance forall k (a :: k) (b :: k). Coercible a b => GHC.Internal.Read.Read (GHC.Internal.Data.Type.Coercion.Coercion a b) -- Defined in ‘GHC.Internal.Data.Type.Coercion’
    
    12771
    -instance GHC.Internal.Read.Read GHC.Internal.Data.Version.Version -- Defined in ‘GHC.Internal.Data.Version’
    
    12770
    +instance [safe] GHC.Internal.Read.Read GHC.Internal.Data.Version.Version -- Defined in ‘Data.Version’
    
    12772 12771
     instance GHC.Internal.Read.Read GHC.Internal.Foreign.Ptr.IntPtr -- Defined in ‘GHC.Internal.Foreign.Ptr’
    
    12773 12772
     instance GHC.Internal.Read.Read GHC.Internal.Foreign.Ptr.WordPtr -- Defined in ‘GHC.Internal.Foreign.Ptr’
    
    12774 12773
     instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CBool -- Defined in ‘GHC.Internal.Foreign.C.Types’
    
    ... ... @@ -12797,6 +12796,7 @@ instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CULong -- Defined i
    12797 12796
     instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CUSeconds -- Defined in ‘GHC.Internal.Foreign.C.Types’
    
    12798 12797
     instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’
    
    12799 12798
     instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’
    
    12799
    +instance [safe] GHC.Internal.Read.Read GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.ByteOrder’
    
    12800 12800
     instance GHC.Internal.Read.Read GHC.Internal.Event.Windows.ConsoleEvent.ConsoleEvent -- Defined in ‘GHC.Internal.Event.Windows.ConsoleEvent’
    
    12801 12801
     instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Internal.Read.Read (f p), GHC.Internal.Read.Read (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:*:) f g p) -- Defined in ‘GHC.Internal.Generics’
    
    12802 12802
     instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Internal.Read.Read (f p), GHC.Internal.Read.Read (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:+:) f g p) -- Defined in ‘GHC.Internal.Generics’
    
    ... ... @@ -12812,16 +12812,16 @@ instance GHC.Internal.Read.Read GHC.Internal.Generics.SourceStrictness -- Define
    12812 12812
     instance GHC.Internal.Read.Read GHC.Internal.Generics.SourceUnpackedness -- Defined in ‘GHC.Internal.Generics’
    
    12813 12813
     instance forall k (p :: k). GHC.Internal.Read.Read (GHC.Internal.Generics.U1 p) -- Defined in ‘GHC.Internal.Generics’
    
    12814 12814
     instance forall k (p :: k). GHC.Internal.Read.Read (GHC.Internal.Generics.V1 p) -- Defined in ‘GHC.Internal.Generics’
    
    12815
    -instance GHC.Internal.Read.Read GHC.Internal.IO.Device.SeekMode -- Defined in ‘GHC.Internal.IO.Device’
    
    12816
    -instance GHC.Internal.Read.Read GHC.Internal.IO.Handle.Types.BufferMode -- Defined in ‘GHC.Internal.IO.Handle.Types’
    
    12817
    -instance GHC.Internal.Read.Read GHC.Internal.IO.Handle.Types.Newline -- Defined in ‘GHC.Internal.IO.Handle.Types’
    
    12818
    -instance GHC.Internal.Read.Read GHC.Internal.IO.Handle.Types.NewlineMode -- Defined in ‘GHC.Internal.IO.Handle.Types’
    
    12819
    -instance GHC.Internal.Read.Read GHC.Internal.IO.IOMode.IOMode -- Defined in ‘GHC.Internal.IO.IOMode’
    
    12820 12815
     instance [safe] GHC.Internal.Read.Read GHC.Stats.GCDetails -- Defined in ‘GHC.Stats’
    
    12821 12816
     instance [safe] GHC.Internal.Read.Read GHC.Stats.RTSStats -- Defined in ‘GHC.Stats’
    
    12822 12817
     instance GHC.Internal.Read.Read GHC.Internal.TypeNats.SomeNat -- Defined in ‘GHC.Internal.TypeNats’
    
    12823 12818
     instance GHC.Internal.Read.Read GHC.Internal.TypeLits.SomeChar -- Defined in ‘GHC.Internal.TypeLits’
    
    12824 12819
     instance GHC.Internal.Read.Read GHC.Internal.TypeLits.SomeSymbol -- Defined in ‘GHC.Internal.TypeLits’
    
    12820
    +instance GHC.Internal.Read.Read GHC.Internal.IO.Handle.Types.BufferMode -- Defined in ‘System.IO’
    
    12821
    +instance GHC.Internal.Read.Read GHC.Internal.IO.IOMode.IOMode -- Defined in ‘System.IO’
    
    12822
    +instance GHC.Internal.Read.Read GHC.Internal.IO.Handle.Types.Newline -- Defined in ‘System.IO’
    
    12823
    +instance GHC.Internal.Read.Read GHC.Internal.IO.Handle.Types.NewlineMode -- Defined in ‘System.IO’
    
    12824
    +instance GHC.Internal.Read.Read GHC.Internal.IO.Device.SeekMode -- Defined in ‘System.IO’
    
    12825 12825
     instance forall k a (b :: k). GHC.Internal.Real.Fractional a => GHC.Internal.Real.Fractional (GHC.Internal.Data.Functor.Const.Const a b) -- Defined in ‘GHC.Internal.Data.Functor.Const’
    
    12826 12826
     instance forall a. GHC.Internal.Float.RealFloat a => GHC.Internal.Real.Fractional (Data.Complex.Complex a) -- Defined in ‘Data.Complex’
    
    12827 12827
     instance forall k (a :: k). Data.Fixed.HasResolution a => GHC.Internal.Real.Fractional (Data.Fixed.Fixed a) -- Defined in ‘Data.Fixed’
    

  • testsuite/tests/interface-stability/base-exports.stdout-ws-32
    ... ... @@ -9453,7 +9453,7 @@ module GHC.Word where
    9453 9453
       uncheckedShiftRL64# :: GHC.Internal.Prim.Word64# -> GHC.Internal.Prim.Int# -> GHC.Internal.Prim.Word64#
    
    9454 9454
     
    
    9455 9455
     module Numeric where
    
    9456
    -  -- Safety: Safe
    
    9456
    +  -- Safety: Trustworthy
    
    9457 9457
       type Floating :: * -> Constraint
    
    9458 9458
       class GHC.Internal.Real.Fractional a => Floating a where
    
    9459 9459
         pi :: a
    
    ... ... @@ -12430,7 +12430,6 @@ instance forall a. GHC.Internal.Read.Read a => GHC.Internal.Read.Read (GHC.Inter
    12430 12430
     instance forall a. GHC.Internal.Read.Read a => GHC.Internal.Read.Read (GHC.Internal.Data.Bits.Xor a) -- Defined in ‘GHC.Internal.Data.Bits’
    
    12431 12431
     instance forall a b. (GHC.Internal.Ix.Ix a, GHC.Internal.Read.Read a, GHC.Internal.Read.Read b) => GHC.Internal.Read.Read (GHC.Internal.Arr.Array a b) -- Defined in ‘GHC.Internal.Read’
    
    12432 12432
     instance GHC.Internal.Read.Read GHC.Internal.Types.Bool -- Defined in ‘GHC.Internal.Read’
    
    12433
    -instance GHC.Internal.Read.Read GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.Read’
    
    12434 12433
     instance GHC.Internal.Read.Read GHC.Internal.Types.Char -- Defined in ‘GHC.Internal.Read’
    
    12435 12434
     instance GHC.Internal.Read.Read GHC.Internal.Types.Double -- Defined in ‘GHC.Internal.Read’
    
    12436 12435
     instance GHC.Internal.Read.Read GHC.Internal.Types.Float -- Defined in ‘GHC.Internal.Read’
    
    ... ... @@ -12497,7 +12496,7 @@ instance forall a. GHC.Internal.Read.Read a => GHC.Internal.Read.Read (Data.Semi
    12497 12496
     instance forall a. GHC.Internal.Read.Read a => GHC.Internal.Read.Read (Data.Semigroup.Min a) -- Defined in ‘Data.Semigroup’
    
    12498 12497
     instance forall m. GHC.Internal.Read.Read m => GHC.Internal.Read.Read (Data.Semigroup.WrappedMonoid m) -- Defined in ‘Data.Semigroup’
    
    12499 12498
     instance forall k (a :: k) (b :: k). Coercible a b => GHC.Internal.Read.Read (GHC.Internal.Data.Type.Coercion.Coercion a b) -- Defined in ‘GHC.Internal.Data.Type.Coercion’
    
    12500
    -instance GHC.Internal.Read.Read GHC.Internal.Data.Version.Version -- Defined in ‘GHC.Internal.Data.Version’
    
    12499
    +instance [safe] GHC.Internal.Read.Read GHC.Internal.Data.Version.Version -- Defined in ‘Data.Version’
    
    12501 12500
     instance GHC.Internal.Read.Read GHC.Internal.Foreign.Ptr.IntPtr -- Defined in ‘GHC.Internal.Foreign.Ptr’
    
    12502 12501
     instance GHC.Internal.Read.Read GHC.Internal.Foreign.Ptr.WordPtr -- Defined in ‘GHC.Internal.Foreign.Ptr’
    
    12503 12502
     instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CBool -- Defined in ‘GHC.Internal.Foreign.C.Types’
    
    ... ... @@ -12526,6 +12525,7 @@ instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CULong -- Defined i
    12526 12525
     instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CUSeconds -- Defined in ‘GHC.Internal.Foreign.C.Types’
    
    12527 12526
     instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’
    
    12528 12527
     instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’
    
    12528
    +instance [safe] GHC.Internal.Read.Read GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.ByteOrder’
    
    12529 12529
     instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Internal.Read.Read (f p), GHC.Internal.Read.Read (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:*:) f g p) -- Defined in ‘GHC.Internal.Generics’
    
    12530 12530
     instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Internal.Read.Read (f p), GHC.Internal.Read.Read (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:+:) f g p) -- Defined in ‘GHC.Internal.Generics’
    
    12531 12531
     instance forall k2 k1 (f :: k2 -> *) (g :: k1 -> k2) (p :: k1). GHC.Internal.Read.Read (f (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:.:) f g p) -- Defined in ‘GHC.Internal.Generics’
    
    ... ... @@ -12540,16 +12540,16 @@ instance GHC.Internal.Read.Read GHC.Internal.Generics.SourceStrictness -- Define
    12540 12540
     instance GHC.Internal.Read.Read GHC.Internal.Generics.SourceUnpackedness -- Defined in ‘GHC.Internal.Generics’
    
    12541 12541
     instance forall k (p :: k). GHC.Internal.Read.Read (GHC.Internal.Generics.U1 p) -- Defined in ‘GHC.Internal.Generics’
    
    12542 12542
     instance forall k (p :: k). GHC.Internal.Read.Read (GHC.Internal.Generics.V1 p) -- Defined in ‘GHC.Internal.Generics’
    
    12543
    -instance GHC.Internal.Read.Read GHC.Internal.IO.Device.SeekMode -- Defined in ‘GHC.Internal.IO.Device’
    
    12544
    -instance GHC.Internal.Read.Read GHC.Internal.IO.Handle.Types.BufferMode -- Defined in ‘GHC.Internal.IO.Handle.Types’
    
    12545
    -instance GHC.Internal.Read.Read GHC.Internal.IO.Handle.Types.Newline -- Defined in ‘GHC.Internal.IO.Handle.Types’
    
    12546
    -instance GHC.Internal.Read.Read GHC.Internal.IO.Handle.Types.NewlineMode -- Defined in ‘GHC.Internal.IO.Handle.Types’
    
    12547
    -instance GHC.Internal.Read.Read GHC.Internal.IO.IOMode.IOMode -- Defined in ‘GHC.Internal.IO.IOMode’
    
    12548 12543
     instance [safe] GHC.Internal.Read.Read GHC.Stats.GCDetails -- Defined in ‘GHC.Stats’
    
    12549 12544
     instance [safe] GHC.Internal.Read.Read GHC.Stats.RTSStats -- Defined in ‘GHC.Stats’
    
    12550 12545
     instance GHC.Internal.Read.Read GHC.Internal.TypeNats.SomeNat -- Defined in ‘GHC.Internal.TypeNats’
    
    12551 12546
     instance GHC.Internal.Read.Read GHC.Internal.TypeLits.SomeChar -- Defined in ‘GHC.Internal.TypeLits’
    
    12552 12547
     instance GHC.Internal.Read.Read GHC.Internal.TypeLits.SomeSymbol -- Defined in ‘GHC.Internal.TypeLits’
    
    12548
    +instance GHC.Internal.Read.Read GHC.Internal.IO.Handle.Types.BufferMode -- Defined in ‘System.IO’
    
    12549
    +instance GHC.Internal.Read.Read GHC.Internal.IO.IOMode.IOMode -- Defined in ‘System.IO’
    
    12550
    +instance GHC.Internal.Read.Read GHC.Internal.IO.Handle.Types.Newline -- Defined in ‘System.IO’
    
    12551
    +instance GHC.Internal.Read.Read GHC.Internal.IO.Handle.Types.NewlineMode -- Defined in ‘System.IO’
    
    12552
    +instance GHC.Internal.Read.Read GHC.Internal.IO.Device.SeekMode -- Defined in ‘System.IO’
    
    12553 12553
     instance forall k a (b :: k). GHC.Internal.Real.Fractional a => GHC.Internal.Real.Fractional (GHC.Internal.Data.Functor.Const.Const a b) -- Defined in ‘GHC.Internal.Data.Functor.Const’
    
    12554 12554
     instance forall a. GHC.Internal.Float.RealFloat a => GHC.Internal.Real.Fractional (Data.Complex.Complex a) -- Defined in ‘Data.Complex’
    
    12555 12555
     instance forall k (a :: k). Data.Fixed.HasResolution a => GHC.Internal.Real.Fractional (Data.Fixed.Fixed a) -- Defined in ‘Data.Fixed’
    

  • testsuite/tests/plugins/plugins09.stdout
    1 1
     parsePlugin(a,b)
    
    2 2
     interfacePlugin: Prelude
    
    3
    +interfacePlugin: System.IO
    
    3 4
     interfacePlugin: GHC.Internal.Base
    
    4 5
     interfacePlugin: GHC.Internal.Data.NonEmpty
    
    5 6
     interfacePlugin: GHC.Internal.Float
    

  • testsuite/tests/plugins/plugins10.stdout
    ... ... @@ -2,6 +2,8 @@ parsePlugin()
    2 2
     interfacePlugin: Prelude
    
    3 3
     interfacePlugin: Language.Haskell.TH
    
    4 4
     interfacePlugin: Language.Haskell.TH.Quote
    
    5
    +interfacePlugin: Data.Version
    
    6
    +interfacePlugin: System.IO
    
    5 7
     interfacePlugin: GHC.Internal.Base
    
    6 8
     interfacePlugin: GHC.Internal.Data.NonEmpty
    
    7 9
     interfacePlugin: GHC.Internal.Float
    

  • testsuite/tests/plugins/plugins11.stdout
    1 1
     parsePlugin()
    
    2 2
     interfacePlugin: Prelude
    
    3
    +interfacePlugin: System.IO
    
    3 4
     interfacePlugin: GHC.Internal.Base
    
    4 5
     interfacePlugin: GHC.Internal.Data.NonEmpty
    
    5 6
     interfacePlugin: GHC.Internal.Float
    

  • testsuite/tests/plugins/static-plugins.stdout
    1 1
     ==pure.0
    
    2 2
     parsePlugin()
    
    3 3
     interfacePlugin: Prelude
    
    4
    +interfacePlugin: System.IO
    
    4 5
     interfacePlugin: GHC.Internal.Base
    
    5 6
     interfacePlugin: GHC.Internal.Data.NonEmpty
    
    6 7
     interfacePlugin: GHC.Internal.Float