问题描述
我正在尝试使用 Test.QuickCheck.Monadic
编写 monadic 测试代码。
模块提供了一个线束
monadicST :: Testable a => (forall s. PropertyM (ST s) a) -> Property
执行基于 ST
的测试和函数
run :: Monad m => m a -> PropertyM m a
将任何操作提升为测试单子。
act :: Monad m => a -> m ()
act = undefined
以下函数
st :: a -> Property
st = monadicST . run . act
编译失败:
• Couldn't match type ‘PropertyM m0 ()’
with ‘forall s. PropertyM (ST s) a0’
Expected type: PropertyM m0 () -> Property
Actual type: (forall s. PropertyM (ST s) a0) -> Property
• In the first argument of ‘(.)’,namely ‘monadicST’
In the expression: monadicST . run . act
In an equation for ‘st’: st = monadicST . run . act
但是这个
st' :: a -> Property
st' a = monadicST $ run $ act a
编译没有问题。
谁能解释一下?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)