[Haskell-cafe] newTArrayIO

2007-01-26 Thread Chad Scherrer
This seems like a natural thing to have around, but it's not in GHC 6.6... newTArrayIO :: (Enum i, Ix i) = (i, i) - a - IO (TArray i a) newTArrayIO (a,b) = liftM (TArray . listArray (a,b)) . sequence . zipWith ignore [a..b] . repeat . newTVarIO where ignore = flip const I haven't done any

Re: [Haskell-cafe] newTArrayIO

2007-01-26 Thread Mattias Bengtsson
On Fri, 2007-01-26 at 11:34 -0800, Chad Scherrer wrote: This seems like a natural thing to have around, but it's not in GHC 6.6... newTArrayIO :: (Enum i, Ix i) = (i, i) - a - IO (TArray i a) newTArrayIO (a,b) = liftM (TArray . listArray (a,b)) . sequence . zipWith ignore [a..b] . repeat .

Re: [Haskell-cafe] newTArrayIO

2007-01-26 Thread Mattias Bengtsson
On Fri, 2007-01-26 at 23:26 +0100, Mattias Bengtsson wrote: On Fri, 2007-01-26 at 11:34 -0800, Chad Scherrer wrote: This seems like a natural thing to have around, but it's not in GHC 6.6... newTArrayIO :: (Enum i, Ix i) = (i, i) - a - IO (TArray i a) newTArrayIO (a,b) = liftM (TArray