4
막내 차원 벡터에 대해 작업을 매핑 : 이드리스은 - 다음 I가 이드리스에서 N 차원 벡터를 정의
import Data.Vect
NDVect : (Num t) => (rank : Nat) -> (shape : Vect rank Nat) -> (t : Type) -> Type
NDVect Z [] t = t
NDVect (S n) (x::xs) t = Vect x (NDVect n xs t)
그러면 I는 텐서 모든 항목 f는 함수 매핑은 다음 함수를 정의.
iterateT : (f : t -> t') -> (v : NDVect r s t) -> NDVect r s t'
iterateT {r = Z} {s = []} f v = f v
iterateT {r = S n} {s = x::xs} f v = map (iterateT f) v
그러나 나는 다음과 같은 기능에 iteratorT
를 호출 할 때 :
scale : Num t => (c : t) -> (v : NDVect rank shape t) -> NDVect rank shape t
scale c v = iterateT (*c) v
내가 나를
When checking right hand side of scale with expected type
NDVect rank shape t
When checking argument v to function Main.iterateT:
Type mismatch between
NDVect rank shape t (Type of v)
and
NDVect r s t (Expected type)
Specifically:
Type mismatch between
NDVect rank shape t
and
NDVect r s t
Specifically:
Type mismatch between
NDVect rank shape t
and
NDVect r s t
에 꽤 좋은 것 같다 일치하지 않는 유형이,이 말을 다음과 같은 오류 메시지가
도 참조를 https://stackoverflow.com/questions/37402279/idris - 비 단순 - 유형 - 텐서 - 인덱싱을위한 계산 – rossng