Explicit namespaces doesn't enforce namespaces
It seems to me that the type keyword should permanently enforce that a RdrName lives in a particular namespace. Currently it only acts as a syntactic marker so that type constructors which looks like variables can be included in export lists.
The following example is accepted by GHC. As A is parsed as a type constructor but later put into the data constructor namespace.
{-# LANGUAGE ExplicitNamespaces #-}
{-# LANGUAGE TypeFamilies #-}
module M ( T (type A) ) where
data T = A
class Foo a where
type A a
foo :: a -> Int
The fix is to track uses of ExplicitNamespaces in the AST and then use this information in the renamer.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 8.0.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |