[Haskell-beginners] Argument order and partial function application

Lyndon Maydwell maydwell at gmail.com
Thu Aug 19 19:26:42 EDT 2010

I'm guessing that this isn't the actual function, as your volume
function is already agnostic regarding argument order. Making

> volumeWithWidthTen = volumeFunction 10

If the argument order does matter you can get around some order
restrictions using functions like flip, but it's often clearer to be

> volumeWithWidthTen length = volumeFunction length 10

Is that what you were looking for?

On Fri, Aug 20, 2010 at 6:53 AM, Tom Murphy <amindfv at gmail.com> wrote:
> Hi all,
>      Thanks for this great resource. I've got a basic question about partial
> function application:
> Let's say I have a very basic function:
>      volumeFunction length width height = length * width * height
> Its type signature is:
>      volumeFunction :: Int -> Int -> Int -> Int
> This implies that I first pass it the length, *then* the width, *then* the
> height.
> So while it is very easy for me to write
>      volumeWithLengthTen = volumeFunction 10
> , it's not possible to create a volumeWithWidthTen or volumeWithHeightTen.
>      I can see how I might be able to "hack" my way into accessing the
> "width" argument with infix functions, but there's no way at all that I can
> see to access the height. This seems arbitrary to me: my volumeFunction
> doesn't need them in the order they're given. Is there a way around this?
> Could I somehow combine three smaller functions?
> I appreciate any insight.
> Tom
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners

More information about the Beginners mailing list