Haskell Language Tuples (Pairs, Triples, ...) Apply a tuple function to two arguments (currying)


Example

Use the curry function (from Prelude or Data.Tuple) to convert a function that takes tuples to a function that takes two arguments.

curry fst 1 2 -- computes 1

curry snd 1 2 -- computes 2

curry (uncurry f) -- computes the same as f

import Data.Tuple (swap)
curry swap 1 2 -- computes (2, 1)