vincenthz / hs-memory

haskell memory
Other
48 stars 38 forks source link

Does not compile with GHC 9.2.1 #86

Closed TomMD closed 2 years ago

TomMD commented 2 years ago

The recent changes of bit shifts in Base 4.16 have caused issues for memory. The hackage head patch compiles memory using changes that are simple but numerous.

tfausak commented 2 years ago

The hackage head patch

Which I think is this? https://gitlab.haskell.org/ghc/head.hackage/-/blob/c50d7587a23ef1260721e84f8bcc1450d73177db/patches/memory-0.16.0.patch

tfausak commented 2 years ago

I opened #87 by mechanically applying the patch.

andreasabel commented 2 years ago

I created a revision on hackage that prevents build attempts of memory-0.16.0 with GHC 9.2: https://hackage.haskell.org/package/memory-0.16.0/revisions/

andrewufrank commented 2 years ago

could somebody please produce a new version with this patch and publish it on hackage which can compile with 9.2.1 (ie. base 4.16). This missing patch holds back programs like pandoc to compile with 9.2.1. thank you!

andreasabel commented 2 years ago

@andrewufrank : See https://github.com/haskell-infra/hackage-trustees/issues/330#issuecomment-1019507291 And https://groups.google.com/a/haskell.foundation/g/board/c/68K8jlYChFQ/m/sWj_s96HBQAJ?pli=1

arjunkathuria commented 2 years ago

like @andrewufrank said, it would be nice to have an updated/patched version online.

servant-server fails to build with 9.2.1 because this package fails to build

Failed to build memory-0.16.0.
Build log (
/home/arjun/.cabal/logs/ghc-9.2.1/memory-0.16.0-c68db49f57665dea008cdf0bccfa52609731eac6de339d65c9fcff89090d9b5c.log
):
Configuring library for memory-0.16.0..
Preprocessing library for memory-0.16.0..
Building library for memory-0.16.0..
[ 1 of 28] Compiling Data.Memory.ExtendedWords ( Data/Memory/ExtendedWords.hs, dist/build/Data/Memory/ExtendedWords.o, dist/build/Data/Memory/ExtendedWords.dyn_o )
[ 2 of 28] Compiling Data.Memory.Internal.Compat ( Data/Memory/Internal/Compat.hs, dist/build/Data/Memory/Internal/Compat.o, dist/build/Data/Memory/Internal/Compat.dyn_o )
[ 3 of 28] Compiling Data.Memory.Endian ( Data/Memory/Endian.hs, dist/build/Data/Memory/Endian.o, dist/build/Data/Memory/Endian.dyn_o )
[ 4 of 28] Compiling Data.Memory.Hash.SipHash ( Data/Memory/Hash/SipHash.hs, dist/build/Data/Memory/Hash/SipHash.o, dist/build/Data/Memory/Hash/SipHash.dyn_o )
[ 5 of 28] Compiling Data.Memory.Encoding.Base16 ( Data/Memory/Encoding/Base16.hs, dist/build/Data/Memory/Encoding/Base16.o, dist/build/Data/Memory/Encoding/Base16.dyn_o )

