On 10/3/10 1:45 PM, 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

It is worth noting that such a function already exists in the standard libraries; it is the &&& operator in Control.Arrow:

    blowup = uncurry (++) . (blowup . allButLast &&& lastToTheLength)

Cheers,
Greg
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to