
#9778: Namespace collision detection for promoted types -------------------------------------+------------------------------------- Reporter: crockeea | Owner: Type: feature | Status: new request | Milestone: Priority: normal | Version: 7.8.3 Component: Compiler | Keywords: Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: | Related Tickets: None/Unknown | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by simonpj): Kosmikus is right. Moreover, it's very common to say {{{ data T = T Int f :: T -> T f (T x) = T (x+1) }}} where the type and the data constructor deliberately share a name. That has to work. So in general terms, Kosmikus's suggestion of a hint is probably the way to go. However in this example, the hint is positively misleading. You say that "This code compiles without the definition of `data S`" but that's not true: {{{ T9778.hs:9:8: Expected a type, but ‘S n’ has kind ‘Nat’ In the type signature for ‘foo’: foo :: S n -> S n }}} So suggesting to use the data constructor instead is not helpful. I suppose if you had {{{ foo :: Proxy (S n) -> Proxy (S n) }}} ''then'' the hint would make sense. But now thing are getting quite complicated! I'm concerned that we might make matters worse instead of better. Suggestions welcome. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9778#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler