Skip to content

Panic with piResultTys1

{-# LANGUAGE DataKinds           #-}
{-# LANGUAGE ScopedTypeVariables #-}

twacePowDec :: t m' r -> t m r
twacePowDec = undefined

data Bench a

bench :: (a -> b) -> a -> Bench params
bench f = undefined

bench_twacePow :: forall t m m' r . _ => t m' r -> Bench '(t,m,m',r)
bench_twacePow = bench (twacePowDec :: t m' r -> t m r)

produces (in GHCi):

GHCi, version 8.0.1: http://www.haskell.org/ghc/  :? for help
[1 of 1] Compiling Main             ( Bug.hs, interpreted )

Bug.hs:13:58: error:
    • Expected a type, but
      ‘'(t, m, m', r)’ has kind
      ‘(k1 -> k2 -> *, k0, k1, k2)’
    • In the first argument of ‘Bench’, namely ‘'(t, m, m', r)’
      In the type ‘t m' r -> Bench '(t, m, m', r)’

Bug.hs:14:52: error:
    • Expected kind ‘k1’, but ‘m’ has kind ‘k0’
    • In the first argument of ‘t’, namely ‘m’
      In an expression type signature: t m' r -> t m r
      In the first argument of ‘bench’, namely
        ‘(twacePowDec :: t m' r -> t m r)’
    • Relevant bindings includeghc: panic! (the 'impossible' happened)
  (GHC version 8.0.1 for x86_64-unknown-linux):
	piResultTys1
  k_a18K[tau:3]
  [m'_a17U[sk], r_a17V[sk]]

The intent was to use this code with -XPartialTypeSignatures, but the bug occurs with or without that extension.

Trac metadata
Trac field Value
Version 8.0.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information