
On Jan 18, 2007, at 16:15 , Philippe de Rochambeau wrote:
When I read this, I thought that you could partially apply "multiply" by typing "multiply 2" at the ghci prompt. However, this generated an error:
<interactive>:1:0: No instance for (Show (Int -> Int)) arising from use of `print' at <interactive>:1:0-9 Possible fix: add an instance declaration for (Show (Int -> Int)) In the expression: print it In a 'do' expression: print it
Well, yes and no. Partial application at the prompt works fine; displaying the value of a partially applied function doesn't work so well, because un-applied or partially applied functions don't have nice printable representations (the "No instance for (Show (Int -> Int))" error) by default. You can actually change that to some extent, by loading something like this into ghci:
import Data.Typeable
instance (Typeable a, Typeable b) => Show (a -> b) where show f = "<" ++ show (typeOf f) ++ ">"
Now your partially applied function should print as