[GHC] #12549: Panic on ":t datatypeName"

GHC ghc-devs at haskell.org
Tue Nov 1 05:44:50 UTC 2016


#12549: Panic on ":t datatypeName"
---------------------------------+--------------------------------------
        Reporter:  johnleo       |                Owner:  johnleo
            Type:  bug           |               Status:  new
        Priority:  normal        |            Milestone:
       Component:  Compiler      |              Version:  8.1
      Resolution:                |             Keywords:
Operating System:  MacOS X       |         Architecture:  x86_64 (amd64)
 Type of failure:  None/Unknown  |            Test Case:
      Blocked By:                |             Blocking:
 Related Tickets:                |  Differential Rev(s):
       Wiki Page:                |
---------------------------------+--------------------------------------

Comment (by johnleo):

 Info after further investigation.  The following both work fine.
 {{{
 > :set -XTypeInType
 > class C a where f :: a b
 > :t f
 f ∷ ∀ {k} {b ∷ k} {a ∷ k → ★}. C k a ⇒ a b
 > class C a where f :: b a
 > :t f
 f ∷ ∀ {k} {a ∷ k} {b ∷ k → ★}. C k a ⇒ b a
 }}}
 However at 3 variables every combination fails (I've used +v here to
 prevent deep instantiation, which is where the failure occurs).
 {{{
 > class C a where f :: a b c
 > :t +v f
 f ∷ ∀ {k1} {k2} (a ∷ k1 → k2 → ★).
     C k1 k2 a ⇒
     ∀ (b ∷ k1) (c ∷ k2). a b c
 > class C a where f :: b a c
 > :t +v f
 f ∷ ∀ {k} (a ∷ k). C k a ⇒ ∀ {k1} (b ∷ k → k1 → ★) (c ∷ k1). b a c
 > class C a where f :: b c a
 > :t +v f
 f ∷ ∀ {k} (a ∷ k). C k a ⇒ ∀ {k1} (b ∷ k1 → k → ★) (c ∷ k1). b c a
 }}}
 All three of these panic without the +v.  Note that with no TypeInType
 everything is fine
 {{{
 > class C a where f :: a b c
 > :t f
 f ∷ ∀ {b} {a ∷ ★ → ★ → ★} {c}. C a ⇒ a b c
 }}}

 The problem seems to be that in the TypeInType case with 3 variables, the
 quantification of some variables is moving to the right of the class
 constraint.  Variables are instantiated in independent groups, with
 separate groups before and after the constraint, and here the types after
 the constraint are referring to kinds defined before the constraint,
 causing the panic.  I will investigate further

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


More information about the ghc-tickets mailing list