真实世界Haskell CHapter 26(Bloom过滤器)不能在最近的GHC上编译

时间:2013-06-23 17:17:20

标签: haskell

我正在通过现实世界的哈斯克书。许多例子都没有在最近的GHC上编制。我不知道在哪里可以找到GHC发生的变化,谷歌在寻找我看到的错误消息时并不是非常乐意。似乎在MArrays的实现中必须有一些变化?

$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.4.1

$ ghc -o bloom BloomFilter/Mutable.hs
[2 of 2] Compiling BloomFilter.Mutable ( BloomFilter/Mutable.hs, BloomFilter/Mutable.o )

BloomFilter/Mutable.hs:21:36:
    No instance for (Data.Array.Base.MArray
                       Data.Array.Base.UArray Bool (ST s))
      arising from a use of `newArray'
    Possible fix:
      add an instance declaration for
      (Data.Array.Base.MArray Data.Array.Base.UArray Bool (ST s))
    In the second argument of `liftM', namely
      `newArray (0, numBits - 1) False'
    In the expression: MB hash `liftM` newArray (0, numBits - 1) False
    In an equation for `new':
        new hash numBits = MB hash `liftM` newArray (0, numBits - 1) False

BloomFilter/Mutable.hs:26:36:
    No instance for (Data.Array.Base.MArray
                       Data.Array.Base.UArray Bool (ST s))
      arising from a use of `getBounds'
    Possible fix:
      add an instance declaration for
      (Data.Array.Base.MArray Data.Array.Base.UArray Bool (ST s))
    In the second argument of `liftM', namely
      `getBounds (mutArray filt)'
    In the expression: (succ . snd) `liftM` getBounds (mutArray filt)
    In an equation for `length':
        length filt = (succ . snd) `liftM` getBounds (mutArray filt)

BloomFilter/Mutable.hs:30:77:
    Couldn't match expected type `MutBloom s0 a0'
                with actual type `Word32'
    In the second argument of `writeArray', namely `bit'
    In the expression: writeArray (mutArray) bit True
    In the first argument of `mapM_', namely
      `(\ bit -> writeArray (mutArray) bit True)'

BloomFilter/Mutable.hs:40:44:
    No instance for (Data.Array.Base.MArray
                       Data.Array.Base.UArray Bool (ST s))
      arising from a use of `readArray'
    Possible fix:
      add an instance declaration for
      (Data.Array.Base.MArray Data.Array.Base.UArray Bool (ST s))
    In the first argument of `allM', namely
      `(readArray (mutArray filt))'
    In the second argument of `(>>=)', namely
      `allM (readArray (mutArray filt))'
    In the expression:
      indices filt elt >>= allM (readArray (mutArray filt))

0 个答案:

没有答案