[Haskell-cafe] monadic MapReduce

David Menendez dave at zednenem.com
Tue Mar 3 18:20:53 EST 2009

On Mon, Mar 2, 2009 at 6:57 PM, Anish Muttreja <anishmuttreja at gmail.com> wrote:
> How about this. Is there a reason why I can't
> replace the variables b and c in the type signature of mapReduce with with (IO b')
> and (IO c'). b and c  can be any types.
> mapReduce :: Strategy (IO b')    -- evaluation strategy for mapping
>           -> (a -> IO b')      -- map function
>           -> Strategy (IO c')    -- evaluation strategy for reduction
>           -> ([IO b'] -> (IO c'))    -- reduce function
>           -> [a]           -- list to map over
>           -> (IO c')
> Just remember to wrap all values back in the IO monad.

This is possible, but it probably won't do what you want. The input to
the reduce function will be  a list of "IO a" values, not the results
of performing the IO.

Dave Menendez <dave at zednenem.com>

More information about the Haskell-Cafe mailing list