At 00:02 -0800 1998/11/27, Simon Peyton-Jones wrote:
>       What do the following definitions do:
>
>1      x + 1 = f x
>
>2      (x + 1) = f 2
>
>3      (x + 1) * 2 = f x
>
>4      (x + 1) 2 = g x

I will just briefly indicate the solution used in mathematics: In implicit
definitions, one indicates what quantity is defined.

Let "x := a" mean "x is defined by a"; then one can also write "a =: x",
meaning "a defines x". Both these variations allow x to only be a single
name.

But then one can also have the variation "A :=: B" meaning "there is a
quantity implicitly defined by the equation "A = B". One must then also
indicate explicitly what quantity is defined.

This ":=:" is, it seems me, the variation that the Haskell "=" corresponds
to, except one then does not indicate the quantity defined, which is
causing those ambiguity problems.

A solution would be to clearly indicate what quantity one attempts to
define, part of it a part of the Haskell standard in the simple cases the
reader might not be confused, but indicating this quantity explicitly in
the more complicated cases.

For example, take number (3) above. If I write
    x: (x + 1) * 2 = f x
    *: (x + 1) * 2 = f x
then in each case, the intention of the author is clear. The first case
could perhaps not be handled by Haskell (implicitly dividing with 2), but
other languages, computer algebra languages and CLP(R) and such, could do
it.

  Hans Aberg
                  * Email: Hans Aberg <mailto:[EMAIL PROTECTED]>
                  * Home Page: <http://www.matematik.su.se/~haberg/>
                  * AMS member listing: <http://www.ams.org/cml/>



Reply via email to