Skip to content

A poly-kinded newtype existential crisis

The following code worked on older GHCs and on other compilers clear back to Hugs, but based on reports I'm getting from a half-dozen users appears to broken on GHC 7.6.1+ and in GHC HEAD.

class Reifies s a | s -> a where
  reflect :: proxy s -> a

data Proxy a = Proxy

newtype Magic a r = Magic (forall s. Reifies s a => Proxy s -> r)
fast/Data/Reflection.hs:92:21:
    A newtype constructor cannot have an existential context,
      but `Magic' does
    In the definition of data constructor `Magic'

There doesn't appear to be anything existential going on there, but that said, this issue does only occur when PolyKinds are turned on, so perhaps the issue is with the desugaring into PolyKinds?

Trac metadata
Trac field Value
Version 7.6.3
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