Poll: Error message spans

Alexander Dunlap alexander.dunlap at gmail.com
Thu Jan 7 00:01:46 EST 2010


On Wed, Jan 6, 2010 at 3:35 AM, Ian Lynagh <igloo at earth.li> wrote:
>
> Hi all,
>
> Currently, when GHC reports an error it only gives a source position,
> not a source span. For example, with this module:
>
>    main = print (f (const 'x' 'x') 'y')
>    f xs y = xs ++ [y]
>
> you get an error starting:
>
>    u.hs:1:18:
>        Couldn't match expected type `[a]' against inferred type `Char'
>
> There's a (probably little-known) flag -ferror-spans with which you get
> this error instead:
>
>    u.hs:1:18-30:
>        Couldn't match expected type `[a]' against inferred type `Char'
>
> i.e. rather than just giving the start column number 18, it gives you
> the span 18-30 (the "const 'x' 'x'").
>
>
> Would you find the extra information useful, or just noise?
> i.e. should we show error spans by default?
>
>
> Thanks
> Ian
>
> _______________________________________________
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users at haskell.org
> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
>

I certainly wouldn't find it distracting, and I think it could be
quite useful in many cases. I vote for turning it on by default.

Alex


More information about the Glasgow-haskell-users mailing list