From 3add654f4dda6dbbd5ab979640d3f716d4ced4f5 Mon Sep 17 00:00:00 2001 From: TheArcaneBrony Date: Fri, 8 Sep 2023 19:11:35 +0200 Subject: intword64 --- host/RoryNix/configuration.nix | 1 + .../patches/haskell/basement/IntWord64.patch | 105 --------------------- .../overlays/haskell/basement/IntWord64.nix | 17 ++++ .../overlays/haskell/basement/IntWord64.patch | 105 +++++++++++++++++++++ 4 files changed, 123 insertions(+), 105 deletions(-) delete mode 100644 host/RoryNix/patches/haskell/basement/IntWord64.patch create mode 100644 modules/packages/overlays/haskell/basement/IntWord64.nix create mode 100644 modules/packages/overlays/haskell/basement/IntWord64.patch diff --git a/host/RoryNix/configuration.nix b/host/RoryNix/configuration.nix index aa079e8..1f86609 100644 --- a/host/RoryNix/configuration.nix +++ b/host/RoryNix/configuration.nix @@ -6,6 +6,7 @@ # ./hardware-configuration.nix ../../modules/packages/vim.nix ../../modules/environments/home.nix + ../../modules/packages/overlays/haskell/basement/IntWord64.nix ]; boot = { diff --git a/host/RoryNix/patches/haskell/basement/IntWord64.patch b/host/RoryNix/patches/haskell/basement/IntWord64.patch deleted file mode 100644 index 0d1cdf7..0000000 --- a/host/RoryNix/patches/haskell/basement/IntWord64.patch +++ /dev/null @@ -1,105 +0,0 @@ -diff -up basement-0.0.15/Basement/Bits.hs~ basement-0.0.15/Basement/Bits.hs ---- basement-0.0.15/Basement/Bits.hs~ 2022-02-28 12:00:48.000000000 +0800 -+++ basement-0.0.15/Basement/Bits.hs 2023-02-16 18:50:32.947378064 +0800 -@@ -54,7 +54,7 @@ import GHC.Int - import Basement.Compat.Primitive - - #if WORD_SIZE_IN_BITS < 64 --import GHC.IntWord64 -+import GHC.Exts - #endif - - -- | operation over finite bits -diff -up basement-0.0.15/Basement/Numerical/Additive.hs~ basement-0.0.15/Basement/Numerical/Additive.hs ---- basement-0.0.15/Basement/Numerical/Additive.hs~ 2022-02-28 12:00:48.000000000 +0800 -+++ basement-0.0.15/Basement/Numerical/Additive.hs 2023-02-16 18:52:14.547975419 +0800 -@@ -29,7 +29,7 @@ import qualified Basement.Types.Word128 - import qualified Basement.Types.Word256 as Word256 - - #if WORD_SIZE_IN_BITS < 64 --import GHC.IntWord64 -+import GHC.Exts - #endif - - -- | Represent class of things that can be added together, -diff -up basement-0.0.15/Basement/Numerical/Conversion.hs~ basement-0.0.15/Basement/Numerical/Conversion.hs ---- basement-0.0.15/Basement/Numerical/Conversion.hs~ 2022-02-28 12:00:48.000000000 +0800 -+++ basement-0.0.15/Basement/Numerical/Conversion.hs 2023-02-16 18:28:38.844400110 +0800 -@@ -25,7 +25,7 @@ import GHC.Word - import Basement.Compat.Primitive - - #if WORD_SIZE_IN_BITS < 64 --import GHC.IntWord64 -+import GHC.Exts - #endif - - intToInt64 :: Int -> Int64 -@@ -114,7 +114,7 @@ - #endif - #else - word64ToWord32s :: Word64 -> Word32x2 --word64ToWord32s (W64# w64) = Word32x2 (W32# (word64ToWord# (uncheckedShiftRL64# w64 32#))) (W32# (word64ToWord# w64)) -+word64ToWord32s (W64# w64) = Word32x2 (W32# (wordToWord32# (word64ToWord# (uncheckedShiftRL64# w64 32#)))) (W32# (wordToWord32# (word64ToWord# w64))) - #endif - - wordToChar :: Word -> Char -diff -up basement-0.0.15/Basement/PrimType.hs~ basement-0.0.15/Basement/PrimType.hs ---- basement-0.0.15/Basement/PrimType.hs~ 2022-03-03 10:51:42.000000000 +0800 -+++ basement-0.0.15/Basement/PrimType.hs 2023-02-16 18:52:13.884971521 +0800 -@@ -54,7 +54,7 @@ import Basement.Nat - import qualified Prelude (quot) - - #if WORD_SIZE_IN_BITS < 64 --import GHC.IntWord64 -+import GHC.Exts - #endif - - #ifdef FOUNDATION_BOUNDS_CHECK -diff -up basement-0.0.15/Basement/Types/OffsetSize.hs~ basement-0.0.15/Basement/Types/OffsetSize.hs ---- basement-0.0.15/Basement/Types/OffsetSize.hs~ 2019-09-02 11:58:08.000000000 +0800 -+++ basement-0.0.15/Basement/Types/OffsetSize.hs 2023-02-16 18:49:45.703100306 +0800 -@@ -69,7 +69,7 @@ import Data.List (foldl') - import qualified Prelude - - #if WORD_SIZE_IN_BITS < 64 --import GHC.IntWord64 -+import GHC.Exts - #endif - - -- | File size in bytes -@@ -225,7 +225,7 @@ - - csizeOfSize :: CountOf Word8 -> CSize - #if WORD_SIZE_IN_BITS < 64 --csizeOfSize (CountOf (I# sz)) = CSize (W32# (int2Word# sz)) -+csizeOfSize (CountOf (I# sz)) = CSize (W32# (wordToWord32# (int2Word# sz))) - #else - #if __GLASGOW_HASKELL__ >= 904 - csizeOfSize (CountOf (I# sz)) = CSize (W64# (wordToWord64# (int2Word# sz))) -@@ -238,7 +238,7 @@ - - csizeOfOffset :: Offset8 -> CSize - #if WORD_SIZE_IN_BITS < 64 --csizeOfOffset (Offset (I# sz)) = CSize (W32# (int2Word# sz)) -+csizeOfOffset (Offset (I# sz)) = CSize (W32# (wordToWord32# (int2Word# sz))) - #else - #if __GLASGOW_HASKELL__ >= 904 - csizeOfOffset (Offset (I# sz)) = CSize (W64# (wordToWord64# (int2Word# sz))) -@@ -250,7 +250,7 @@ - sizeOfCSSize :: CSsize -> CountOf Word8 - sizeOfCSSize (CSsize (-1)) = error "invalid size: CSSize is -1" - #if WORD_SIZE_IN_BITS < 64 --sizeOfCSSize (CSsize (I32# sz)) = CountOf (I# sz) -+sizeOfCSSize (CSsize (I32# sz)) = CountOf (I# (int32ToInt# sz)) - #else - #if __GLASGOW_HASKELL__ >= 904 - sizeOfCSSize (CSsize (I64# sz)) = CountOf (I# (int64ToInt# sz)) -@@ -261,7 +261,7 @@ - - sizeOfCSize :: CSize -> CountOf Word8 - #if WORD_SIZE_IN_BITS < 64 --sizeOfCSize (CSize (W32# sz)) = CountOf (I# (word2Int# sz)) -+sizeOfCSize (CSize (W32# sz)) = CountOf (I# (word2Int# (word32ToWord# sz))) - #else - #if __GLASGOW_HASKELL__ >= 904 - sizeOfCSize (CSize (W64# sz)) = CountOf (I# (word2Int# (word64ToWord# sz))) diff --git a/modules/packages/overlays/haskell/basement/IntWord64.nix b/modules/packages/overlays/haskell/basement/IntWord64.nix new file mode 100644 index 0000000..6cf5b86 --- /dev/null +++ b/modules/packages/overlays/haskell/basement/IntWord64.nix @@ -0,0 +1,17 @@ +{ pkgs, ... }: +{ + nixpkgs.overlays = [ + (self: super: { + haskellPackages = super.haskellPackages.override { + overrides = haskellPackages-self: haskellPackages-super: { + basement = haskellPackages-super.basement.overrideAttrs (oldAttrs: { + patches = [ + ./IntWord64.patch + ]; + }); + }; + }; + } + ) + ]; +} diff --git a/modules/packages/overlays/haskell/basement/IntWord64.patch b/modules/packages/overlays/haskell/basement/IntWord64.patch new file mode 100644 index 0000000..0d1cdf7 --- /dev/null +++ b/modules/packages/overlays/haskell/basement/IntWord64.patch @@ -0,0 +1,105 @@ +diff -up basement-0.0.15/Basement/Bits.hs~ basement-0.0.15/Basement/Bits.hs +--- basement-0.0.15/Basement/Bits.hs~ 2022-02-28 12:00:48.000000000 +0800 ++++ basement-0.0.15/Basement/Bits.hs 2023-02-16 18:50:32.947378064 +0800 +@@ -54,7 +54,7 @@ import GHC.Int + import Basement.Compat.Primitive + + #if WORD_SIZE_IN_BITS < 64 +-import GHC.IntWord64 ++import GHC.Exts + #endif + + -- | operation over finite bits +diff -up basement-0.0.15/Basement/Numerical/Additive.hs~ basement-0.0.15/Basement/Numerical/Additive.hs +--- basement-0.0.15/Basement/Numerical/Additive.hs~ 2022-02-28 12:00:48.000000000 +0800 ++++ basement-0.0.15/Basement/Numerical/Additive.hs 2023-02-16 18:52:14.547975419 +0800 +@@ -29,7 +29,7 @@ import qualified Basement.Types.Word128 + import qualified Basement.Types.Word256 as Word256 + + #if WORD_SIZE_IN_BITS < 64 +-import GHC.IntWord64 ++import GHC.Exts + #endif + + -- | Represent class of things that can be added together, +diff -up basement-0.0.15/Basement/Numerical/Conversion.hs~ basement-0.0.15/Basement/Numerical/Conversion.hs +--- basement-0.0.15/Basement/Numerical/Conversion.hs~ 2022-02-28 12:00:48.000000000 +0800 ++++ basement-0.0.15/Basement/Numerical/Conversion.hs 2023-02-16 18:28:38.844400110 +0800 +@@ -25,7 +25,7 @@ import GHC.Word + import Basement.Compat.Primitive + + #if WORD_SIZE_IN_BITS < 64 +-import GHC.IntWord64 ++import GHC.Exts + #endif + + intToInt64 :: Int -> Int64 +@@ -114,7 +114,7 @@ + #endif + #else + word64ToWord32s :: Word64 -> Word32x2 +-word64ToWord32s (W64# w64) = Word32x2 (W32# (word64ToWord# (uncheckedShiftRL64# w64 32#))) (W32# (word64ToWord# w64)) ++word64ToWord32s (W64# w64) = Word32x2 (W32# (wordToWord32# (word64ToWord# (uncheckedShiftRL64# w64 32#)))) (W32# (wordToWord32# (word64ToWord# w64))) + #endif + + wordToChar :: Word -> Char +diff -up basement-0.0.15/Basement/PrimType.hs~ basement-0.0.15/Basement/PrimType.hs +--- basement-0.0.15/Basement/PrimType.hs~ 2022-03-03 10:51:42.000000000 +0800 ++++ basement-0.0.15/Basement/PrimType.hs 2023-02-16 18:52:13.884971521 +0800 +@@ -54,7 +54,7 @@ import Basement.Nat + import qualified Prelude (quot) + + #if WORD_SIZE_IN_BITS < 64 +-import GHC.IntWord64 ++import GHC.Exts + #endif + + #ifdef FOUNDATION_BOUNDS_CHECK +diff -up basement-0.0.15/Basement/Types/OffsetSize.hs~ basement-0.0.15/Basement/Types/OffsetSize.hs +--- basement-0.0.15/Basement/Types/OffsetSize.hs~ 2019-09-02 11:58:08.000000000 +0800 ++++ basement-0.0.15/Basement/Types/OffsetSize.hs 2023-02-16 18:49:45.703100306 +0800 +@@ -69,7 +69,7 @@ import Data.List (foldl') + import qualified Prelude + + #if WORD_SIZE_IN_BITS < 64 +-import GHC.IntWord64 ++import GHC.Exts + #endif + + -- | File size in bytes +@@ -225,7 +225,7 @@ + + csizeOfSize :: CountOf Word8 -> CSize + #if WORD_SIZE_IN_BITS < 64 +-csizeOfSize (CountOf (I# sz)) = CSize (W32# (int2Word# sz)) ++csizeOfSize (CountOf (I# sz)) = CSize (W32# (wordToWord32# (int2Word# sz))) + #else + #if __GLASGOW_HASKELL__ >= 904 + csizeOfSize (CountOf (I# sz)) = CSize (W64# (wordToWord64# (int2Word# sz))) +@@ -238,7 +238,7 @@ + + csizeOfOffset :: Offset8 -> CSize + #if WORD_SIZE_IN_BITS < 64 +-csizeOfOffset (Offset (I# sz)) = CSize (W32# (int2Word# sz)) ++csizeOfOffset (Offset (I# sz)) = CSize (W32# (wordToWord32# (int2Word# sz))) + #else + #if __GLASGOW_HASKELL__ >= 904 + csizeOfOffset (Offset (I# sz)) = CSize (W64# (wordToWord64# (int2Word# sz))) +@@ -250,7 +250,7 @@ + sizeOfCSSize :: CSsize -> CountOf Word8 + sizeOfCSSize (CSsize (-1)) = error "invalid size: CSSize is -1" + #if WORD_SIZE_IN_BITS < 64 +-sizeOfCSSize (CSsize (I32# sz)) = CountOf (I# sz) ++sizeOfCSSize (CSsize (I32# sz)) = CountOf (I# (int32ToInt# sz)) + #else + #if __GLASGOW_HASKELL__ >= 904 + sizeOfCSSize (CSsize (I64# sz)) = CountOf (I# (int64ToInt# sz)) +@@ -261,7 +261,7 @@ + + sizeOfCSize :: CSize -> CountOf Word8 + #if WORD_SIZE_IN_BITS < 64 +-sizeOfCSize (CSize (W32# sz)) = CountOf (I# (word2Int# sz)) ++sizeOfCSize (CSize (W32# sz)) = CountOf (I# (word2Int# (word32ToWord# sz))) + #else + #if __GLASGOW_HASKELL__ >= 904 + sizeOfCSize (CSize (W64# sz)) = CountOf (I# (word2Int# (word64ToWord# sz))) -- cgit 1.4.1