It is only a skeleton of program. I have main function, that
State [Dec] [Dec]
mainCon = do
acc <- get
put []
modify $ (++) [some func]
return acc
On one stage I call function:
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')
and want to modify State in mainCon, but continue traverse map'. The error is:
No instance for (MonadState [Dec] [])
arising from a use of ‘Control.Monad.State.modify’
In the expression: Control.Monad.State.modify
[Dec] from Template Haskell. How can I simply solve this problem?