Quoth [EMAIL PROTECTED], nevermore,
> 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.

I think this is what you mean. If not, then please advice. This is typed
into a vanilla ghci prompt, no extra modules loaded or flags switched
on. There is no smoke and mirrors at work ;-)

(The ':: Int' constrains the type of b, and therefore all the other
numbers, but doesn't affect the function application.)

> Prelude> let add' a b = a + b :: Int
> Prelude> let f = add' 1
> Prelude> f 2
> 3

Is this what you wanted? Perhaps you tried this but mistyped something?

Regards,

D.
-- 
Dougal Stanton <[EMAIL PROTECTED]>
<http://brokenhut.livejournal.com>
Word attachments considered harmful.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to