I am a complete newbie in Haskell. I am wondering why this pice of code:
main :: IO ()
main = run theWorld presentationIO
run dom showDom = do
event <- readCommand
dom' <- updateDomain dom event
showDom dom'
run dom' showDom
.. does not work and how to solve it. The error is :
simpleExampleTextGameV.0.2.hs:96:16: error:
• Couldn't match expected type ‘IO World’ with actual type ‘World’
• In a stmt of a 'do' block: dom' <- updateDomain dom event
In the expression:
do event <- readCommand
dom' <- updateDomain dom event
showDom dom'
run dom' showDom
In an equation for ‘run’:
run dom showDom
= do event <- readCommand
dom' <- updateDomain dom event
showDom dom'
....
|
96 | dom' <- updateDomain dom event
| ^^^^^^^^^^^^^^^^^^^^^^
In order to reproduce it, you could launch the rest of code: https://github.com/agutie58/landOfLispInHaskell/blob/main/simpleExampleTextGameV.0.2.hs
Thanks in advance!