[Haskell-cafe] monadic MapReduce

Manlio Perillo manlio_perillo at libero.it
Sun Mar 1 13:25:56 EST 2009


Hi.

I have a function that do some IO (take a file path, read the file, 
parse, and return some data), and I would like to parallelize it, so 
that multiple files can be parsed in parallel.

I would like to use the simple mapReduce function,
from Real Word Haskell:

mapReduce :: Strategy b    -- evaluation strategy for mapping
           -> (a -> b)      -- map function
           -> Strategy c    -- evaluation strategy for reduction
           -> ([b] -> c)    -- reduce function
           -> [a]           -- list to map over
           -> c

mapReduce mapStrat mapFunc reduceStrat reduceFunc input =
     mapResult `pseq` reduceResult
   where mapResult    = parMap mapStrat mapFunc input
         reduceResult = reduceFunc mapResult `using` reduceStrat

Is this possible?


Thanks  Manlio Perillo
I


More information about the Haskell-Cafe mailing list