Data/Memory/Encoding/Base16.hs:46:49: error:
    • Couldn't match expected type ‘Word#’ with actual type ‘Word8#’
    • In the first argument of ‘convertByte’, namely ‘a’
      In the expression: convertByte a
      In a pattern binding: !(# w1, w2 #) = convertByte a
   |
46 |                     !(# w1, w2 #) = convertByte a
   |                                                 ^

Data/Memory/Encoding/Base16.hs:47:49: error:
    • Couldn't match expected type ‘Word#’ with actual type ‘Word8#’
    • In the first argument of ‘convertByte’, namely ‘b’
      In the expression: convertByte b
      In a pattern binding: !(# w3, w4 #) = convertByte b
   |
47 |                     !(# w3, w4 #) = convertByte b
   |                                                 ^

Data/Memory/Encoding/Base16.hs:48:49: error:
    • Couldn't match expected type ‘Word#’ with actual type ‘Word8#’
    • In the first argument of ‘convertByte’, namely ‘c’
      In the expression: convertByte c
      In a pattern binding: !(# w5, w6 #) = convertByte c
   |
48 |                     !(# w5, w6 #) = convertByte c
   |                                                 ^

Data/Memory/Encoding/Base16.hs:49:49: error:
    • Couldn't match expected type ‘Word#’ with actual type ‘Word8#’
    • In the first argument of ‘convertByte’, namely ‘d’
      In the expression: convertByte d
      In a pattern binding: !(# w7, w8 #) = convertByte d
   |
49 |                     !(# w7, w8 #) = convertByte d
   |                                                 ^

Data/Memory/Encoding/Base16.hs:58:49: error:
    • Couldn't match expected type ‘Word#’ with actual type ‘Word8#’
    • In the first argument of ‘convertByte’, namely ‘b’
      In the expression: convertByte b
      In a pattern binding: !(# w1, w2 #) = convertByte b
   |
58 |                     !(# w1, w2 #) = convertByte b
   |                                                 ^

Data/Memory/Encoding/Base16.hs:85:49: error:
    • Couldn't match expected type ‘Word#’ with actual type ‘Word8#’
    • In the first argument of ‘convertByte’, namely ‘w’
      In the expression: convertByte w
      In a pattern binding: !(# w1, w2 #) = convertByte w
   |
85 |                 let !(# w1, w2 #) = convertByte w
   |                                                 ^

Data/Memory/Encoding/Base16.hs:86:51: error:
    • Couldn't match expected type ‘Word8#’ with actual type ‘Word#’
    • In the first argument of ‘W8#’, namely ‘w1’
      In the third argument of ‘pokeByteOff’, namely ‘(W8# w1)’
      In a stmt of a 'do' block: pokeByteOff bout (i * 2) (W8# w1)
   |
86 |                 pokeByteOff bout (i * 2)     (W8# w1)
   |                                                   ^^

Data/Memory/Encoding/Base16.hs:87:51: error:
    • Couldn't match expected type ‘Word8#’ with actual type ‘Word#’
    • In the first argument of ‘W8#’, namely ‘w2’
      In the third argument of ‘pokeByteOff’, namely ‘(W8# w2)’
      In a stmt of a 'do' block: pokeByteOff bout (i * 2 + 1) (W8# w2)
   |
87 |                 pokeByteOff bout (i * 2 + 1) (W8# w2)
   |                                                   ^^

Data/Memory/Encoding/Base16.hs:96:25: error:
    • Couldn't match expected type ‘Word#’ with actual type ‘Word8#’
    • In the expression: indexWord8OffAddr# table (word2Int# index)
      In an equation for ‘r’:
          r table index = indexWord8OffAddr# table (word2Int# index)
      In an equation for ‘convertByte’:
          convertByte b
            = (# r tableHi b, r tableLo b #)
            where
                r :: Addr# -> Word# -> Word#
                r table index = indexWord8OffAddr# table (word2Int# index)
                !tableLo
                  = "0123456789abcdef0123456789abcdef\
            \0123456789abcdef0123456789abcdef\
            \0123456789abcdef0123456789abcdef\
            \0123456789abcdef0123456789abcdef\
            \0123456789abcdef0123456789abcdef\
            \0123456789abcdef0123456789abcdef\
            \0123456789abcdef0123456789abcdef\
            \0123456789abcdef0123456789abcdef"#
                !tableHi
                  = "00000000000000001111111111111111\
            \22222222222222223333333333333333\
            \44444444444444445555555555555555\
            \66666666666666667777777777777777\
            \88888888888888889999999999999999\
            \aaaaaaaaaaaaaaaabbbbbbbbbbbbbbbb\
            \ccccccccccccccccdddddddddddddddd\
            \eeeeeeeeeeeeeeeeffffffffffffffff"#
   |
96 |         r table index = indexWord8OffAddr# table (word2Int# index)
   |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Data/Memory/Encoding/Base16.hs:134:70: error:
    • Couldn't match expected type ‘Word#’ with actual type ‘Word8#’
    • In the first argument of ‘word2Int#’, namely ‘index’
      In the second argument of ‘indexWord8OffAddr#’, namely
        ‘(word2Int# index)’
      In the first argument of ‘W8#’, namely
        ‘(indexWord8OffAddr# tableLo (word2Int# index))’
    |
134 |         rLo (W8# index) = W8# (indexWord8OffAddr# tableLo (word2Int# index))
    |                                                                      ^^^^^

Data/Memory/Encoding/Base16.hs:135:70: error:
    • Couldn't match expected type ‘Word#’ with actual type ‘Word8#’
    • In the first argument of ‘word2Int#’, namely ‘index’
      In the second argument of ‘indexWord8OffAddr#’, namely
        ‘(word2Int# index)’
      In the first argument of ‘W8#’, namely
        ‘(indexWord8OffAddr# tableHi (word2Int# index))’
    |
135 |         rHi (W8# index) = W8# (indexWord8OffAddr# tableHi (word2Int# index))
    |                                                                      ^^^^^
cabal: Failed to build memory-0.16.0 (which is required by exe:greet from
servant-server-0.19). See the build log above for details.
ysangkok commented 2 years ago

@TomMD This can be closed.