I am working my way through the real world haskell book. Many of the examples don't compile on recent GHCs. I'm not sure where to look for changes that have happened to GHC and Google hasn't been very forthcoming when looking for the error messages I am seeing. It seems like there must be something that has changed in the implementation of MArrays?
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.4.1
And:
$ 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))