내 프로그램을 Data.Array에서 Data.Array.Unboxed로 변환하려고합니다. 빠른 보조 노트로 하스켈 어레이에서 박스 안의 배열로 변환하면 다시 쓰기 규칙이 깨집니다.
: 여러 장소 내가 그러나 내가 배열의 두 유형을 혼합하고 있지 않다, 내 코드 에서 "UArray"에 "배열"로 변경하고 Data.Array.Unboxed의 수입을 추가 할 수있는 상태 그래서 방금 Data.Array 대신 Data.Array.Unboxed를 가져 왔습니다.이 정도면 충분합니까?I 스위치 다음 다시 쓰기 규칙 휴식 할 때 :
{-# RULES
"applyWindow/applyWindow" forall win1 win2 image.
applyWindow win1
(applyWindow win2
image) =
applyWindow (indexMult win1 win2)
image
#-}
다음
win1 WIN2 및 이미지를 모두해야 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와 함께 작동합니까?
https://gist.github.com/1810229 코드가 있습니다. 나는 네가하는 말을 이해한다고 생각하지만 서명을 고치는 법을 알아 내려고 노력하고있다. – Toymakerii
'applyWindow'에 대한 방법을 추가했습니다. 문제는 로컬 바인딩 이었지만, 모든 배열의 타입을 동일하게하는 것이 바람직합니다. –
뜨거운 젠장! 나는 이틀 동안이 싸움을 해왔다. 나는 다형성 요소 유형을 원했고 FlexibleInstances와 ScopedTypedVariables 주위를 몇 시간 동안 춤을 췄다. 감사합니다! – Toymakerii