Pattern synonyms interact badly with data kinds
If we define a pattern A
and use it as a type:
{-# LANGUAGE PatternSynonyms, DataKinds #-}
pattern A = ()
b :: A
b = undefined
we get the following error:
Prelude> :load tmp.XDGqzccOAV.hs
[1 of 1] Compiling Main ( /tmp/tmp.XDGqzccOAV.hs, interpreted )
/tmp/tmp.XDGqzccOAV.hs:5:9:
GHC internal error: ‘A’ is not in scope during type checking, but it passed the renamer
tcl_env of environment: []
In the type signature for ‘blah’: blah :: A
Failed, modules loaded: none.
Also occurs with different arities of A
(the arity of the pattern and type can differ) and defining it as an operator (enabling the TypeOperators
pragma).
Trac metadata
Trac field | Value |
---|---|
Version | 7.8.2 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | lowest |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | Linux |
Architecture |