私は現実世界のハスケルの本を読み進めています。例の多くは、最近の GHC ではコンパイルできません。GHC に起こった変更をどこで探せばよいのかわかりませんし、Google は私が見ているエラー メッセージを探してもあまり積極的ではありません。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))