0
它只是程序的一個框架。我的主要功能,即從另一個函數使用State.modify
State [Dec] [Dec]
mainCon = do
acc <- get
put []
modify $ (++) [some func]
return acc
在一個階段,我稱之爲功能:
foldlWithKey'
(\list' key' val' ->
if (...)
then
(Control.Monad.State.modify $ (Prelude.++) [elem]) >>
some code
: list')
else
(Control.Monad.State.modify $ (Prelude.++) []) >>
some code
: list')
)
[]
(map')
要修改國家在mainCon,而是繼續移圖」。錯誤是:
No instance for (MonadState [Dec] [])
arising from a use of ‘Control.Monad.State.modify’
In the expression: Control.Monad.State.modify
來自Template Haskell的[Dec]。我怎樣才能解決這個問題?
'foldWithKey''的類型簽名是什麼? – ErikR
@ErikR foldlWithKey'::(a - > k - > v - > a) - > a - > HashMap k v - > a – Ivan