
Mark Carroll wrote (on 09-10-01 20:36 -0400):
On Tue, 9 Oct 2001, Ashley Yakeley wrote:
At 2001-10-09 11:55, Mark Carroll wrote:
What is the rationale for when Haskell demands a "=" and when it demands a "->"?
For me, the difference is that "=" is used when the RHS (right-hand side) is bound to a pattern (or function decl. pattern) LHS in some scope, and "->" when the variables of the pattern on the LHS are free in the expression on the RHS. "<-" behaves like "=". As for "Int -> Int" vs. "\x -> x+1", though the idea of using "->" for binding probably came from the fact that lambda abstraction introduces "->", that's best considered an accident, i.e., you may well assume there is no relationship between these two uses of "->". (In some type systems, they generalize to the same thing, but not in Haskell.) In ML, they use "->" for function types but "=>" for binding constructs. -- Frank Atanassow, Information & Computing Sciences, Utrecht University Padualaan 14, PO Box 80.089, 3508 TB Utrecht, Netherlands Tel +31 (030) 253-3261 Fax +31 (030) 251-379