[Haskell-beginners] Another currying and lambda question
Francesco Ariis
fa-ml at ariis.it
Tue Dec 22 17:59:21 UTC 2020
Il 22 dicembre 2020 alle 11:48 Lawrence Bottorff ha scritto:
> flipA :: (a -> b -> c) -> b -> a -> c
> flipA f x y = f y x
>
> What is it specifically about currying that makes flipA possible?
I do not see how currying is involved here! Maybe when you pass
a function to an higher order one?
> flipB :: (a -> b -> c) -> b -> a -> c
> flipB f = \x y -> f y x
>
> Also, with flipB, could someone explain the beta reduction? It looks
> like f is not being acted on, just passed along, Would it look more
> like this in lambda calculus?
Indeed `f` is not being acted on (i.e. it is «outside» of the lambda)
(λx. λy. f y x) b a
(λy. f y b) a beta
f a b beta
fully expressed with lambdas would be:
(λf. λx. λy. f y x) g b a
More information about the Beginners
mailing list