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

January 04, 2011

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00d8341d798c53ef0148c74c64c5970c

Listed below are links to weblogs that reference The String Calculator Kata in Haskell:

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.

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment