word-compat 0.0.2 → 0.0.3
raw patch · 4 files changed
+62/−18 lines, 4 filesdep +word-compatdep ~base
Dependencies added: word-compat
Dependency ranges changed: base
Files
- src/GHC/Int/Compat.hs +12/−8
- src/GHC/Word/Compat.hs +13/−9
- tests/test.hs +27/−0
- word-compat.cabal +10/−1
src/GHC/Int/Compat.hs view
@@ -2,10 +2,10 @@ {-# LANGUAGE MagicHash #-} {-# LANGUAGE ViewPatterns #-} {-# LANGUAGE CPP #-}-module GHC.Int.Compat (Int8,- Int16,- Int32,- Int64(..),+module GHC.Int.Compat (W.Int8,+ W.Int16,+ W.Int32,+ W.Int64(..), Int(..), #if MIN_VERSION_ghc_prim(0,8,0) pattern GHC.Int.Compat.I8#,@@ -26,22 +26,26 @@ eqInt32, neInt32, gtInt32, geInt32, ltInt32, leInt32, eqInt64, neInt64, gtInt64, geInt64, ltInt64, leInt64) where -import GHC.Int as W+import GHC.Int hiding (Int8(..), Int16(..), Int32(..))+import qualified GHC.Int as W #if MIN_VERSION_ghc_prim(0,8,0) import GHC.Prim -pattern I8# :: Int# -> Int8+pattern I8# :: Int# -> W.Int8 pattern I8# x <- (W.I8# (int8ToInt# -> x)) where I8# x = W.I8# (intToInt8# x)+{-# COMPLETE I8# #-} -pattern I16# :: Int# -> Int16+pattern I16# :: Int# -> W.Int16 pattern I16# x <- (W.I16# (int16ToInt# -> x)) where I16# x = W.I16# (intToInt16# x)+{-# COMPLETE I16# #-} -pattern I32# :: Int# -> Int32+pattern I32# :: Int# -> W.Int32 pattern I32# x <- (W.I32# (int32ToInt# -> x)) where I32# x = W.I32# (intToInt32# x)+{-# COMPLETE I32# #-} #endif
src/GHC/Word/Compat.hs view
@@ -2,11 +2,11 @@ {-# LANGUAGE MagicHash #-} {-# LANGUAGE ViewPatterns #-} {-# LANGUAGE CPP #-}-module GHC.Word.Compat (Word8,- Word16,- Word32,- Word64(..),- Word(..),+module GHC.Word.Compat (W.Word8,+ W.Word16,+ W.Word32,+ W.Word64(..),+ W.Word(..), #if MIN_VERSION_ghc_prim(0,8,0) pattern GHC.Word.Compat.W8#, pattern GHC.Word.Compat.W16#,@@ -41,22 +41,26 @@ eqWord32, neWord32, gtWord32, geWord32, ltWord32, leWord32, eqWord64, neWord64, gtWord64, geWord64, ltWord64, leWord64) where -import GHC.Word as W+import GHC.Word hiding (Word8(..), Word16(..), Word32(..))+import qualified GHC.Word as W #if MIN_VERSION_ghc_prim(0,8,0) import GHC.Prim -pattern W8# :: Word# -> Word8+pattern W8# :: Word# -> W.Word8 pattern W8# x <- (W.W8# (word8ToWord# -> x)) where W8# x = W.W8# (wordToWord8# x)+{-# COMPLETE W8# #-} -pattern W16# :: Word# -> Word16+pattern W16# :: Word# -> W.Word16 pattern W16# x <- (W.W16# (word16ToWord# -> x)) where W16# x = W.W16# (wordToWord16# x)+{-# COMPLETE W16# #-} -pattern W32# :: Word# -> Word32+pattern W32# :: Word# -> W.Word32 pattern W32# x <- (W.W32# (word32ToWord# -> x)) where W32# x = W.W32# (wordToWord32# x)+{-# COMPLETE W32# #-} #endif
+ tests/test.hs view
@@ -0,0 +1,27 @@+{-# LANGUAGE MagicHash #-}+module Main where++import GHC.Exts (Int#, Word#)+import GHC.Int.Compat+import GHC.Word.Compat++_i8 :: Int8 -> Int#+_i8 (I8# x) = x++_i16 :: Int16 -> Int#+_i16 (I16# x) = x++_i32 :: Int32 -> Int#+_i32 (I32# x) = x++_w8 :: Word8 -> Word#+_w8 (W8# x) = x++_w16 :: Word16 -> Word#+_w16 (W16# x) = x++_w32 :: Word32 -> Word#+_w32 (W32# x) = x++main :: IO ()+main = pure ()
word-compat.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: word-compat-version: 0.0.2+version: 0.0.3 -- A short (one-line) description of the package. synopsis: Compatibility shim for the Int/Word internal change in GHC 9.2@@ -38,4 +38,13 @@ build-depends: base >= 4.9 && <5, ghc-prim hs-source-dirs: src ghc-options: -Wall -Wcompat+ default-language: Haskell2010++test-suite test+ main-is: test.hs+ hs-source-dirs: tests+ type: exitcode-stdio-1.0+ ghc-options: -Wall -Wcompat+ build-depends:+ base, word-compat default-language: Haskell2010