How is (,) defined internally?

Viewed 293

It's trivial to redefine the function

(,) :: a -> b -> (a,b)
(,) a b = (a,b)

The weird (to me) thing is that this function is defined for arbitrary length tuples. So, for example, there is actually a function:

(,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) :: a -> b -> c -> ... -> (a,b,c,...)

How is this done? Why isn't it done for all the standard functions on tuples, like zip?

Hoogle gives me no results, and I don't see how template Haskell could do this, so I assume it must be some sort of magic inside the compiler. But that seems very un-Haskelly to me.

3 Answers
Related