« Making Too Much of TDD | Main | The Thing of Software Development »

January 04, 2011

Comments

Dan Burton

If you hoogle the type signature for converting a function with 2 parameters into a function with one 2-tuple parameter, you find "uncurry".

(a -> b -> c) -> ((a,b) -> c)

http://haskell.org/hoogle/?hoogle=(a+-%3E+b+-%3E+c)+-%3E+((a,+b)+-%3E+c)


let add x y = x + y
:t add
add :: (Num a) => a -> a -> a
:t uncurry add
uncurry add :: (Num a) => (a,a) -> a


Tupling up extra data in the return type is a little different, but sounds a lot like the Reader monad or State monad.

sclv

Two other functions of note -- Data.List.isPrefixOf, and Control.Arrow.&&&. The latter lets you write `(delimiter &&& body) text` which helps the pointfreeness.

Jeremy

For anyone curious: the wisely-chosen music is by Recoil. :)

Jiggaboo

Great music. I don't understand anything in Haskell :)

Karep

I watch it from time to time just to listen to the great music.

The comments to this entry are closed.