我有这个代码:
class SymbolSet tpe where
data Symbol tpe :: *
data SSet tpe where
Identity :: tpe -> SSet tpe
And :: SSet tpe -> Symbol tpe -> SSet tpe
class HasElem a b where
instance (SymbolSet tpe) => HasElem (And (Identity tpe) s) s
instance (HasElem sset s) => HasElem (And sset s) s
Run Code Online (Sandbox Code Playgroud)
这是在GHC-7.4中编译的.但是,在转向GHC-7.6时,它开始出现编译错误:
'And' of tpe `forall tpe. tpe -> Symbol * tpe -> SSet tpe' is not promotable
Run Code Online (Sandbox Code Playgroud)
在挖掘文档时,我发现在GHC-7.6与GHC-7.4的 "数据类型升级"页面中添加了一个新的条款
我们不会提升其构造函数是多态的,涉及约束或使用存在量化的数据类型.
我的问题是: