> I don't understand.  What behaviour is different here?
>
> Certainly the type is different.  But how is the behaviour different?

It behaves differently in that it accepts and returns more/less values. If
this function is part of a program, then the behavior of the program is now
different in that its domain and range are possibly different.

I would say that a program that asks a user for an integer input and echoes:

> Enter number.
1
> You entered 1.

behaves differently from one that does the following:

> Enter number
1
> error. 1 not in domain blah.

Now if "crashing vs. not crashing" isn't different behavior by your
standards, imagine the case where we have a function that does a runtime
type evaluation:

consider (f :: Int -> Int) = 1
consider (f _) = 2

Changing the type of f from

f :: Int - {1} -> Int
-- Int - {1} is just a set notation: all ints except 1.
to
f :: Int -> Int

makes the program

consider f

behave differently.



Reply via email to