[Haskell-cafe] Currying confusion
John Goerzen
jgoerzen at complete.org
Fri Nov 12 14:14:45 EST 2004
I'm trying to do something -- I think it's called uncurrying. I've
boiled up a little test case to show what I mean:
test1 :: Int -> String
test1 = show
test2 :: Int -> Int -> String
test2 x y = (show x) ++ (show y)
OK, that works OK. Now let's say I want to provide a function that
generates the string to use in place of (show y) -- perhaps, test1.
I like the partial application feature (and used it in test1). So, I
thought I could use that to my advantage in test3 and test4:
test3 :: Int -> Int -> String
test3 x f = (show x) ++ f
test4 :: Int -> (Int -> String)
test4 x f = (show x) ++ f
Of course, I could say test3 x f y = (show x) ++ (f y)
but for various reasons that's not the most useful in my program.
Thoughts?
More information about the Haskell-Cafe
mailing list