[GHC] #15322: `KnownNat` does not imply `Typeable` any more when used with plugin

GHC ghc-devs at haskell.org
Thu Jul 5 11:11:30 UTC 2018


#15322: `KnownNat` does not imply `Typeable` any more when used with plugin
-------------------------------------+-------------------------------------
        Reporter:  chshersh          |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.6.1
       Component:  Compiler          |              Version:  8.4.3
      Resolution:                    |             Keywords:
                                     |  typeable,knownnat
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  GHC rejects       |  Unknown/Multiple
  valid program                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #10348            |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 My patch makes the reporting of unnecessary constraints more consistent --
 in particular, accounting for built-in constraints.

 The original program still fails in the same way, for the reason explained
 in comment:1.

 What is the "real" fix?  Well, despite comment:1 ''we'' know that
 `Typeable (n+1)` is never going to simplify to `Typeable n` (at least, not
 without using instances), because we know that `n+1 /= n`.  But doesn't
 know that.

 The plug-in, I imagine, allows GHC to solve `KnownNat (n+1)` from
 `KnownNat n`. We want the plugin ''also'' to be able to say that `n` '''is
 apart from''' `n+1`; that is, they can never be equal.  This is a property
 of `(+)`.

 So I think that perhaps domain-specific apartness should be part of what a
 typechecker plugin can specify. I'll leave this ticket open to discuss
 that idea.

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


More information about the ghc-tickets mailing list