[Haskell-cafe] 'par' - why has it the type a -> b -> b ?

Henning Thielemann lemming at henning-thielemann.de
Mon Sep 29 04:55:28 EDT 2008


What is the reason for implementing parallelism with 'par :: a -> b -> b'? 
Analogy to 'seq'? I thought parallelism would be introduced most naturally 
by a function which does two computations in parallel and puts together 
their results after completion. Say

> par2 :: (a -> b -> c) -> (a -> b -> c)

to be used like

> par2 (+) expensiveComputationA expensiveComputationB


I assume that par2 can be implemented this way:

> par2 f x y =
>    f x (par x y)

?


More information about the Haskell-Cafe mailing list