Reading the excellent CoffeeScript Ristretto, I ran into this function:
((x) ->
(y) ->
x
)(1)(2)
My understanding is that the result x
is the same as the input x
.
Would the Haskell version(*) look like this?
foo :: a -> b -> (a -> b) -> a
foo x y f = x
*Note - I don't know if there's a 1-1 translation given Haskell's robust type system v. CoffeeScript
foo
has three parameters? – Lee Duhemfoo :: a -> b -> a
(as @Benesh pointed out) is the same as the above CoffeeScript function. But, as I just read, a closure is used here. So, I'm not sure if the Haskell version is equivalent... – Kevin Meredithfoo = \x -> \y -> x
or(\x -> \y -> x) 1 2
look more like your original function? – Lee Duhem