Skip to content

Panic: piResultTys1 in compiler/types/Type.hs:1022:5

I apologize in advance for a non-minimised repro.

The panic (with a small -ddump-tc-trace excerpt, but full log also attached):

tcPolyExprNC
  Check{Vocab
          *
          (k_a4TNy[tau:2] -> Constraint)
          i_a4TNv[tau:2]
          (Present * k_a4TNy[tau:2] i_a4TNv[tau:2])}
tcSkolemise
tcInferId
  voc_a4TB2 :: Vocab i_a4TMf[sk:1] (Present * * i_a4TMf[sk:1])
tcCheckId
  voc_a4TB2
  Vocab i_a4TMf[sk:1] (Present * * i_a4TMf[sk:1])
  Check{Vocab
          *
          (k_a4TNy[tau:2] -> Constraint)
          i_a4TNv[tau:2]
          (Present * k_a4TNy[tau:2] i_a4TNv[tau:2])}
tcWrapResult
  Actual:   Vocab i_a4TMf[sk:1] (Present * * i_a4TMf[sk:1])
  Expected: Check{Vocab
                    *
                    (k_a4TNy[tau:2] -> Constraint)
                    i_a4TNv[tau:2]
                    (Present * k_a4TNy[tau:2] i_a4TNv[tau:2])}
tc_sub_type_ds
  ty_actual   = Vocab i_a4TMf[sk:1] (Present * * i_a4TMf[sk:1])
  ty_expected = Vocab
                  *
                  (k_a4TNy[tau:2] -> Constraint)
                  i_a4TNv[tau:2]
                  (Present * k_a4TNy[tau:2] i_a4TNv[tau:2])
deeply_instantiate final subst
  origin: arising from a use of ‘voc_a4TB2’
  type: Vocab i_a4TMf[sk:1] (Present * * i_a4TMf[sk:1])
  new type: Vocab i_a4TMf[sk:1] (Present * * i_a4TMf[sk:1])
  subst: [TCvSubst
            In scope: InScope {i_a4TMf}
            Type env: []
            Co env: []]
u_tys
  tclvl 2
  Vocab i_a4TMf[sk:1] (Present * * i_a4TMf[sk:1])
  ~
  Vocab
    *
    (k_a4TNy[tau:2] -> Constraint)
    i_a4TNv[tau:2]
    (Present * k_a4TNy[tau:2] i_a4TNv[tau:2])
  arising from a type equality Vocab
                                 i_a4TMf[sk:1] (Present * * i_a4TMf[sk:1])
                               ~
                               Vocab
                                 *
                                 (k_a4TNy[tau:2] -> Constraint)
                                 i_a4TNv[tau:2]
                                 (Present * k_a4TNy[tau:2] i_a4TNv[tau:2])

<no location info>: error:
    ghc: panic! (the 'impossible' happened)
  (GHC version 8.6.1 for x86_64-unknown-linux):
        piResultTys1
  *
  [i_a4TNv[tau:2], Present * k_a4TNy[tau:2] i_a4TNv[tau:2]]
  Call stack:
      CallStack (from HasCallStack):
        callStackDoc, called at compiler/utils/Outputable.hs:1160:37 in ghc:Outputable
        pprPanic, called at compiler/types/Type.hs:1022:5 in ghc:Type

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

Repro (requires Nix & some download time, provides hard repro guarantees in return):

$ git clone https://github.com/deepfire/holotype
$ cd holotype
$ git reset --hard 5c80e9239a3c18d67106920db8f832abc7bd9a93
$ nix-shell
[nix-shell:~/holotype]$ cabal build lib:holotype
Edited by Serge Kosyrev
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information