[GHC] #9778: Namespace collision detection for promoted types

GHC ghc-devs at haskell.org
Thu Nov 6 16:45:43 UTC 2014


#9778: Namespace collision detection for promoted types
-------------------------------------+-------------------------------------
       Reporter:  crockeea           |                   Owner:
           Type:  feature request    |                  Status:  new
       Priority:  normal             |               Milestone:
      Component:  Compiler           |                 Version:  7.8.3
       Keywords:                     |        Operating System:
   Architecture:  Unknown/Multiple   |  Unknown/Multiple
     Difficulty:  Unknown            |         Type of failure:
     Blocked By:                     |  None/Unknown
Related Tickets:                     |               Test Case:
                                     |                Blocking:
                                     |  Differential Revisions:
-------------------------------------+-------------------------------------
 In the following example
 {{{#!hs
 {-# LANGUAGE DataKinds #-}

 module Foo where

 data Nat = Z | S Nat

 data S

 foo :: S n -> S n
 foo = id
 }}}

 GHC displays the error

 {{{
 Foo.hs:12:8:
     ‘S’ is applied to too many type arguments
     In the type signature for ‘foo’: foo :: S n -> S n
 Failed, modules loaded: none.
 }}}
 Although it's clear in my example where the problem is, this example was
 distilled from a case where I imported module1 with type `S` defined and
 module2 with the promoted type `S`, which is what I was trying to use. Can
 we get namespace collision detection instead? Something like:

 {{{
 Foo.hs:9:15
 Ambiguous occurence ‘S’
 It could refer to either Foo.S defined at Foo.hs:7:1
                       or to the promoted constructor S defined at
 Foo.hs:5:16
 Use 'S to refer to the promoted constructor.
 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9778>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list