From d8dc0f96237fe6fe7081c04727c7c2573477e5cb Mon Sep 17 00:00:00 2001 From: Sylvain Henry Date: Thu, 3 Dec 2020 18:54:54 +0100 Subject: Fix array and cleanup conversion primops (#19026) The first change makes the array ones use the proper fixed-size types, which also means that just like before, they can be used without explicit conversions with the boxed sized types. (Before, it was Int# / Word# on both sides, now it is fixed sized on both sides). For the second change, don't use "extend" or "narrow" in some of the user-facing primops names for conversions. - Names like `narrowInt32#` are misleading when `Int` is 32-bits. - Names like `extendInt64#` are flat-out wrong when `Int is 32-bits. - `narrow{Int,Word}#` however map a type to itself, and so don't suffer from this problem. They are left as-is. These changes are batched together because Alex happend to use the array ops. We can only use released versions of Alex at this time, sadly, and I don't want to have to have a release thatwon't work for the final GHC 9.2. So by combining these we get all the changes for Alex done at once. Bump hackage state in a few places, and also make that workflow slightly easier for the future. Bump minimum Alex version Bump Cabal, array, bytestring, containers, text, and binary submodules --- testsuite/tests/simplCore/should_compile/T5359a.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'testsuite/tests/simplCore/should_compile') diff --git a/testsuite/tests/simplCore/should_compile/T5359a.hs b/testsuite/tests/simplCore/should_compile/T5359a.hs index 8c4a0beaf7..594bd9ed18 100644 --- a/testsuite/tests/simplCore/should_compile/T5359a.hs +++ b/testsuite/tests/simplCore/should_compile/T5359a.hs @@ -61,7 +61,7 @@ textP arr off len | len == 0 = emptyT {-# INLINE textP #-} unsafeChrT :: Word16 -> Char -unsafeChrT (W16# w#) = C# (chr# (word2Int# (extendWord16# w#))) +unsafeChrT (W16# w#) = C# (chr# (word2Int# (word16ToWord# w#))) {-# INLINE unsafeChrT #-} data Array = Array ByteArray# @@ -82,7 +82,7 @@ unsafeFreeze (MArray maBA) = ST $ \s# -> (# s#, Array (unsafeCoerce# maBA) #) unsafeIndex :: Array -> Int -> Word16 unsafeIndex (Array aBA) (I# i#) = - case indexWord16Array# aBA i# of r# -> (W16# (narrowWord16# r#)) + case indexWord16Array# aBA i# of r# -> (W16# r#) {-# INLINE unsafeIndex #-} empty :: Array -- cgit v1.2.1