well-typed / cborg

Binary serialisation in the CBOR format
https://hackage.haskell.org/package/cborg
191 stars 86 forks source link

Support ghc-9.0.1. Bump upper bounds #257

Closed newhoggy closed 3 years ago

sjakobi commented 3 years ago

Do you plan on addressing the various deprecation warnings?

src/Codec/CBOR/Read.hs:14:16: warning:
    -funfolding-keeness-factor=2.0 is deprecated: -funfolding-keeness-factor is no longer respected as of GHC 8.12
   |
14 | {-# OPTIONS_GHC -funfolding-keeness-factor=2.0 #-}
   |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

https://github.com/well-typed/cborg/blob/471fc1de93e5abf928dd4a607eaa6c92f526fe8a/cborg/src/Codec/CBOR/Read.hs#L12-L14

I'm not sure how to replace this – possibly with -funfolding-use-threshold?! (I've opened https://gitlab.haskell.org/ghc/ghc/-/issues/19446 for advice on this.)


src/Codec/CBOR/Magic.hs:480:14: warning: [-Wdeprecations]
    In the use of ‘importIntegerFromAddr’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use integerFromAddr# instead"
    |
480 |           in Gmp.importIntegerFromAddr addrOff# (int2Word# len#) 1#
    |              ^^^^^^^^^^^^^^^^^^^^^^^^^

src/Codec/CBOR/Write.hs:132:22: warning: [-Wdeprecations]
    In the use of data constructor ‘S#’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use IS constructor instead"
    |
132 |           TkInteger (Gmp.S# i) vs' -> PI.runB intMP (I# i) op >>= go vs'
    |                      ^^^^^^

src/Codec/CBOR/Write.hs:134:30: warning: [-Wdeprecations]
    In the use of data constructor ‘Jp#’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use IP constructor instead"
    |
134 |           TkInteger integer@(Gmp.Jp# bigNat) vs'
    |                              ^^^^^^^

src/Codec/CBOR/Write.hs:142:30: warning: [-Wdeprecations]
    In the use of data constructor ‘Jn#’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use IN constructor instead"
    |
142 |           TkInteger integer@(Gmp.Jn# bigNat) vs'
    |                              ^^^^^^^

src/Codec/CBOR/Write.hs:591:23: warning: [-Wdeprecations]
    In the use of ‘minusBigNatWord’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use bigNatSubWord# instead"
    |
591 |   <> bigNatToBuilder (Gmp.minusBigNatWord n (int2Word# 1#))
    |                       ^^^^^^^^^^^^^^^^^^^

src/Codec/CBOR/Write.hs:598:22: warning: [-Wdeprecations]
    In the use of ‘sizeInBaseBigNat’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use bigNatSizeInBase# instead"
    |
598 |         let sizeW# = Gmp.sizeInBaseBigNat bigNat 256#
    |                      ^^^^^^^^^^^^^^^^^^^^

src/Codec/CBOR/Write.hs:610:26: warning: [-Wdeprecations]
    In the use of ‘exportBigNatToAddr’
    (imported from GHC.Integer.GMP.Internals):
    Deprecated: "Use bigNatToAddr# instead"
    |
610 |         (W# written#) <- Gmp.exportBigNatToAddr bigNat addr# 1#
    |                          ^^^^^^^^^^^^^^^^^^^^^^

src/Codec/Serialise/Class.hs:534:36: warning: [-Wdeprecations]
    In the use of type constructor or class ‘Option’
    (imported from Data.Semigroup):
    Deprecated: "will be removed in GHC 9.2; use 'Maybe' instead."
    |
534 | instance Serialise a => Serialise (Semigroup.Option a) where
    |                                    ^^^^^^^^^^^^^^^^

src/Codec/Serialise/Class.hs:535:21: warning: [-Wdeprecations]
    In the use of ‘getOption’ (imported from Data.Semigroup):
    Deprecated: "will be removed in GHC 9.2; use 'Maybe' instead."
    |
535 |   encode = encode . Semigroup.getOption
    |                     ^^^^^^^^^^^^^^^^^^^

src/Codec/Serialise/Class.hs:536:17: warning: [-Wdeprecations]
    In the use of data constructor ‘Option’
    (imported from Data.Semigroup):
    Deprecated: "will be removed in GHC 9.2; use 'Maybe' instead."
    |
536 |   decode = fmap Semigroup.Option decode
    |                 ^^^^^^^^^^^^^^^^

This code should be moved into !MIN_VERSION_base(4,16,0) CPP conditionals.

The tests and benchmarks should be checked too.

bgamari commented 3 years ago

I am taking care of the remaining items.