Greg Heartsfield home

Uncurry

My last post had me thinking of some of the ways the function uncurry is useful in Haskell. Let’s first look at the type:

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

Usually the results are obvious, transforming a given function by simply taking a couple of its arguments and replacing them with a single tuple argument. But sometimes we can get something a bit more interesting:

So basically, uncurry is a heavy-duty higher-order tool for working with tuples.

Validate XHTML Validate CSS