
25 May
2012
25 May
'12
12:50 p.m.
I've been trying to use mutable arrays in the ST monad, and wrote out a little proof of concept function: idST :: [Int] -> [Int] idST xs = runST $ do array <- newListArray (1, (length xs)) xs return (getElems array) -- where idSt should be equivalent to id. And I get the error message: Couldn't match type `[Int]' with `Int' In the return type of a call of `getElems' In the first argument of `return', namely `(getElems array)' In a stmt of a 'do' block: return (getElems array) Obviously I'm making a very simple mistake here, but I can't seem to spot it. Can anyone offer some advice?