プログラムをData.Arrayの使用からData.Array.Unboxedに変換しようとしています。
簡単な補足として、コードで「配列」を「UArray」に変更し、Data.Array.Unboxedのインポートを追加できると記載されている場所がいくつかありますが、両方のタイプの配列を混合していないため、Data.Arrayをインポートしました。 Data.Arrayの代わりに.Unboxed、これで十分ですか?
切り替えを行うと、次の書き換えルールが破られます。
{-# RULES
"applyWindow/applyWindow" forall win1 win2 image.
applyWindow win1
(applyWindow win2
image) =
applyWindow (indexMult win1 win2)
image
#-}
ここで、win1win2とimageはすべてUArrayである必要があります。ただし、これは次のエラーでコンパイルに失敗します。
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で動作するときに、これが機能しないのはなぜですか?