Skip to content

Qualified names in type signatures

Here's what happens when I try to use a qualified name in a type signature:

Prelude> x :: Prelude.id Int
<interactive>:2:6: error: parse error on input Prelude.id

This is not very informative: there isn't any obvious obstacle to parsing it. I would rather read a message like this:

<interactive>:3:6: error:
    • ‘Prelude.id’ is a term-level binding
      and can not be used at the type level.

Besides, we will likely allow such code at some point in the future (as part of the dependent types effort). So I believe that it would be a good idea to do some preparatory work in GHC and extend the parser accordingly.

I propose that we let qualified names like Prelude.id pass through the parser and the renamer (assuming the name in scope, otherwise the renamer would complain, of course). Then reject them in the type checker with a more informative message than what we have currently.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information