To my suggestion on the error messages Ketil Malde <[EMAIL PROTECTED]> writes > [..] > e.g instead of Hugs' Prelude head: > > head :: [a] -> a > head (x:_) = x > > we can use: > > head :: [a] -> a > head [] = error "Error: taking the 'head' of an empty list" > head (x:_) = x The Haskell implementation I use reports something of this sort. But this does not help. Also "head []" is the only error that may happen to `head'. I wrote that, generally, for the Prelude Functions, it would help in error messages to print some part of value and type expression. But with head [], I had, probably, mistaken. ---------------------------------------------- Because the program for `head' itself cannot find the type of `[]'; this may hope to do other functions, where `head' is called. Probably, we cannot improve the function `head' itself. (?) But the things like take (-1) [(1,'b'),(2,'a')], (1) let x = 0 in 0 ^ 0, (2) y % 0 (3) could produce better messages. Here x :: Num a => a, y :: Integral b => b for some a,b. One needs the values and type expression to be displayed. The latter is desirable too. Because `0',`1' may denote zero, unity of many different Num instances. If the data were of Show instance, class Show included the operation showType, with the reasonable standard instances, Show was a superclass of Num, then, one could express such type displaying in Haskell language for the cases (2), (3). With `take', it is harder. We need the possibility of overlapping values to define take :: Show a => Int -> [a] -> [a] that overlaps with more generic take :: Int -> [a] -> [a] The first specialization would produce better error report at the run-time. > Note that take already does bomb out if given a negative argument. And I take this `take' only as example, --------------------------------------- for there was earlier the discussion in this mail list on how to treat negative or too large index in `take'. ------------------ Sergey Mechveliani [EMAIL PROTECTED]