GHCi and line numbers (with ghc-7.4.1)

Simon Hengel sol at typeful.net
Thu Mar 22 14:16:46 CET 2012


> >ghc --interactive now behaves different in regards to line numbers in
> >error messages than previous versions.
> >
> >They are now incremented with each evaluated expression.
> >
> >     $ ghc --interactive -ignore-dot-ghci
> >     Prelude>  foo
> >
> >     <interactive>:2:1: Not in scope: `foo'
> >     Prelude>  bar
> >
> >     <interactive>:3:1: Not in scope: `bar'
> >
> >Is there a way to disable this (or alternatively reset the counter for a
> >running session)?
> 
> Sorry, there's no way to reset it at the moment.  What do you need that for?

I use ghci for doctest [1] to evaluate examples.  All examples within
one Haddock comment are grouped to a /session/.  And I reuse the same
ghci process to run several sessions.  Before a new session is run, I
try (as far as possible) to reset ghci into a pristine state.  The
counter for line numbers is just one more thing that is carried over.

A contrived example where this makes a difference is at [2].

I think this is not critical.  But putting doctest aside, I still
preferred the old behavior.

Cheers,
Simon

[1] http://hackage.haskell.org/package/doctest
[2] http://hpaste.org/65736



More information about the Glasgow-haskell-users mailing list