[Haskell-cafe] Re: 'par' - why has it the type a -> b -> b ?
Malcolm.Wallace at cs.york.ac.uk
Mon Sep 29 11:01:06 EDT 2008
> par2 :: (a -> b -> c) -> a -> b -> c
> > > par2 f x y =
> > > f x (par x y)
Here is the dual: 'par' implemented in terms of parallel application:
a `par` b = par2 (\x y-> y) a b
> ($!) :: (a -> b) -> a -> b
> f $! x = x `seq` f x
> It's terseness vs. maximum composability. I don't even want to think
> about implementing seq in terms of $!, makes my brain twist.
It's not so difficult. (And you may see some similarity with the above
defn of par.)
a `seq` b = (\x y-> y) $! a b
More information about the Haskell-Cafe