我正在尝试将我的程序从使用 Data.Array 转换为 Data.Array.Unboxed。
作为一个快速的旁注:几个地方声明我可以在我的代码中将“Array”更改为“UArray”并添加 Data.Array.Unboxed 的导入,但是我没有混合两种类型的数组,所以我只是导入了 Data.Array .Unboxed 而不是 Data.Array,这就足够了吗?
当我进行切换时,以下重写规则会中断:
{-# RULES
"applyWindow/applyWindow" forall win1 win2 image.
applyWindow win1
(applyWindow win2
image) =
applyWindow (indexMult win1 win2)
image
#-}
这里 win1 win2 和 image 应该都是 UArrays。但是,这无法编译并出现以下错误。
FIPlib/Core.hs:229:99:
Ambiguous type variables `e0', `a0' in the constraint:
(IArray a0 e0) arising from a use of `applyWindow'
Probable fix: add a type signature that fixes these type variable(s)
In the expression: applyWindow (indexMult win1 win2) image
When checking the transformation rule "applyWindow/applyWindow"
FIPlib/Core.hs:229:99:
Ambiguous type variables `e0', `a2' in the constraint:
(IArray a2 e0) arising from a use of `applyWindow'
Probable fix: add a type signature that fixes these type variable(s)
In the expression: applyWindow (indexMult win1 win2) image
When checking the transformation rule "applyWindow/applyWindow"
FIPlib/Core.hs:229:112:
Ambiguous type variables `e0', `a1' in the constraint:
(IArray a1 e0) arising from a use of `indexMult'
Probable fix: add a type signature that fixes these type variable(s)
In the first argument of `applyWindow', namely
`(indexMult win1 win2)'
In the expression: applyWindow (indexMult win1 win2) image
When checking the transformation rule "applyWindow/applyWindow"
是什么让这模棱两可?为什么当它与 Data.Array 一起使用时会中断?