From 03df25bb7ac2f57a5382cda44dbaef8170543758 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=C3=A4llberg?= Date: Tue, 4 Oct 2022 16:46:36 +0200 Subject: [PATCH] Add support for ghc-9.2.4 --- gf.cabal | 8 ++++---- src/runtime/haskell/Data/Binary/Builder.hs | 9 +++++++++ src/runtime/haskell/Data/Binary/Get.hs | 8 ++++++++ stack-ghc9.2.4.yaml | 7 +++++++ 4 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 stack-ghc9.2.4.yaml diff --git a/gf.cabal b/gf.cabal index 022cc1e218..21093ae0be 100644 --- a/gf.cabal +++ b/gf.cabal @@ -11,7 +11,7 @@ description: GF, Grammatical Framework, is a programming language for multilingu maintainer: John J. Camilleri homepage: https://www.grammaticalframework.org/ bug-reports: https://github.com/GrammaticalFramework/gf-core/issues -tested-with: GHC==7.10.3, GHC==8.0.2, GHC==8.10.4, GHC==9.0.2 +tested-with: GHC==7.10.3, GHC==8.0.2, GHC==8.10.4, GHC==9.0.2, GHC==9.2.4 data-dir: src extra-source-files: @@ -73,11 +73,11 @@ library build-depends: -- GHC 8.0.2 to GHC 8.10.4 array >= 0.5.1 && < 0.6, - base >= 4.9.1 && < 4.16, - bytestring >= 0.10.8 && < 0.11, + base >= 4.9.1 && < 4.17, + bytestring >= 0.10.8 && < 0.12, containers >= 0.5.7 && < 0.7, exceptions >= 0.8.3 && < 0.11, - ghc-prim >= 0.5.0 && < 0.7.1, + ghc-prim >= 0.5.0 && < 0.9.0, mtl >= 2.2.1 && < 2.3, pretty >= 1.1.3 && < 1.2, random >= 1.1 && < 1.3, diff --git a/src/runtime/haskell/Data/Binary/Builder.hs b/src/runtime/haskell/Data/Binary/Builder.hs index a74428f203..5f8983c0c4 100644 --- a/src/runtime/haskell/Data/Binary/Builder.hs +++ b/src/runtime/haskell/Data/Binary/Builder.hs @@ -77,6 +77,9 @@ import qualified Data.ByteString.Internal as S import GHC.Base(Int(..),uncheckedShiftRL# ) import GHC.Word (Word32(..),Word16(..),Word64(..)) +#if MIN_VERSION_base(4,16,0) +import GHC.Exts (wordToWord16#, word16ToWord#, wordToWord32#, word32ToWord#) +#endif #if WORD_SIZE_IN_BITS < 64 && __GLASGOW_HASKELL__ >= 608 import GHC.Word (uncheckedShiftRL64#) #endif @@ -411,8 +414,14 @@ shiftr_w32 :: Word32 -> Int -> Word32 shiftr_w64 :: Word64 -> Int -> Word64 #if defined(__GLASGOW_HASKELL__) && !defined(__HADDOCK__) +#if MIN_VERSION_base(4,16,0) +shiftr_w16 (W16# w) (I# i) = W16# (wordToWord16# ((word16ToWord# w) `uncheckedShiftRL#` i)) +shiftr_w32 (W32# w) (I# i) = W32# (wordToWord32# ((word32ToWord# w) `uncheckedShiftRL#` i)) +#else shiftr_w16 (W16# w) (I# i) = W16# (w `uncheckedShiftRL#` i) shiftr_w32 (W32# w) (I# i) = W32# (w `uncheckedShiftRL#` i) +#endif + #if WORD_SIZE_IN_BITS < 64 shiftr_w64 (W64# w) (I# i) = W64# (w `uncheckedShiftRL64#` i) diff --git a/src/runtime/haskell/Data/Binary/Get.hs b/src/runtime/haskell/Data/Binary/Get.hs index 895789061c..8faf249a93 100644 --- a/src/runtime/haskell/Data/Binary/Get.hs +++ b/src/runtime/haskell/Data/Binary/Get.hs @@ -101,6 +101,9 @@ import Data.STRef import GHC.Base import GHC.Word --import GHC.Int +#if MIN_VERSION_base(4,16,0) +import GHC.Exts (wordToWord16#, word16ToWord#, wordToWord32#, word32ToWord#) +#endif #endif -- Control.Monad.Fail import will become redundant in GHC 8.8+ @@ -532,8 +535,13 @@ shiftl_w32 :: Word32 -> Int -> Word32 shiftl_w64 :: Word64 -> Int -> Word64 #if defined(__GLASGOW_HASKELL__) && !defined(__HADDOCK__) +#if MIN_VERSION_base(4,16,0) +shiftl_w16 (W16# w) (I# i) = W16# (wordToWord16# ((word16ToWord# w) `uncheckedShiftL#` i)) +shiftl_w32 (W32# w) (I# i) = W32# (wordToWord32# ((word32ToWord# w) `uncheckedShiftL#` i)) +#else shiftl_w16 (W16# w) (I# i) = W16# (w `uncheckedShiftL#` i) shiftl_w32 (W32# w) (I# i) = W32# (w `uncheckedShiftL#` i) +#endif #if WORD_SIZE_IN_BITS < 64 shiftl_w64 (W64# w) (I# i) = W64# (w `uncheckedShiftL64#` i) diff --git a/stack-ghc9.2.4.yaml b/stack-ghc9.2.4.yaml new file mode 100644 index 0000000000..3758d56ad3 --- /dev/null +++ b/stack-ghc9.2.4.yaml @@ -0,0 +1,7 @@ +resolver: nightly-2022-09-30 # GHC-9.2.4 + +extra-deps: +- multipart-0.2.0@sha256:b8770e3ff6089be4dd089a8250894b31287cca671f3d258190a505f9351fa8a9,1084 +- cgi-3001.5.0.0@sha256:3d1193a328d5f627a021a0ef3927c1ae41dd341e32dba612fed52d0e3a6df056,2990 + +allow-newer: true