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

Commits:

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

  • libraries/base/src/GHC/ByteOrder.hs
    1 1
     {-# LANGUAGE Safe #-}
    
    2 2
     
    
    3
    +{-# LANGUAGE StandaloneDeriving #-}
    
    4
    +
    
    3 5
     -- |
    
    4 6
     --
    
    5 7
     -- Module      :  GHC.ByteOrder
    
    ... ... @@ -19,4 +21,15 @@ module GHC.ByteOrder
    19 21
          targetByteOrder
    
    20 22
          ) where
    
    21 23
     
    
    22
    -import GHC.Internal.ByteOrder
    \ No newline at end of file
    24
    +import GHC.Internal.ByteOrder
    
    25
    +
    
    26
    +import Text.Read
    
    27
    +
    
    28
    +{-NOTE:
    
    29
    +    The following instance is technically an orphan, but practically it is not,
    
    30
    +    since ordinary users should not use @ghc-internal@ directly and thus get
    
    31
    +    'ByteOrder' only through this module.
    
    32
    +-}
    
    33
    +
    
    34
    +-- | @since base-4.11.0.0
    
    35
    +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/System/IO.hs
    1 1
     {-# LANGUAGE Trustworthy #-}
    
    2 2
     {-# LANGUAGE CPP #-}
    
    3
    +{-# LANGUAGE StandaloneDeriving #-}
    
    3 4
     
    
    4 5
     -- |
    
    5 6
     --
    
    ... ... @@ -878,3 +879,24 @@ rw_flags = output_flags .|. o_RDWR
    878 879
     -- output
    
    879 880
     -- > input^D
    
    880 881
     -- output
    
    882
    +
    
    883
    +{-NOTE:
    
    884
    +    The following instances are technically orphans, but practically they are
    
    885
    +    not, since ordinary users should not use @ghc-internal@ directly and thus
    
    886
    +    get the instantiated types only through this module.
    
    887
    +-}
    
    888
    +
    
    889
    +-- | @since base-4.2.0.0
    
    890
    +deriving instance Read IOMode
    
    891
    +
    
    892
    +-- | @since base-4.2.0.0
    
    893
    +deriving instance Read BufferMode
    
    894
    +
    
    895
    +-- | @since base-4.2.0.0
    
    896
    +deriving instance Read SeekMode
    
    897
    +
    
    898
    +-- | @since base-4.3.0.0
    
    899
    +deriving instance Read Newline
    
    900
    +
    
    901
    +-- | @since base-4.3.0.0
    
    902
    +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/ghc-internal/src/GHC/Internal/ByteOrder.hs
    ... ... @@ -28,7 +28,6 @@ module GHC.Internal.ByteOrder
    28 28
     import GHC.Internal.Base
    
    29 29
     import GHC.Internal.Enum
    
    30 30
     import GHC.Internal.Generics (Generic)
    
    31
    -import GHC.Internal.Text.Read
    
    32 31
     import GHC.Internal.Text.Show
    
    33 32
     
    
    34 33
     -- | Byte ordering.
    
    ... ... @@ -39,7 +38,6 @@ data ByteOrder
    39 38
                  , Ord     -- ^ @since base-4.11.0.0
    
    40 39
                  , Bounded -- ^ @since base-4.11.0.0
    
    41 40
                  , Enum    -- ^ @since base-4.11.0.0
    
    42
    -             , Read    -- ^ @since base-4.11.0.0
    
    43 41
                  , Show    -- ^ @since base-4.11.0.0
    
    44 42
                  , Generic -- ^ @since base-4.15.0.0
    
    45 43
                  )
    

  • 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,
    
    ... ... @@ -123,10 +123,8 @@ import GHC.Internal.Data.Version( Version(..) )
    123 123
     import GHC.Internal.Base hiding (Any, IntRep, FloatRep, NonEmpty(..))
    
    124 124
     import GHC.Internal.List
    
    125 125
     import GHC.Internal.Num
    
    126
    -import GHC.Internal.Read
    
    127 126
     import GHC.Internal.Show
    
    128 127
     import GHC.Internal.Tuple (Solo (..))
    
    129
    -import GHC.Internal.Text.Read( reads )
    
    130 128
     
    
    131 129
     -- Imports for the instances
    
    132 130
     import GHC.Internal.Data.Functor.Identity -- So we can give Data instance for Identity
    
    ... ... @@ -682,32 +680,6 @@ showConstr :: Constr -> String
    682 680
     showConstr = constring
    
    683 681
     
    
    684 682
     
    
    685
    --- | Lookup a constructor via a string
    
    686
    -readConstr :: DataType -> String -> Maybe Constr
    
    687
    -readConstr dt str =
    
    688
    -      case dataTypeRep dt of
    
    689
    -        AlgRep cons -> idx cons
    
    690
    -        IntRep      -> mkReadCon (\i -> (mkPrimCon dt str (IntConstr i)))
    
    691
    -        FloatRep    -> mkReadCon ffloat
    
    692
    -        CharRep     -> mkReadCon (\c -> (mkPrimCon dt str (CharConstr c)))
    
    693
    -        NoRep       -> Nothing
    
    694
    -  where
    
    695
    -
    
    696
    -    -- Read a value and build a constructor
    
    697
    -    mkReadCon :: Read t => (t -> Constr) -> Maybe Constr
    
    698
    -    mkReadCon f = case (reads str) of
    
    699
    -                    [(t,"")] -> Just (f t)
    
    700
    -                    _ -> Nothing
    
    701
    -
    
    702
    -    -- Traverse list of algebraic datatype constructors
    
    703
    -    idx :: [Constr] -> Maybe Constr
    
    704
    -    idx cons = case filter ((==) str . showConstr) cons of
    
    705
    -                [] -> Nothing
    
    706
    -                hd : _ -> Just hd
    
    707
    -
    
    708
    -    ffloat :: Double -> Constr
    
    709
    -    ffloat =  mkPrimCon dt str . FloatConstr . toRational
    
    710
    -
    
    711 683
     ------------------------------------------------------------------------------
    
    712 684
     --
    
    713 685
     --      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,18 @@ 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.Data.Functor     ( Functor(..) )
    
    40 39
     import GHC.Internal.Data.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
    -import GHC.Internal.Base             ( Applicative(..), (&&), String )
    
    43
    +import GHC.Internal.Base             ( (&&), String )
    
    45 44
     import GHC.Internal.Generics
    
    46
    -import GHC.Internal.Unicode          ( isDigit, isAlphaNum )
    
    47
    -import GHC.Internal.Read
    
    48 45
     import GHC.Internal.Show
    
    49
    -import GHC.Internal.Text.ParserCombinators.ReadP
    
    50
    -import GHC.Internal.Text.Read        ( read )
    
    51 46
     
    
    52 47
     {- |
    
    53 48
     A 'Version' represents the version of a software entity.
    
    ... ... @@ -69,8 +64,8 @@ operations are the right thing for every 'Version'.
    69 64
     
    
    70 65
     Similarly, concrete representations of versions may differ.  One
    
    71 66
     possible concrete representation is provided (see 'showVersion' and
    
    72
    -'parseVersion'), but depending on the application a different concrete
    
    73
    -representation may be more appropriate.
    
    67
    +'Data.Version.parseVersion'), but depending on the application a
    
    68
    +different concrete representation may be more appropriate.
    
    74 69
     -}
    
    75 70
     data Version =
    
    76 71
       Version { versionBranch :: [Int],
    
    ... ... @@ -92,8 +87,7 @@ data Version =
    92 87
                     -- The interpretation of the list of tags is entirely dependent
    
    93 88
                     -- on the entity that this version applies to.
    
    94 89
             }
    
    95
    -  deriving ( Read    -- ^ @since base-2.01
    
    96
    -           , Show    -- ^ @since base-2.01
    
    90
    +  deriving ( Show    -- ^ @since base-2.01
    
    97 91
                , Generic -- ^ @since base-4.9.0.0
    
    98 92
                )
    
    99 93
     {-# DEPRECATED versionTags "See GHC ticket #2496" #-}
    
    ... ... @@ -121,13 +115,6 @@ showVersion (Version branch tags)
    121 115
       = concat (intersperse "." (map show branch)) ++
    
    122 116
          concatMap ('-':) tags
    
    123 117
     
    
    124
    --- | A parser for versions in the format produced by 'showVersion'.
    
    125
    ---
    
    126
    -parseVersion :: ReadP Version
    
    127
    -parseVersion = do branch <- sepBy1 (fmap read (munch1 isDigit)) (char '.')
    
    128
    -                  tags   <- many (char '-' *> munch1 isAlphaNum)
    
    129
    -                  pure Version{versionBranch=branch, versionTags=tags}
    
    130
    -
    
    131 118
     -- | Construct tag-less 'Version'
    
    132 119
     --
    
    133 120
     -- @since base-4.8.0.0
    

  • libraries/ghc-internal/src/GHC/Internal/IO/Device.hs
    ... ... @@ -31,7 +31,6 @@ import GHC.Internal.Base
    31 31
     import GHC.Internal.Word
    
    32 32
     import GHC.Internal.Arr
    
    33 33
     import GHC.Internal.Enum
    
    34
    -import GHC.Internal.Read
    
    35 34
     import GHC.Internal.Show
    
    36 35
     import GHC.Internal.Ptr
    
    37 36
     import GHC.Internal.Num
    
    ... ... @@ -179,7 +178,6 @@ data SeekMode
    179 178
                  , Ord  -- ^ @since base-4.2.0.0
    
    180 179
                  , Ix   -- ^ @since base-4.2.0.0
    
    181 180
                  , Enum -- ^ @since base-4.2.0.0
    
    182
    -             , Read -- ^ @since base-4.2.0.0
    
    183 181
                  , Show -- ^ @since base-4.2.0.0
    
    184 182
                  )
    
    185 183
     

  • libraries/ghc-internal/src/GHC/Internal/IO/Handle/Types.hs
    ... ... @@ -48,7 +48,6 @@ import GHC.Internal.IO.BufferedIO
    48 48
     import GHC.Internal.IO.Encoding.Types
    
    49 49
     import GHC.Internal.IORef
    
    50 50
     import GHC.Internal.Show
    
    51
    -import GHC.Internal.Read
    
    52 51
     import GHC.Internal.Word
    
    53 52
     import GHC.Internal.IO.Device
    
    54 53
     import GHC.Internal.Data.Typeable
    
    ... ... @@ -270,7 +269,6 @@ data BufferMode
    270 269
                     -- is 'Just' @n@ and is otherwise implementation-dependent.
    
    271 270
        deriving ( Eq   -- ^ @since base-4.2.0.0
    
    272 271
                 , Ord  -- ^ @since base-4.2.0.0
    
    273
    -            , Read -- ^ @since base-4.2.0.0
    
    274 272
                 , Show -- ^ @since base-4.2.0.0
    
    275 273
                 )
    
    276 274
     
    
    ... ... @@ -376,7 +374,6 @@ data Newline = LF -- ^ @\'\\n\'@
    376 374
                  | CRLF  -- ^ @\'\\r\\n\'@
    
    377 375
                  deriving ( Eq   -- ^ @since base-4.2.0.0
    
    378 376
                           , Ord  -- ^ @since base-4.3.0.0
    
    379
    -                      , Read -- ^ @since base-4.3.0.0
    
    380 377
                           , Show -- ^ @since base-4.3.0.0
    
    381 378
                           )
    
    382 379
     
    
    ... ... @@ -393,7 +390,6 @@ data NewlineMode
    393 390
                      }
    
    394 391
                  deriving ( Eq   -- ^ @since base-4.2.0.0
    
    395 392
                           , Ord  -- ^ @since base-4.3.0.0
    
    396
    -                      , Read -- ^ @since base-4.3.0.0
    
    397 393
                           , Show -- ^ @since base-4.3.0.0
    
    398 394
                           )
    
    399 395
     
    

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

  • 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
    
    ... ... @@ -12496,7 +12496,7 @@ instance forall a. GHC.Internal.Read.Read a => GHC.Internal.Read.Read (Data.Semi
    12496 12496
     instance forall a. GHC.Internal.Read.Read a => GHC.Internal.Read.Read (Data.Semigroup.Min a) -- Defined in ‘Data.Semigroup’
    
    12497 12497
     instance forall m. GHC.Internal.Read.Read m => GHC.Internal.Read.Read (Data.Semigroup.WrappedMonoid m) -- Defined in ‘Data.Semigroup’
    
    12498 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’
    
    12499
    -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’
    
    12500 12500
     instance GHC.Internal.Read.Read GHC.Internal.Foreign.Ptr.IntPtr -- Defined in ‘GHC.Internal.Foreign.Ptr’
    
    12501 12501
     instance GHC.Internal.Read.Read GHC.Internal.Foreign.Ptr.WordPtr -- Defined in ‘GHC.Internal.Foreign.Ptr’
    
    12502 12502
     instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CBool -- Defined in ‘GHC.Internal.Foreign.C.Types’
    
    ... ... @@ -12525,7 +12525,7 @@ instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CULong -- Defined i
    12525 12525
     instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CUSeconds -- Defined in ‘GHC.Internal.Foreign.C.Types’
    
    12526 12526
     instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’
    
    12527 12527
     instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’
    
    12528
    -instance GHC.Internal.Read.Read GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’
    
    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 (f :: k2 -> *) k1 (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 a k (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
    
    ... ... @@ -12525,7 +12525,7 @@ instance forall a. GHC.Internal.Read.Read a => GHC.Internal.Read.Read (Data.Semi
    12525 12525
     instance forall a. GHC.Internal.Read.Read a => GHC.Internal.Read.Read (Data.Semigroup.Min a) -- Defined in ‘Data.Semigroup’
    
    12526 12526
     instance forall m. GHC.Internal.Read.Read m => GHC.Internal.Read.Read (Data.Semigroup.WrappedMonoid m) -- Defined in ‘Data.Semigroup’
    
    12527 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’
    
    12528
    -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’
    
    12529 12529
     instance GHC.Internal.Read.Read GHC.Internal.Foreign.Ptr.IntPtr -- Defined in ‘GHC.Internal.Foreign.Ptr’
    
    12530 12530
     instance GHC.Internal.Read.Read GHC.Internal.Foreign.Ptr.WordPtr -- Defined in ‘GHC.Internal.Foreign.Ptr’
    
    12531 12531
     instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CBool -- Defined in ‘GHC.Internal.Foreign.C.Types’
    
    ... ... @@ -12554,7 +12554,7 @@ instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CULong -- Defined i
    12554 12554
     instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CUSeconds -- Defined in ‘GHC.Internal.Foreign.C.Types’
    
    12555 12555
     instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’
    
    12556 12556
     instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’
    
    12557
    -instance GHC.Internal.Read.Read GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’
    
    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 (f :: k2 -> *) k1 (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 a k (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
    
    ... ... @@ -12767,7 +12767,7 @@ instance forall a. GHC.Internal.Read.Read a => GHC.Internal.Read.Read (Data.Semi
    12767 12767
     instance forall a. GHC.Internal.Read.Read a => GHC.Internal.Read.Read (Data.Semigroup.Min a) -- Defined in ‘Data.Semigroup’
    
    12768 12768
     instance forall m. GHC.Internal.Read.Read m => GHC.Internal.Read.Read (Data.Semigroup.WrappedMonoid m) -- Defined in ‘Data.Semigroup’
    
    12769 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’
    
    12770
    -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’
    
    12771 12771
     instance GHC.Internal.Read.Read GHC.Internal.Foreign.Ptr.IntPtr -- Defined in ‘GHC.Internal.Foreign.Ptr’
    
    12772 12772
     instance GHC.Internal.Read.Read GHC.Internal.Foreign.Ptr.WordPtr -- Defined in ‘GHC.Internal.Foreign.Ptr’
    
    12773 12773
     instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CBool -- Defined in ‘GHC.Internal.Foreign.C.Types’
    
    ... ... @@ -12796,7 +12796,7 @@ instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CULong -- Defined i
    12796 12796
     instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CUSeconds -- Defined in ‘GHC.Internal.Foreign.C.Types’
    
    12797 12797
     instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’
    
    12798 12798
     instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’
    
    12799
    -instance GHC.Internal.Read.Read GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’
    
    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 a k (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
    
    ... ... @@ -12496,7 +12496,7 @@ instance forall a. GHC.Internal.Read.Read a => GHC.Internal.Read.Read (Data.Semi
    12496 12496
     instance forall a. GHC.Internal.Read.Read a => GHC.Internal.Read.Read (Data.Semigroup.Min a) -- Defined in ‘Data.Semigroup’
    
    12497 12497
     instance forall m. GHC.Internal.Read.Read m => GHC.Internal.Read.Read (Data.Semigroup.WrappedMonoid m) -- Defined in ‘Data.Semigroup’
    
    12498 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’
    
    12499
    -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’
    
    12500 12500
     instance GHC.Internal.Read.Read GHC.Internal.Foreign.Ptr.IntPtr -- Defined in ‘GHC.Internal.Foreign.Ptr’
    
    12501 12501
     instance GHC.Internal.Read.Read GHC.Internal.Foreign.Ptr.WordPtr -- Defined in ‘GHC.Internal.Foreign.Ptr’
    
    12502 12502
     instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CBool -- Defined in ‘GHC.Internal.Foreign.C.Types’
    
    ... ... @@ -12525,7 +12525,7 @@ instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CULong -- Defined i
    12525 12525
     instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CUSeconds -- Defined in ‘GHC.Internal.Foreign.C.Types’
    
    12526 12526
     instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’
    
    12527 12527
     instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’
    
    12528
    -instance GHC.Internal.Read.Read GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’
    
    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 (f :: k2 -> *) k1 (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 a k (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