[Haskell-cafe] supplying some of the arguments to a function

Daniel Fischer daniel.is.fischer at web.de
Fri May 6 17:51:07 EDT 2005


Am Freitag, 6. Mai 2005 17:32 schrieb Mark Goldman:
> if I had a function f that took x y and z in that order, is there some
> way that I can supply y and z and get back a function that takes x?
> This question comes about after talking with a prof about currying and
> wether it buys you anything.
>
> -mdg

Prelude> :t (flip .) . flip
(flip .) . flip :: (a -> b -> c -> d) -> b -> c -> a -> d
Prelude> :t (((flip .) . flip) .) . flip
(((flip .) . flip) .) . flip :: (a -> b -> c -> d -> e) -> b -> c -> d ->a->e

and so on.

But in general you'd be better of with 

g z x y = f x y z,

let h y z x = f x y z in 

and the write 

map (g z x)

or whatever.

Cheers,
Daniel


More information about the Haskell-Cafe mailing list