Re: [Haskell-cafe] Strict version of Data.Map.map

2009-02-27 Thread Edsko de Vries
I guess so. Maybe using mapAccum helps: import qualified Data.Map as M strictMap :: (a - b) - M.Map k a - M.Map k b strictMap f m = case M.mapAccum f' () m of ((), m') - m' where f' () x = x' `seq` ((), x') where x' = f x testStrictness mapper = m `seq` Not strict.

[Haskell-cafe] Strict version of Data.Map.map

2009-02-26 Thread Edsko de Vries
Hi, Is it possible to write a strict version of Data.Map.map (so that the Map becomes strict in the elements as well as the keys)? Thanks, Edsko ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Strict version of Data.Map.map

2009-02-26 Thread Felipe Lessa
I'd advise you to see Control.Parallel.Strategies, specially the NFData class and the rnf function. HTH, -- Felipe. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Strict version of Data.Map.map

2009-02-26 Thread Edsko de Vries
On Thu, Feb 26, 2009 at 12:45:09PM -0300, Felipe Lessa wrote: I'd advise you to see Control.Parallel.Strategies, specially the NFData class and the rnf function. What is the time complexity of running rnf on a Data.Map? If it is O(n), then surely running rnf on my map after every 'map'

Re: [Haskell-cafe] Strict version of Data.Map.map

2009-02-26 Thread Felipe Lessa
On Thu, Feb 26, 2009 at 2:13 PM, Edsko de Vries devri...@cs.tcd.ie wrote: On Thu, Feb 26, 2009 at 12:45:09PM -0300, Felipe Lessa wrote: I'd advise you to see Control.Parallel.Strategies, specially the NFData class and the rnf function. What is the time complexity of running rnf on a Data.Map?