2
像在Haskell移动计算国际象棋的工作和我的一个分配给一个小问题 运行在我被迫在使用Data.Array救我的作品与确定的位置一个Char和一个Int。现在我有个输入与writeToArray的名单,我已经尝试了很多,但我不断收到错误,没有人知道我在做什么错?哈斯克尔列表为Array
这里是它的有关代码:
data Squares = Squares {array :: Array Pos Piece}
data Pos = Pos Char Int deriving (Eq, Ord, Ix)
data Piece = Piece { piecetype :: PieceType, color :: PieceColor } | Empty
writeToArray :: [Piece] ->(Array Pos Piece)
writeToArray (x:xs) = (((Pos 'a' 1), (Pos 'h' 8)) [((Pos char int), x) | char <- ['a'..'h'], int <- [1..8]])` : writeToArray (xs)
和错误它给:
Couldn't match expected type `Array Pos Piece' with actual type '[a0]'
所有帮助是极大的赞赏
结果类型是一个列表。 – arrowd