Hi,

In some cases, the line number in an error message does not point to the
place in the source code where the error actually comes from.

For example, when you compile the following program in the StdEnv
environment.

  module compileErrorList
  import StdEnv
  test =
    [ 10
    , 20
    , 30 + "foo"
    ]
  Start = Start

You get this error message.

  Type error [compileErrorList.icl,3,test]:"argument 1 of +" cannot unify types:
    String
    Int

The error message points to line 3, while the error comes from line 6.
The rest of the error message identifies the argument of the plus
operator as the culprit. It seems that the compiler in principle has
enough information to pinpoint the origin of the error more precisely.

Another example is the following program, which must be compiled in the
iTasks environment.

  module compileErrorMonad
  import Control.Monad
  import System.IO
  test =
    putStrLn "hello" >>|
    putStrLn "world" >>|
    putStrLn 42
  Start = Start

The error message is:

  Type error [compileErrorMonad.icl,4,test]:"argument 1 of putStrLn" cannot 
unify demanded type with offered type:
    String
    Int

The compiler seems to know that the argument of the third putStrLn is the
problem, but the source location of the error message points to line 4.

Is it possible to let the compiler output source locations that relate
more closely to the origin of errors?

Best regards,
Markus
_______________________________________________
clean-list mailing list
[email protected]
http://mailman.science.ru.nl/mailman/listinfo/clean-list

Reply via email to