[GHC] #15379: Don't reject user-written instances of KnownNat and friends in hsig files

GHC ghc-devs at haskell.org
Wed Jul 18 18:14:06 UTC 2018


#15379: Don't reject user-written instances of KnownNat and friends in hsig files
-------------------------------------+-------------------------------------
        Reporter:  ezyang            |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.6.1
       Component:  Compiler          |              Version:  8.4.3
      Resolution:                    |             Keywords:  backpack
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by ppk):

 Okey I think I see where the Overlapping instances come from in the case
 of KnownNat and KnownSymbol. Let me take the following code sample

 {{{#!haskell

 signature Abstract where
    data Foo :: Nat
    instance KnownNat Foo

 module Util where
    import Abstract
    foo = natVal (Proxy :: Proxy Foo)

 module Concrete where
    type Foo = Int

 module Main where
  {- mixin Concrete and get the ConcreteUtil -}

 }}}

 In the main module there are two dictionaries for `KnownNat Foo`, one
 which comes via Util (which incidently is actually coming from Concrete
 and the other directly coming from Concrete. But these
 two are "different" in the sense that the old code generates KnownNat on
 the fly and these two generations manifest as two different instances.

 Is there some way this hypothesis can be tested out say be tracing the
 compilation for the example ?

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


More information about the ghc-tickets mailing list