Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GHC 9.* integer primitive support #1098

Closed
robdockins opened this issue Mar 4, 2021 · 8 comments
Closed

GHC 9.* integer primitive support #1098

robdockins opened this issue Mar 4, 2021 · 8 comments
Labels
tech-debt For issues that require some internal refactoring.

Comments

@robdockins
Copy link
Contributor

The GHC 9.* series has made some pretty significant internal changes regarding how integer values are represented. Cryptol currently uses some internal support for GMP operations that aren't part of the "stable" Integer API, and we may need to do some work to be able to support these going forward.

From memory, the operations we care about that aren't part of the public API are:

  1. probable prime tests
  2. finite field inverse (inverse mod p)

We also make use of the nonpublic BigNat type internal to the PrimeECC module. This is primarily done to avoid boxing, allocations and small integer code paths related the Integer datatype itself. It provides a modest, but nontrival, improvement to the affected operations.

@RyanGlScott
Copy link
Contributor

It may be a while before we get to the point where cryptol's dependencies officially build with GHC 9.0, but since I was curious, I decided to see what hacks I'd need to apply to cryptol to make it build with GHC 9.0. Surprisingly, only two modules fail to compile outright due to using integer-gmp functions that are no longer present in ghc-bignum, which supersedes integer-gmp starting in 9.0. One of them is Cryptol.PrimeEC:

[ 19 of 103] Compiling Cryptol.PrimeEC  ( src/Cryptol/PrimeEC.hs, interpreted )

src/Cryptol/PrimeEC.hs:155:10: error:
    Not in scope: ‘Integer.isNullBigNat#’
    Perhaps you meant one of these:
      ‘Integer.isValidBigNat#’ (imported from GHC.Integer.GMP.Internals),
      ‘Integer.indexBigNat#’ (imported from GHC.Integer.GMP.Internals),
      ‘Integer.isZeroBigNat’ (imported from GHC.Integer.GMP.Internals)
    Module ‘GHC.Integer.GMP.Internals’ does not export ‘isNullBigNat#’.
    |
155 |     case Integer.isNullBigNat# rmp of
    |          ^^^^^^^^^^^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:193:10: error:
    Not in scope: ‘Integer.isNullBigNat#’
    Perhaps you meant one of these:
      ‘Integer.isValidBigNat#’ (imported from GHC.Integer.GMP.Internals),
      ‘Integer.indexBigNat#’ (imported from GHC.Integer.GMP.Internals),
      ‘Integer.isZeroBigNat’ (imported from GHC.Integer.GMP.Internals)
    Module ‘GHC.Integer.GMP.Internals’ does not export ‘isNullBigNat#’.
    |
193 |     case Integer.isNullBigNat# rmp of
    |          ^^^^^^^^^^^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:336:8: error:
    Not in scope: ‘Integer.recipModBigNat’
    Perhaps you meant one of these:
      ‘Integer.gcdBigNat’ (imported from GHC.Integer.GMP.Internals),
      ‘Integer.remBigNat’ (imported from GHC.Integer.GMP.Internals),
      ‘Integer.zeroBigNat’ (imported from GHC.Integer.GMP.Internals)
    Module ‘GHC.Integer.GMP.Internals’ does not export ‘recipModBigNat’.
    |
336 |   l  = Integer.recipModBigNat z m
    |        ^^^^^^^^^^^^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:444:7: error:
    Not in scope: ‘Integer.recipModBigNat’
    Perhaps you meant one of these:
      ‘Integer.gcdBigNat’ (imported from GHC.Integer.GMP.Internals),
      ‘Integer.remBigNat’ (imported from GHC.Integer.GMP.Internals),
      ‘Integer.zeroBigNat’ (imported from GHC.Integer.GMP.Internals)
    Module ‘GHC.Integer.GMP.Internals’ does not export ‘recipModBigNat’.
    |
444 |   e = Integer.recipModBigNat abcd m
    |       ^^^^^^^^^^^^^^^^^^^^^^

The other is Cryptol.TypeCheck.Solver.Numeric:

[ 73 of 103] Compiling Cryptol.TypeCheck.Solver.Numeric ( src/Cryptol/TypeCheck/Solver/Numeric.hs, interpreted )

src/Cryptol/TypeCheck/Solver/Numeric.hs:83:12: error:
    Not in scope: ‘Integer.testPrimeInteger’
    Perhaps you meant one of these:
      ‘Integer.testBitInteger’ (imported from GHC.Integer.GMP.Internals),
      ‘Integer.timesInteger’ (imported from GHC.Integer.GMP.Internals)
    Module ‘GHC.Integer.GMP.Internals’ does not export ‘testPrimeInteger’.
   |
83 |       case Integer.testPrimeInteger i 25# of
   |            ^^^^^^^^^^^^^^^^^^^^^^^^

