>b <- mapArray id a The reason it is slow is because the array type is copied every time a member is assigned.
There are two solutions: 1) Use a mutable-array in the StateMonad then freeze it. 2) In this particular case where processing is sequential (IE you are only altering values based on *nearby* values, you can use streams. One of the nicest features of Haskell is how lists (being lazy) operate just like streams... So read the data into a list and define a filter of the type filter :: [a] -> [a] Your program then becomes: main :: IO () main = do s <- getMyDataAsList() putMyList (filter s) where the commands getMyDataAsList and putMyList have the types: getMyDataAsList :: IO [a] putMyList :: [a] -> IO () This should be fast, and also use very little memory. Regards, Keean Schupke. _______________________________________________ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users