[英]Coercible with GHC 7.10
以下代码适用于GHC 7.8.4:
import Data.Coerce
coerceNewtype :: (Coercible (o r) (n m' r)) => [o r] -> [n m' r]
coerceNewtype = coerce
但在7.10我收到错误:
Couldn't match representation of type ‘n m' r’ with that of ‘o r’
arising from trying to show that the representations of
‘[o r]’ and
‘[n m' r]’ are the same
Relevant role signatures: type role [] representational
我不太确定Data.Coerce
中的魔法发生在Data.Coerce
,但鉴于coerce
有签名(Coercible ab) => a -> b
,我认为上面的函数仍然应该在7.10中编译。 任何想法为什么行为不同,或者如何在7.10中使用多态类型强制使用?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.