
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 8/19/10 18:53 , Tom Murphy wrote:
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?
volumeGivenLength, volumeGivenWeight, volumeGivenHeight: Int -> (Int -> Int
- -> Int)
- -- note that the above signature is the same as Int -> Int -> Int -> Int
volumeGivenLength = volumeFunction -- function taking w, h
volumeGivenWidth = flip volumeFunction -- function taking l, h
volumeGivenHeight = flip (flip . volumeFunction) -- function taking l, w
You can in general achieve any desired permutation of parameters, at the
expense of your sanity: