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.
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
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
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'
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?