= vs ->

Mark Carroll [email protected]
Tue, 9 Oct 2001 20:36:50 -0400 (EDT)


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 "->"?
> 
> What? Example please...

e.g. 

x :: Integer -> Integer
y :: Integer -> Integer
z :: Integer -> Integer

x 1 = 1
x 2 = 3

y a =
  case a of
  1 -> 1
  2 -> 3
 
z a
 | a == 1 = 1
 | a == 2 = 3

So, for instance, how come function definitions and guards use "=" but
lambdas and cases use "->"?

-- Mark