
At 2010-10-03T22:45:30+02:00, Dominique Devriese wrote:
Additionally, you can't combine the functions (blowup . allButLast) and lastToTheLength into a function that returns a pair like you seem to attempt. You need a function like the following for that:
comma :: (a -> b) -> (a -> c) -> a -> (b,c) comma f g x = (f x, g x)
Then you could say:
blowup = (uncurry (++)) . comma (blowup . allButLast) lastToTheLength
Thanks, I'll try that.
Ignore this if you haven't read about Applicative or type classes yet, but using the Applicative instance for arrow types (->) a, you can also write
comma = liftA2 (,)
I hadn't come up to that point, but will read about it now.
Regards,
Raghavendra.
--
N. Raghavendra