4
我是一個新手,哈斯克爾&耶索德,我嘗試使用Control.Concurrent.Async
模塊做的東西異步。 (該代碼是基於:https://hackage.haskell.org/package/async-2.1.1/docs/Control-Concurrent-Async.html#v:withAsync)耶索德,withAsync
quizWidget = do
--Get first question
withAsync (showQuizItem 1 1) $ \qi -> do
withAsync (showScoreboard) $ \sb -> do
quizItem <- wait (qi)
scoreboard <- wait (sb)
toWidget $(hamletFile "hamlet/quiz.hamlet")
但是,這會產生以下錯誤:
"No instance for (MonadWidget IO) arising from a use of ‘toWidget’".
所以,問題是我究竟做錯了什麼?