Skip to content

Commit

Permalink
GHC 9 compatibility fixes
Browse files Browse the repository at this point in the history
* Use 'Data.Kind.Type' instead of '*'. Using '*' in that position requires `StarIsType` language extension in GHC 9.
* Import `unsafeCoerce#` from `GHC.Exts`  (https://gitlab.haskell.org/ghc/ghc/-/wikis/migration/9.0#base-415)
* Relax some upper bounds.
  • Loading branch information
utdemir committed Aug 18, 2020
1 parent b317a69 commit 98e0dac
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
10 changes: 9 additions & 1 deletion Data/Hashable/Class.hs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ import qualified Data.ByteString.Lazy as BL
import qualified Data.ByteString.Unsafe as B
import Data.Complex (Complex(..))
import Data.Int (Int8, Int16, Int32, Int64)
#if __GLASGOW_HASKELL__ >= 801
import Data.Kind (Type)
#endif
import Data.List (foldl')
import Data.Ratio (Ratio, denominator, numerator)
import qualified Data.Text as T
Expand Down Expand Up @@ -237,7 +240,12 @@ genericHashWithSalt = \salt -> ghashWithSalt HashArgs0 salt . from
data Zero
data One

data family HashArgs arity a :: *
data family HashArgs arity a
#if __GLASGOW_HASKELL__ >= 801
:: Type
#else
:: *
#fi
data instance HashArgs Zero a = HashArgs0
newtype instance HashArgs One a = HashArgs1 (Int -> a -> Int)

Expand Down
6 changes: 3 additions & 3 deletions hashable.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ Library

C-sources: cbits/fnv.c

Build-depends: base >= 4.5 && < 4.15
Build-depends: base >= 4.5 && < 4.16
, bytestring >= 0.9 && < 0.11
, deepseq >= 1.3 && < 1.5
, text >= 0.12 && < 1.3
, ghc-prim

if flag(integer-gmp)
Build-depends: integer-gmp >= 0.4 && < 1.1
Build-depends: integer-gmp >= 0.4 && < 1.2
else
-- this is needed for the automatic flag to be well-balanced
Build-depends: integer-simple
Expand Down Expand Up @@ -94,7 +94,7 @@ Test-suite tests
test-framework-quickcheck2 >= 0.2.9,
HUnit,
QuickCheck >= 2.4.0.1,
random >= 1.0 && < 1.2,
random >= 1.0 && < 1.3,
text >= 0.11.0.5
if !os(windows)
Build-depends: unix
Expand Down
4 changes: 2 additions & 2 deletions tests/Properties.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import Data.List (nub)
import Control.Monad (ap, liftM)
import System.IO.Unsafe (unsafePerformIO)
import Foreign.Marshal.Array (withArray)
import GHC.Base (ByteArray#, Int(..), newByteArray#, unsafeCoerce#,
writeWord8Array#)
import GHC.Base (ByteArray#, Int(..), newByteArray#, writeWord8Array#)
import GHC.Exts (unsafeCoerce#)
import GHC.ST (ST(..), runST)
import GHC.Word (Word8(..))
import Test.QuickCheck hiding ((.&.))
Expand Down

0 comments on commit 98e0dac

Please sign in to comment.