[GHC] #11066: Inacessible branch should be warning - otherwise breaks type soundness?

GHC ghc-devs at haskell.org
Sun Apr 9 08:56:01 UTC 2017


#11066: Inacessible branch should be warning - otherwise breaks type soundness?
-------------------------------------+-------------------------------------
        Reporter:  rrnewton          |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  high              |            Milestone:  8.4.1
       Component:  Compiler          |              Version:  7.10.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Incorrect         |  Unknown/Multiple
  warning at compile-time            |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #8128, #8740      |  Differential Rev(s):  Phab:D1454
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by ekmett):

 Note,

 {{{#!hs
 foo :: forall n m. (KnownNat n, KnownNat m) => Proxy n -> Proxy m -> Maybe
 (Dict (Divides n m))
 foo = case sameNat (Proxy @n) (Proxy @(Gcd n m)) \\ gcdNat @n @m of
   Just Refl -> ...
 }}}

 works just fine. I'm guessing GHC is more willing to claim the case is
 inaccessible because there aren't any type variables in it, despite the
 fact that `Gcd` is a type family and the local context might not know all
 of the instances elsewhere in the program that could be used to construct
 such a (:~:).

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


More information about the ghc-tickets mailing list