If every function in haskell is curried then how come i can't create partial pairs?

Viewed 147

Noob here. Im not sure if every function is supposed to be curried (but thats the feeling I got).

If that is indeed the case then how come

(,) 1

throws an error? Shouldn't it return a function that when applied to one more value gives a tuple?

1 Answers

how come (,) 1 throws an error? Shouldn't it return a function [...]?

Both of those can be true.

λ> let f = (,) 1 in f 2
(1,2)

But since functions have no Show instance, just typing (,) 1 does throw an error:

λ> (,) 1

<interactive>:4:1: error:
    • No instance for (Show (b0 -> (Integer, b0)))
        arising from a use of ‘print’
        (maybe you haven't applied a function to enough arguments?)
    • In a stmt of an interactive GHCi command: print it
Related