Feedback Function type constructor is right-associative 

Forum: U Chicago, Com Sci 221, autumn 2000
Re: Question polymorphism/types/associativity/ (Michael C. Brizic)
Date: 2000, Nov 20
From: Mike O'Donnell <odonnell@cs.uchicago.edu>

That point went by a bit too fast in class. We can mention it again at the beginning of class on Wednesday. There are two things to think about: syntax and semantics.

Syntax

The operator -> in ML is right-associative. So


'a -> 'b -> 'c
is the same as

'a -> ('b -> 'c)

Semantics


'a -> ('b -> 'c)
is the type of functions that take an argument of type 'a, then return a function that takes an argument of type 'b, which returns an object of type 'c. Functions of this type are the Curried versions of functions taking two arguments of types 'a and 'b, returning objects of type 'c. Since Curried functions are the norm in ML, the right-associativity is the most useful default.

On the other hand,


('a -> 'b) -> 'c
is the type of functions that take an argument of type 'a -> 'b, then return an object of type 'c. In mathematical logic, functions as arguments to functions provide much more theoretical power than functions returning functions as values. But in ML and lots of other programming languages, implementations find it easier to deal with functions as arguments than with functions as computed values. I suspect that this is due to some mistakes in approach, but nobody in the ML business seems to agree with me. But, I predict that some day the inherent logical power of the types will turn out to be more important than the current notions of how to implement such functions.



Mike O'D.


to: "Function type constructor is right-associative"