[GHC] #12921: initTc: unsolved constraints

GHC ghc-devs at haskell.org
Mon Jul 10 18:00:07 UTC 2017


#12921: initTc: unsolved constraints
-------------------------------------+-------------------------------------
        Reporter:  jlp               |                Owner:  (none)
            Type:  bug               |               Status:  closed
        Priority:  normal            |            Milestone:  8.2.1
       Component:  Compiler (Type    |              Version:  8.0.1
  checker)                           |
      Resolution:  fixed             |             Keywords:
Operating System:  MacOS X           |         Architecture:  x86_64
                                     |  (amd64)
 Type of failure:  Compile-time      |            Test Case:
  crash or panic                     |  typecheck/should_fail/T12921
      Blocked By:                    |             Blocking:
 Related Tickets:  #13106            |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by gnezdo):

 I hit this problem too. I couldn't quickly locate a prebuilt version of
 ghc HEAD. Reporting the reproducer here instead.

 Given this source:


 {{{
 {-# LANGUAGE DataKinds #-}
 {-# LANGUAGE KindSignatures #-}
 {-# LANGUAGE PolyKinds #-}
 {-# LANGUAGE TypeFamilies #-}
 {-# LANGUAGE TypeOperators #-}
 {-# LANGUAGE UndecidableInstances #-}
 import GHC.TypeLits

 -- | The floor of log_2(n).
 type family Log2 n where
   Log2 1 = 0
   Log2 n = Log2 (Div2 n) + 1

 -- | The floor of n/2.
 type family Div2 n where
   Div2 0 = 0
   Div2 1 = 0
   Div2 n = Div2 (n - 2) + 1

 }}}

 In ghci I get the following error:
 {{{
 Prelude> Log2 (2 :: GHC.TypeLits.KnownNat)
 ghc: panic! (the 'impossible' happened)
   (GHC version 8.0.2 for x86_64-unknown-linux):
         initTc: unsolved constraints
   WC {wc_insol =
         [W] Log2_a1P3 :: t_a1P2[tau:1] (CHoleCan: Log2)
         [W] Log2_a1Px :: t_a1Pw[tau:1] (CHoleCan: Log2)}
 }}}

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


More information about the ghc-tickets mailing list