Issue with SrcSpan of AbsBinds

JP Moresmau jpmoresmau at
Fri Mar 18 14:51:36 CET 2011

Hello, I'm trying to get Scion to work well with GHC7, and I found a
small issue (I'm not saying it's GHC7 only, maybe it was there in GHC
6.12). I'm using 7.0.2
I have the following code, which is idiotic but proves the point:

fun ::  t -> [Char] -> [Char]
fun _=reverse . map toUpper

And the TypecheckedSource gives me something like (using the
ghc-syb-utils package to dump it:)

{Bag(Located (HsBind Var)):
   (L {src\Folder1\ForAll.hs:8:1-29}
     [{Var: t}]
       [{Var: t}] {Var:} {Var: fun}
     ({abstract:TcEvBinds}) {Bag(Located (HsBind Var)):
      (L {src\Folder1\ForAll.hs:9:1-27}
        (L {src\Folder1\ForAll.hs:9:1-3} {Var: fun})

Obviously my code starts at line 8 in that example.
The issue occurs when the scion code wants to tell the user what
(name+type) is a particular line/column in the source
Now the scion code does something simple: to find something at a given
point, it goes down the tree, and when it encounters a Located object,
it checks the location spans around the point we're looking at. The
issue here is that the AbsBinds has a SrcSpan that only covers the
type signature, and not the rest of the code, hence (I think) we never
go down the contents, and Scion cannot resolve anything when a user
asks it to.
If the type signature is not present, the problem doesn't occur: the
AbsBinds location covers all the source code.
If the type signature is present but without any type variable, there
is no AbsBinds and no problem.

Is that normal behavior, and hence should I code a work around in Scion?


JP Moresmau

More information about the Glasgow-haskell-users mailing list