So we'll definitely need to figure out what the ghc-bignum equivalents of isNullBigNat#, recipModBigNat, and testPrimeInteger are. Beyond that, there are also a smattering of deprecation warnings that result from using now-outdated functions from integer-gmp:

[  1 of 103] Compiling Cryptol.AES      ( src/Cryptol/AES.hs, interpreted )
[  2 of 103] Compiling Cryptol.Backend.Arch ( src/Cryptol/Backend/Arch.hs, interpreted )
[  3 of 103] Compiling Cryptol.ModuleSystem.Fingerprint ( src/Cryptol/ModuleSystem/Fingerprint.hs, interpreted )
[  4 of 103] Compiling Cryptol.Prelude  ( src/Cryptol/Prelude.hs, interpreted )
[  5 of 103] Compiling Cryptol.SHA      ( src/Cryptol/SHA.hs, interpreted )
[  6 of 103] Compiling Cryptol.Utils.Fixity ( src/Cryptol/Utils/Fixity.hs, interpreted )
[  7 of 103] Compiling Cryptol.Utils.Ident ( src/Cryptol/Utils/Ident.hs, interpreted )
[  8 of 103] Compiling Cryptol.Utils.Logger ( src/Cryptol/Utils/Logger.hs, interpreted )
[  9 of 103] Compiling Cryptol.Utils.Misc ( src/Cryptol/Utils/Misc.hs, interpreted )
[ 10 of 103] Compiling Cryptol.Utils.PP ( src/Cryptol/Utils/PP.hs, interpreted )
[ 11 of 103] Compiling Cryptol.Utils.Debug ( src/Cryptol/Utils/Debug.hs, interpreted )
[ 12 of 103] Compiling Cryptol.TypeCheck.PP ( src/Cryptol/TypeCheck/PP.hs, interpreted )
[ 13 of 103] Compiling Cryptol.Parser.Selector ( src/Cryptol/Parser/Selector.hs, interpreted )
[ 14 of 103] Compiling Cryptol.Parser.Position ( src/Cryptol/Parser/Position.hs, interpreted )
[ 15 of 103] Compiling Cryptol.Utils.Panic ( src/Cryptol/Utils/Panic.hs, interpreted )
[ 16 of 103] Compiling Cryptol.TypeCheck.Solver.InfNat ( src/Cryptol/TypeCheck/Solver/InfNat.hs, interpreted )
[ 17 of 103] Compiling Cryptol.F2       ( src/Cryptol/F2.hs, interpreted )
[ 18 of 103] Compiling Cryptol.REPL.Trie ( src/Cryptol/REPL/Trie.hs, interpreted )
[ 19 of 103] Compiling Cryptol.PrimeEC  ( src/Cryptol/PrimeEC.hs, interpreted )

src/Cryptol/PrimeEC.hs:59:23: warning: [-Wdeprecations]
    In the use of ‘oneBigNat’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use bigNatOne instead"
   |
59 | zro = ProjectivePoint Integer.oneBigNat Integer.oneBigNat Integer.zeroBigNat
   |                       ^^^^^^^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:59:41: warning: [-Wdeprecations]
    In the use of ‘oneBigNat’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use bigNatOne instead"
   |
59 | zro = ProjectivePoint Integer.oneBigNat Integer.oneBigNat Integer.zeroBigNat
   |                                         ^^^^^^^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:59:59: warning: [-Wdeprecations]
    In the use of ‘zeroBigNat’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use bigNatZero instead"
   |
59 | zro = ProjectivePoint Integer.oneBigNat Integer.oneBigNat Integer.zeroBigNat
   |                                                           ^^^^^^^^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:64:18: warning: [-Wdeprecations]
    In the use of data constructor ‘S#’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use IS constructor instead"
   |
