Skip to content

Panic: generalised wildcards in RULES

Generalised wildcards (PartialTypeSignatures) in the binder type annotation of a RULE cause panics.

Minimal example:

module WildcardInRuleBndrSig where
{-# RULES
"map/empty" forall (f :: a -> _). map f [] = []
  #-}

Output:

WildcardInRuleBndrSig.hs:3:31:ghc-stage1: panic! (the 'impossible' happened)
  (GHC version 7.11.20150209 for x86_64-unknown-linux):
	No skolem info: w__alY[sk]

When a wildcard is generalised over, the error message reporting the inferred type gives some extra info about the type variables occurring in the inferred type. This extra information is retrieved by looking up the skolem information (getSkolemInfo) for the type variables in the enclosing implications (cec_encl). The problem is that there are no enclosing implications in this case, hence the panic.

Note that with the flags -XPartialTypeSignatures and -fno-warn-partial-type-signatures enabled, there is no panic, as no error/warning message is constructed.

Trac metadata
Trac field Value
Version 7.10.1-rc2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (Type checker)
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