我收到如下错误消息:
Linear.hs:215:27:
Couldn't match expected type `forall v1.
Ident v1 =>
SubstT v1 (GenericLL (a v1 c)) n x'
with actual type `forall v1. Ident v1 => SubstT v1 a0 m0 b0'
Expected type: (forall v1.
Ident v1 =>
SubstT v1 (GenericLL (a v1 c)) n x)
-> n x
Actual type: (forall v1. Ident v1 => SubstT v1 a0 m0 b0) -> m0 b0
In the first argument of `flattenImpl', namely `runSubstT'
In the expression: flattenImpl runSubstT
实际类型似乎比预期类型更通用。那么这种错误消息的可能原因是什么?该消息是否具有误导性或我是否阅读不正确?
我想做的是传递一个存在量化的函数runSubstT
,它的类型是:
runSubstT :: (Monad m) => (forall v. (Ident v) => SubstT v a m b) -> m b
我还将对 GHC 编译器如何对存在量化类型执行类型匹配进行一些很好的描述。