
25 Aug
2005
25 Aug
'05
1:58 p.m.
Bayley, Alistair wrote:
compute :: Int -> Int compute n = runST ( do arr <- newArray (-1, 1) n readArray 1 arr )
You messed the argument order to readArray up. Even with that repaired, you'll need a type signature somewhere to help ghc resolve the overloading of newArray and readArray, which is surprisingly tricky due to the "s" that must not escape. This works: compute :: Int -> Int compute n = runST ( do arr <- newArray (-1, 1) n :: ST s (STArray s Int Int) readArray arr 1 ) Udo. -- Mikrosoft spel chekar four sail, wurks grate!