私はこの機能があります:問題がある可能性がどのようなHaskellのデータ型エラー
Couldn't match expected type `(a, b)'
against inferred type `Memory -> Point'
In the first argument of `fst', namely `currentPoz'
In the first argument of `($)', namely `fst currentPoz'
In the expression: fst currentPoz $ currentPoz m
:
data Memory = Memory
{visited::[Point]
,dfsstack::[Point]
,currentPoz::Point
}deriving(Eq)
perceiveAndAct :: SVal -> [Cardinal] -> a -> (Action, a)
perceiveAndAct s cs m
| elem W cs == True && elem N cs == True && elem E cs == True && elem S cs == False = (Just S, Memory (visited m) (dfsstack m) (currentPoz m))
はメートルを置く代わりにMemory (visited m) (dfsstack m) (currentPoz m)
は、それが私のことを与えて、他の、正常に動作しますか?
エラーメッセージが参照している 'fst currentPoz $ currentPos m'はどこですか? – hammar
Btwはどこにでも 'blah == True'を持っています。単純に' blah'に単純化することができます(例えば 'elem W cs == True'を' elem W cs'に単純化する)。同様に、 'elem S cs == False'を' notElem S cs'に単純化することもできます。 – dave4420