[Haskell-cafe] Partial application

Matthias Fischmann fis at wiwi.hu-berlin.de
Thu Jan 18 04:51:40 EST 2007


On Thu, Jan 18, 2007 at 10:26:25AM +0100, phiroc at free.fr wrote:
> To: haskell-cafe at haskell.org
> From: phiroc at free.fr
> Date: Thu, 18 Jan 2007 10:26:25 +0100
> Subject: [Haskell-cafe] Partial application
> 
> Hello,
> 
> could someone please give me an example of the "partial application" of the
> following curried function:
> 
> add' :: Int -> Int -> Int
> add' a b = a + b
> 
> Normally, add' 1 should work, but it doesn't.

it does work for me:

| *Main> add' 1
| 
| Top level:
|     No instance for (Show (Int -> Int))
|       arising from use of `print' at Top level
|     Probable fix: add an instance declaration for (Show (Int -> Int))
|     In a 'do' expression: print it

perhaps you didn't understand the error message?  it is not about the
outcome itself, it just states that the output cannot be displayed.
(Int -> Int) is a type that doesn't "show".

hth,
m


More information about the Haskell-Cafe mailing list