To my suggestions on the error messages
Marc van Dongen <[EMAIL PROTECTED]> writes
> Printing the argument of a function as part of an error
> message may lead to infinite error messages.
> [..]
> A call to error terminates execution of the program
> and returns an appropriate error indication to the
> operating system.
> [..]
Thank you for the remark.
What really puzzles me here is the termination and the laziness
violence.
My application program tries sometimes the messages as in example
myTake (-1) (x:y:z:xs) =
error $ ("myTake (-1) (x:_) \n x = "++) $ shows x ...
But it relies on that this x was not defined as, for example,
x = 'a':x
Now, what should Prelude.take
think of Prelude.take (-1) (x:y:z:xs),
how could it decide to display x ?
The compiler does not know whether show x
would lead to the infinite printing.
Example: take (-1) (x,"a","b","c") where x = 'a':x
Therefore, some other operation, say, restrictedShows,
has to apply here, which is defined so that prints some small part
of the value.
I wonder whether this is possible.
But displaying the type expression, it looks safer, does it?
------------------
Sergey Mechveliani
[EMAIL PROTECTED]