64 | integerToBigNat (Integer.S# i)  = Integer.wordToBigNat (int2Word# i)
   |                  ^^^^^^^^^^

src/Cryptol/PrimeEC.hs:65:18: warning: [-Wdeprecations]
    In the use of data constructor ‘Jp#’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use IP constructor instead"
   |
65 | integerToBigNat (Integer.Jp# b) = b
   |                  ^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:66:18: warning: [-Wdeprecations]
    In the use of data constructor ‘Jn#’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use IN constructor instead"
   |
66 | integerToBigNat (Integer.Jn# b) = b
   |                  ^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:158:13: warning: [-Wdeprecations]
    In the use of ‘plusBigNat’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use bigNatAdd instead"
    |
158 |   where r = Integer.plusBigNat x y
    |             ^^^^^^^^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:159:15: warning: [-Wdeprecations]
    In the use of ‘minusBigNat’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use bigNatSub instead"
    |
159 |         rmp = Integer.minusBigNat r (primeMod p)
    |               ^^^^^^^^^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:166:20: warning: [-Wdeprecations]
    In the use of ‘testBitBigNat’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use bigNatTestBit# instead"
    |
166 | mod_half p !x = if Integer.testBitBigNat x 0# then qodd else qeven
    |                    ^^^^^^^^^^^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:168:12: warning: [-Wdeprecations]
    In the use of ‘plusBigNat’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use bigNatAdd instead"
    |
168 |   qodd  = (Integer.plusBigNat x (primeMod p)) `Integer.shiftRBigNat` 1#
    |            ^^^^^^^^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:168:47: warning: [-Wdeprecations]
    In the use of ‘shiftRBigNat’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use bigNatShiftR# instead"
    |
168 |   qodd  = (Integer.plusBigNat x (primeMod p)) `Integer.shiftRBigNat` 1#
    |                                               ^^^^^^^^^^^^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:169:13: warning: [-Wdeprecations]
    In the use of ‘shiftRBigNat’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use bigNatShiftR# instead"
    |
169 |   qeven = x `Integer.shiftRBigNat` 1#
    |             ^^^^^^^^^^^^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:175:20: warning: [-Wdeprecations]
    In the use of ‘timesBigNat’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use bigNatMul instead"
    |
175 | mod_mul p !x !y = (Integer.timesBigNat x y) `Integer.remBigNat` (primeMod p)
    |                    ^^^^^^^^^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:175:45: warning: [-Wdeprecations]
    In the use of ‘remBigNat’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use bigNatRem instead"
    |
175 | mod_mul p !x !y = (Integer.timesBigNat x y) `Integer.remBigNat` (primeMod p)
    |                                             ^^^^^^^^^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:180:32: warning: [-Wdeprecations]
    In the use of ‘minusBigNat’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use bigNatSub instead"
    |
180 | mod_sub p !x !y = mod_add p x (Integer.minusBigNat (primeMod p) y)
    |                                ^^^^^^^^^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:186:19: warning: [-Wdeprecations]
    In the use of ‘sqrBigNat’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use bigNatSqr instead"
    |
186 | mod_square p !x = Integer.sqrBigNat x `Integer.remBigNat` primeMod p
    |                   ^^^^^^^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:186:39: warning: [-Wdeprecations]
    In the use of ‘remBigNat’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use bigNatRem instead"
    |
186 | mod_square p !x = Integer.sqrBigNat x `Integer.remBigNat` primeMod p
    |                                       ^^^^^^^^^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:197:10: warning: [-Wdeprecations]
    In the use of ‘shiftLBigNat’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use bigNatShiftL# instead"
    |
197 |    r = x `Integer.shiftLBigNat` 1#
    |          ^^^^^^^^^^^^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:198:10: warning: [-Wdeprecations]
    In the use of ‘minusBigNat’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use bigNatSub instead"
    |
198 |    rmp = Integer.minusBigNat r (primeMod p)
    |          ^^^^^^^^^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:228:8: warning: [-Wdeprecations]
    In the use of ‘isZeroBigNat’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use bigNatIsZero instead"
    |
228 |     if Integer.isZeroBigNat sz then zro else ProjectivePoint r18 r23 r13
    |        ^^^^^^^^^^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:253:5: warning: [-Wdeprecations]
    In the use of ‘isZeroBigNat’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use bigNatIsZero instead"
    |
253 |   | Integer.isZeroBigNat (pz s) = t
    |     ^^^^^^^^^^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:254:5: warning: [-Wdeprecations]
    In the use of ‘isZeroBigNat’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use bigNatIsZero instead"
    |
254 |   | Integer.isZeroBigNat (pz t) = s
    |     ^^^^^^^^^^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:263:21: warning: [-Wdeprecations]
    In the use of ‘minusBigNat’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use bigNatSub instead"
    |
263 |   where u = t{ py = Integer.minusBigNat (primeMod p) (py t) }
    |                     ^^^^^^^^^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:268:25: warning: [-Wdeprecations]
    In the use of ‘minusBigNat’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use bigNatSub instead"
    |
268 | ec_negate p s = s{ py = Integer.minusBigNat (primeMod p) (py s) }
    |                         ^^^^^^^^^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:283:8: warning: [-Wdeprecations]
    In the use of ‘isZeroBigNat’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use bigNatIsZero instead"
    |
283 |     if Integer.isZeroBigNat r13 then
    |        ^^^^^^^^^^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:284:10: warning: [-Wdeprecations]
    In the use of ‘isZeroBigNat’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use bigNatIsZero instead"
    |
284 |       if Integer.isZeroBigNat r14 then
    |          ^^^^^^^^^^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:292:17: warning: [-Wdeprecations]
    In the use of ‘eqBigNat’ (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use bigNatEq instead"
    |
292 |   tNormalized = Integer.eqBigNat tz Integer.oneBigNat
    |                 ^^^^^^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:292:37: warning: [-Wdeprecations]
    In the use of ‘oneBigNat’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use bigNatOne instead"
    |
292 |   tNormalized = Integer.eqBigNat tz Integer.oneBigNat
    |                                     ^^^^^^^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:331:5: warning: [-Wdeprecations]
    In the use of ‘eqBigNat’ (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use bigNatEq instead"
    |
331 |   | Integer.eqBigNat z Integer.oneBigNat = s
    |     ^^^^^^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:331:24: warning: [-Wdeprecations]
    In the use of ‘oneBigNat’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use bigNatOne instead"
    |
331 |   | Integer.eqBigNat z Integer.oneBigNat = s
    |                        ^^^^^^^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:332:39: warning: [-Wdeprecations]
    In the use of ‘oneBigNat’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use bigNatOne instead"
    |
332 |   | otherwise = ProjectivePoint x' y' Integer.oneBigNat
    |                                       ^^^^^^^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:337:8: warning: [-Wdeprecations]
    In the use of ‘sqrBigNat’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use bigNatSqr instead"
    |
337 |   l2 = Integer.sqrBigNat l
    |        ^^^^^^^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:338:8: warning: [-Wdeprecations]
    In the use of ‘timesBigNat’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use bigNatMul instead"
    |
338 |   l3 = Integer.timesBigNat l l2
    |        ^^^^^^^^^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:340:9: warning: [-Wdeprecations]
    In the use of ‘timesBigNat’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use bigNatMul instead"
    |
340 |   x' = (Integer.timesBigNat x l2) `Integer.remBigNat` m
    |         ^^^^^^^^^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:340:35: warning: [-Wdeprecations]
    In the use of ‘remBigNat’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use bigNatRem instead"
    |
340 |   x' = (Integer.timesBigNat x l2) `Integer.remBigNat` m
    |                                   ^^^^^^^^^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:341:9: warning: [-Wdeprecations]
    In the use of ‘timesBigNat’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use bigNatMul instead"
    |
341 |   y' = (Integer.timesBigNat y l3) `Integer.remBigNat` m
    |         ^^^^^^^^^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:341:35: warning: [-Wdeprecations]
    In the use of ‘remBigNat’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use bigNatRem instead"
    |
341 |   y' = (Integer.timesBigNat y l3) `Integer.remBigNat` m
    |                                   ^^^^^^^^^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:351:5: warning: [-Wdeprecations]
    In the use of ‘isZeroBigNat’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use bigNatIsZero instead"
    |
351 |   | Integer.isZeroBigNat (pz s) = zro
    |     ^^^^^^^^^^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:354:59: warning: [-Wdeprecations]
    In the use of ‘bigNatToInteger’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use integerFromBigNat# instead"
    |
354 |         0# -> panic "ec_mult" ["modulus too large", show (Integer.bigNatToInteger (primeMod p))]
    |                                                           ^^^^^^^^^^^^^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:365:10: warning: [-Wdeprecations]
    In the use of data constructor ‘S#’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use IS constructor instead"
    |
365 |          Integer.S# mint -> mint
    |          ^^^^^^^^^^

src/Cryptol/PrimeEC.hs:373:13: warning: [-Wdeprecations]
    In the use of ‘testBitBigNat’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use bigNatTestBit# instead"
    |
373 |       h_i = Integer.testBitBigNat h' i
    |             ^^^^^^^^^^^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:374:13: warning: [-Wdeprecations]
    In the use of ‘testBitBigNat’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use bigNatTestBit# instead"
    |
374 |       d_i = Integer.testBitBigNat d' i
    |             ^^^^^^^^^^^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:398:6: warning: [-Wdeprecations]
    In the use of ‘isZeroBigNat’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use bigNatIsZero instead"
    |
398 |    | Integer.isZeroBigNat a && Integer.isZeroBigNat b =
    |      ^^^^^^^^^^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:398:32: warning: [-Wdeprecations]
    In the use of ‘isZeroBigNat’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use bigNatIsZero instead"
    |
398 |    | Integer.isZeroBigNat a && Integer.isZeroBigNat b =
    |                                ^^^^^^^^^^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:402:6: warning: [-Wdeprecations]
    In the use of ‘isZeroBigNat’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use bigNatIsZero instead"
    |
402 |    | Integer.isZeroBigNat a =
    |      ^^^^^^^^^^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:407:6: warning: [-Wdeprecations]
    In the use of ‘isZeroBigNat’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use bigNatIsZero instead"
    |
407 |    | Integer.isZeroBigNat b =
    |      ^^^^^^^^^^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:412:6: warning: [-Wdeprecations]
    In the use of ‘isZeroBigNat’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use bigNatIsZero instead"
    |
412 |    | Integer.isZeroBigNat c =
    |      ^^^^^^^^^^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:417:6: warning: [-Wdeprecations]
    In the use of ‘isZeroBigNat’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use bigNatIsZero instead"
    |
417 |    | Integer.isZeroBigNat d =
    |      ^^^^^^^^^^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:463:78: warning: [-Wdeprecations]
    In the use of ‘oneBigNat’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use bigNatOne instead"
    |
463 |   s'   = ProjectivePoint (mod_mul p (px s) a_inv2) (mod_mul p (py s) a_inv3) Integer.oneBigNat
    |                                                                              ^^^^^^^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:464:78: warning: [-Wdeprecations]
    In the use of ‘oneBigNat’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use bigNatOne instead"
    |
464 |   t'   = ProjectivePoint (mod_mul p (px t) b_inv2) (mod_mul p (py t) b_inv3) Integer.oneBigNat
    |                                                                              ^^^^^^^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:466:82: warning: [-Wdeprecations]
    In the use of ‘oneBigNat’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use bigNatOne instead"
    |
466 |   spt' = ProjectivePoint (mod_mul p (px spt) c_inv2) (mod_mul p (py spt) c_inv3) Integer.oneBigNat
    |                                                                                  ^^^^^^^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:467:82: warning: [-Wdeprecations]
    In the use of ‘oneBigNat’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use bigNatOne instead"
    |
467 |   smt' = ProjectivePoint (mod_mul p (px smt) d_inv2) (mod_mul p (py smt) d_inv3) Integer.oneBigNat
    |                                                                                  ^^^^^^^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:482:61: warning: [-Wdeprecations]
    In the use of ‘bigNatToInteger’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use integerFromBigNat# instead"
    |
482 |      0# -> panic "ec_twin_mult" ["modulus too large", show (Integer.bigNatToInteger (primeMod p))]
    |                                                             ^^^^^^^^^^^^^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:488:33: warning: [-Wdeprecations]
    In the use of ‘bigNatToInteger’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use integerFromBigNat# instead"
    |
488 |   m = case max 4 (widthInteger (Integer.bigNatToInteger (primeMod p))) of
    |                                 ^^^^^^^^^^^^^^^^^^^^^^^

src/Cryptol/PrimeEC.hs:489:9: warning: [-Wdeprecations]
    In the use of data constructor ‘S#’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use IS constructor instead"
    |
489 |         Integer.S# mint -> mint
    |         ^^^^^^^^^^

src/Cryptol/PrimeEC.hs:496:31: warning: [-Wdeprecations]
    In the use of ‘testBitBigNat’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use bigNatTestBit# instead"
    |
496 |     | tagToEnum# (i >=# 0#) = Integer.testBitBigNat x i
    |                               ^^^^^^^^^^^^^^^^^^^^^
[ 20 of 103] Compiling Cryptol.Parser.Unlit ( src/Cryptol/Parser/Unlit.hs, interpreted )
[ 21 of 103] Compiling Cryptol.Parser.Name ( src/Cryptol/Parser/Name.hs, interpreted )
[ 22 of 103] Compiling Cryptol.Parser.LexerUtils ( src/Cryptol/Parser/LexerUtils.hs, interpreted )
[ 23 of 103] Compiling Cryptol.Parser.Lexer ( /home/rscott/Documents/Hacking/Haskell/cryptol/dist-newstyle/build/x86_64-linux/ghc-9.0.1/cryptol-2.10.0.99/build/Cryptol/Parser/Lexer.hs, interpreted )
[ 24 of 103] Compiling Cryptol.ModuleSystem.Name ( src/Cryptol/ModuleSystem/Name.hs, interpreted )
[ 25 of 103] Compiling Cryptol.TypeCheck.TCon ( src/Cryptol/TypeCheck/TCon.hs, interpreted )
[ 26 of 103] Compiling Cryptol.Utils.Patterns ( src/Cryptol/Utils/Patterns.hs, interpreted )
[ 27 of 103] Compiling Cryptol.Utils.RecordMap ( src/Cryptol/Utils/RecordMap.hs, interpreted )
[ 28 of 103] Compiling Cryptol.TypeCheck.Type ( src/Cryptol/TypeCheck/Type.hs, interpreted )
[ 29 of 103] Compiling Cryptol.TypeCheck.TypePat ( src/Cryptol/TypeCheck/TypePat.hs, interpreted )
[ 30 of 103] Compiling Cryptol.TypeCheck.SimpType ( src/Cryptol/TypeCheck/SimpType.hs, interpreted )
[ 31 of 103] Compiling Cryptol.Parser.AST ( src/Cryptol/Parser/AST.hs, interpreted )
[ 32 of 103] Compiling Cryptol.Parser.Utils ( src/Cryptol/Parser/Utils.hs, interpreted )
[ 33 of 103] Compiling Cryptol.Parser.ParserUtils ( src/Cryptol/Parser/ParserUtils.hs, interpreted )
[ 34 of 103] Compiling Cryptol.Parser.Names ( src/Cryptol/Parser/Names.hs, interpreted )
[ 35 of 103] Compiling Cryptol.Parser.NoPat ( src/Cryptol/Parser/NoPat.hs, interpreted )
[ 36 of 103] Compiling Cryptol.ModuleSystem.Exports ( src/Cryptol/ModuleSystem/Exports.hs, interpreted )
[ 37 of 103] Compiling Cryptol.TypeCheck.AST ( src/Cryptol/TypeCheck/AST.hs, interpreted )
[ 38 of 103] Compiling Cryptol.TypeCheck.TypeMap ( src/Cryptol/TypeCheck/TypeMap.hs, interpreted )
[ 39 of 103] Compiling Cryptol.TypeCheck.Solver.Utils ( src/Cryptol/TypeCheck/Solver/Utils.hs, interpreted )
[ 40 of 103] Compiling Cryptol.TypeCheck.Solver.Numeric.Interval ( src/Cryptol/TypeCheck/Solver/Numeric/Interval.hs, interpreted )
[ 41 of 103] Compiling Cryptol.TypeCheck.Solver.Types ( src/Cryptol/TypeCheck/Solver/Types.hs, interpreted )
[ 42 of 103] Compiling Cryptol.TypeCheck.Solver.Class ( src/Cryptol/TypeCheck/Solver/Class.hs, interpreted )
[ 43 of 103] Compiling Cryptol.TypeCheck.Solver.Numeric.Fin ( src/Cryptol/TypeCheck/Solver/Numeric/Fin.hs, interpreted )
[ 44 of 103] Compiling Cryptol.TypeCheck.Solver.Numeric ( src/Cryptol/TypeCheck/Solver/Numeric.hs, interpreted )

src/Cryptol/TypeCheck/Solver/Numeric.hs:12:1: warning: [-Wunused-imports]
    The qualified import of ‘GHC.Integer.GMP.Internals’ is redundant
      except perhaps to import instances from ‘GHC.Integer.GMP.Internals’
    To import instances alone, use: import GHC.Integer.GMP.Internals()
   |
12 | import qualified GHC.Integer.GMP.Internals as Integer
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[ 45 of 103] Compiling Cryptol.TypeCheck.SimpleSolver ( src/Cryptol/TypeCheck/SimpleSolver.hs, interpreted )

src/Cryptol/TypeCheck/SimpleSolver.hs:37:7: warning: [-Woverlapping-patterns]
    Pattern match is redundant
    In an equation for ‘dbg’: dbg msg x | False = ...
   |
37 |     | False     = ppTrace msg x
   |       ^^^^^
[ 46 of 103] Compiling Cryptol.TypeCheck.Subst ( src/Cryptol/TypeCheck/Subst.hs, interpreted )
[ 47 of 103] Compiling Cryptol.TypeCheck.Unify ( src/Cryptol/TypeCheck/Unify.hs, interpreted )
[ 48 of 103] Compiling Cryptol.TypeCheck.TypeOf ( src/Cryptol/TypeCheck/TypeOf.hs, interpreted )
[ 49 of 103] Compiling Cryptol.TypeCheck.Solver.Improve ( src/Cryptol/TypeCheck/Solver/Improve.hs, interpreted )
[ 50 of 103] Compiling Cryptol.TypeCheck.Parseable ( src/Cryptol/TypeCheck/Parseable.hs, interpreted )
[ 51 of 103] Compiling Cryptol.TypeCheck.InferTypes ( src/Cryptol/TypeCheck/InferTypes.hs, interpreted )
[ 52 of 103] Compiling Cryptol.TypeCheck.Solver.SMT ( src/Cryptol/TypeCheck/Solver/SMT.hs, interpreted )
[ 53 of 103] Compiling Cryptol.TypeCheck.Error ( src/Cryptol/TypeCheck/Error.hs, interpreted )
[ 54 of 103] Compiling Cryptol.TypeCheck.Monad ( src/Cryptol/TypeCheck/Monad.hs, interpreted )
[ 55 of 103] Compiling Cryptol.TypeCheck.Solver.Selector ( src/Cryptol/TypeCheck/Solver/Selector.hs, interpreted )
[ 56 of 103] Compiling Cryptol.TypeCheck.Sanity ( src/Cryptol/TypeCheck/Sanity.hs, interpreted )
[ 57 of 103] Compiling Cryptol.TypeCheck.Depends ( src/Cryptol/TypeCheck/Depends.hs, interpreted )
[ 58 of 103] Compiling Cryptol.TypeCheck.Default ( src/Cryptol/TypeCheck/Default.hs, interpreted )
[ 59 of 103] Compiling Cryptol.TypeCheck.Solve ( src/Cryptol/TypeCheck/Solve.hs, interpreted )
[ 60 of 103] Compiling Cryptol.TypeCheck.Kind ( src/Cryptol/TypeCheck/Kind.hs, interpreted )
[ 61 of 103] Compiling Cryptol.TypeCheck.Instantiate ( src/Cryptol/TypeCheck/Instantiate.hs, interpreted )
[ 62 of 103] Compiling Cryptol.TypeCheck.Infer ( src/Cryptol/TypeCheck/Infer.hs, interpreted )
[ 63 of 103] Compiling Cryptol.Transform.MonoValues ( src/Cryptol/Transform/MonoValues.hs, interpreted )
[ 64 of 103] Compiling Cryptol.Transform.AddModParams ( src/Cryptol/Transform/AddModParams.hs, interpreted )
[ 65 of 103] Compiling Cryptol.ModuleSystem.Interface ( src/Cryptol/ModuleSystem/Interface.hs, interpreted )
[ 66 of 103] Compiling Cryptol.ModuleSystem.NamingEnv ( src/Cryptol/ModuleSystem/NamingEnv.hs, interpreted )
[ 67 of 103] Compiling Cryptol.ModuleSystem.InstantiateModule ( src/Cryptol/ModuleSystem/InstantiateModule.hs, interpreted )
[ 68 of 103] Compiling Cryptol.TypeCheck.CheckModuleInstance ( src/Cryptol/TypeCheck/CheckModuleInstance.hs, interpreted )
[ 69 of 103] Compiling Cryptol.TypeCheck ( src/Cryptol/TypeCheck.hs, interpreted )
[ 70 of 103] Compiling Cryptol.Backend.Monad ( src/Cryptol/Backend/Monad.hs, interpreted )
[ 71 of 103] Compiling Cryptol.Backend.FloatHelpers ( src/Cryptol/Backend/FloatHelpers.hs, interpreted )
[ 72 of 103] Compiling Cryptol.Backend  ( src/Cryptol/Backend.hs, interpreted )
[ 73 of 103] Compiling Cryptol.Backend.What4 ( src/Cryptol/Backend/What4.hs, interpreted )

src/Cryptol/Backend/What4.hs:664:13: warning: [-Wdeprecations]
    In the use of ‘recipModInteger’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use integerRecipMod# instead"
    |
664 |   = let r = Integer.recipModInteger xi m
    |             ^^^^^^^^^^^^^^^^^^^^^^^
[ 74 of 103] Compiling Cryptol.Backend.Concrete ( src/Cryptol/Backend/Concrete.hs, interpreted )

src/Cryptol/Backend/Concrete.hs:320:10: warning: [-Wdeprecations]
    In the use of ‘recipModInteger’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use integerRecipMod# instead"
    |
320 |      r = Integer.recipModInteger x m
    |          ^^^^^^^^^^^^^^^^^^^^^^^
[ 75 of 103] Compiling Cryptol.Backend.SBV ( src/Cryptol/Backend/SBV.hs, interpreted )

src/Cryptol/Backend/SBV.hs:423:13: warning: [-Wdeprecations]
    In the use of ‘recipModInteger’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use integerRecipMod# instead"
    |
423 |   = let r = Integer.recipModInteger xi m
    |             ^^^^^^^^^^^^^^^^^^^^^^^
[ 76 of 103] Compiling Cryptol.ModuleSystem.Renamer ( src/Cryptol/ModuleSystem/Renamer.hs, interpreted )
[ 77 of 103] Compiling Cryptol.IR.FreeVars ( src/Cryptol/IR/FreeVars.hs, interpreted )
[ 78 of 103] Compiling Cryptol.Eval.Type ( src/Cryptol/Eval/Type.hs, interpreted )
[ 79 of 103] Compiling Cryptol.Eval.Value ( src/Cryptol/Eval/Value.hs, interpreted )
[ 80 of 103] Compiling Cryptol.Testing.Random ( src/Cryptol/Testing/Random.hs, interpreted )
[ 81 of 103] Compiling Cryptol.Eval.Prims ( src/Cryptol/Eval/Prims.hs, interpreted )
[ 82 of 103] Compiling Cryptol.Eval.Env ( src/Cryptol/Eval/Env.hs, interpreted )
[ 83 of 103] Compiling Cryptol.Eval.Generic ( src/Cryptol/Eval/Generic.hs, interpreted )
[ 84 of 103] Compiling Cryptol.Eval.What4 ( src/Cryptol/Eval/What4.hs, interpreted )
[ 85 of 103] Compiling Cryptol.Eval.SBV ( src/Cryptol/Eval/SBV.hs, interpreted )
[ 86 of 103] Compiling Cryptol.Eval.Concrete ( src/Cryptol/Eval/Concrete.hs, interpreted )

src/Cryptol/Eval/Concrete.hs:273:26: warning: [-Wdeprecations]
    In the use of ‘bigNatToInteger’
    (imported from Cryptol.PrimeEC, but defined in GHC.Integer.GMP.Internals):
    Deprecated: "Use integerFromBigNat# instead"
    |
273 |    f i = pure (VInteger (PrimeEC.bigNatToInteger i))
    |                          ^^^^^^^^^^^^^^^^^^^^^^^
[ 87 of 103] Compiling Cryptol.Symbolic ( src/Cryptol/Symbolic.hs, interpreted )
[ 88 of 103] Compiling Cryptol.Eval     ( src/Cryptol/Eval.hs, interpreted )
[ 89 of 103] Compiling Cryptol.ModuleSystem.Env ( src/Cryptol/ModuleSystem/Env.hs, interpreted )
[ 90 of 103] Compiling GitRev           ( src/GitRev.hs, interpreted )
[ 91 of 103] Compiling Paths_cryptol    ( /home/rscott/Documents/Hacking/Haskell/cryptol/dist-newstyle/build/x86_64-linux/ghc-9.0.1/cryptol-2.10.0.99/build/autogen/Paths_cryptol.hs, interpreted )
[ 92 of 103] Compiling Cryptol.Version  ( src/Cryptol/Version.hs, interpreted )
[ 93 of 103] Compiling Cryptol.Parser   ( /home/rscott/Documents/Hacking/Haskell/cryptol/dist-newstyle/build/x86_64-linux/ghc-9.0.1/cryptol-2.10.0.99/build/Cryptol/Parser.hs, interpreted )
[ 94 of 103] Compiling Cryptol.Parser.NoInclude ( src/Cryptol/Parser/NoInclude.hs, interpreted )
[ 95 of 103] Compiling Cryptol.ModuleSystem.Monad ( src/Cryptol/ModuleSystem/Monad.hs, interpreted )
[ 96 of 103] Compiling Cryptol.ModuleSystem.Base ( src/Cryptol/ModuleSystem/Base.hs, interpreted )
[ 97 of 103] Compiling Cryptol.ModuleSystem ( src/Cryptol/ModuleSystem.hs, interpreted )
[ 98 of 103] Compiling Cryptol.Transform.Specialize ( src/Cryptol/Transform/Specialize.hs, interpreted )
[ 99 of 103] Compiling Cryptol.Symbolic.What4 ( src/Cryptol/Symbolic/What4.hs, interpreted )
[100 of 103] Compiling Cryptol.Symbolic.SBV ( src/Cryptol/Symbolic/SBV.hs, interpreted )
[101 of 103] Compiling Cryptol.REPL.Monad ( src/Cryptol/REPL/Monad.hs, interpreted )
[102 of 103] Compiling Cryptol.Eval.Reference ( src/Cryptol/Eval/Reference.lhs, interpreted )

src/Cryptol/Eval/Reference.lhs:1276:16: warning: [-Wdeprecations]
    In the use of ‘recipModInteger’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use integerRecipMod# instead"
     |
1276 | >    where r = Integer.recipModInteger x m
     |                ^^^^^^^^^^^^^^^^^^^^^^^
[103 of 103] Compiling Cryptol.REPL.Command ( src/Cryptol/REPL/Command.hs, interpreted )

@robdockins
Copy link
Contributor Author

Are Cryptol's dependencies in a good enough shape that we should start thinking about this again?

@RyanGlScott
Copy link
Contributor

RyanGlScott commented Jun 10, 2021

The dependencies which are not 9.0-ready are, by my count:

All of these can be worked around with --allow-newer=XYZ:base, however.

@RyanGlScott
Copy link
Contributor

It's also worth noting that many of the alternatives that GHC recommends in #1098 (comment) don't have quite the same types. For example, plusBigNat :: BigNat -> BigNat -> BigNat is now deprecated in favor of bigNatAdd :: BigNat# -> BigNat# -> BigNat#, where BigNat# is the unboxed payload of a BigNat. As a result, we'll likely need to think carefully about what we want the compatibility shim to look like, as ghc-bignum favors unboxed types more often than integer-gmp does.

@robdockins robdockins self-assigned this Jun 16, 2021
@robdockins robdockins added the tech-debt For issues that require some internal refactoring. label Jul 14, 2021
@robdockins
Copy link
Contributor Author

CF #1233

We seem blocked on https://gitlab.haskell.org/ghc/ghc/-/issues/19645. A fix for this bug is merged into the branch for 9.0.2, but there is currently no timeline set for the release.

@robdockins robdockins removed their assignment Jul 21, 2021
@robdockins
Copy link
Contributor Author

GHC 9.2.1 dropped today. https://www.haskell.org/ghc/blog/20211029-ghc-9.2.1-released.html

Still no word on a timeline for 9.0.2, so we may just have to leapfrog that release sequence for now.

@RyanGlScott
Copy link
Contributor

FWIW, the GHC release manager expects to release GHC 9.0.2 within the coming week: https://old.reddit.com/r/haskell/comments/qif499/announce_ghc_921_released/hin31o5/

@RyanGlScott
Copy link
Contributor

Fixed in #1233.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tech-debt For issues that require some internal refactoring.
Projects
None yet
Development

No branches or pull requests

2 participants