
12 Dec
2006
12 Dec
'06
6:23 p.m.
On Tue, Dec 12, 2006 at 11:29:11AM -0500, Louis J Scoras wrote:
Which didn't work. I thought about it a little more before realizing that putDirs wouldn't get any parameters this way: I needed some way to distribute the pair over both operations. Here's the higher-order function I needed:
foo h f g i = h (f i) (g i)
foo is a special case of Control.Monad.liftM2.
import Control.Monad import Control.Monad.liftM2 mapM_ (liftM2 (>>) print print) [2,3,4,5] 2 2 3 3 4 4 5 5
(This is using the Monad ((->) a) instance) HTH, Stefan