[Haskell-beginners] Argument order and partial function application
amindfv at gmail.com
Thu Aug 19 18:53:08 EDT 2010
Thanks for this great resource. I've got a basic question about partial
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
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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners