Yesod, withAsync

I am new to Haskell and Yesod, and I'm trying to use the module Control.Concurrent.Asyncto work with async. (code based on: https://hackage.haskell.org/package/async-2.1.1/docs/Control-Concurrent-Async.html#v: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")

But this leads to the following error:

"There is no instance for (MonadWidget IO) resulting from the use of" toWidget ".

So the question is what am I doing wrong?

+4
source share
1 answer

API async , IO. WidgetT, . lifted-async, withAsync. :

  • Control.Concurrent.Async.Lifted
  • lifted-async build-depends
+5

Source: https://habr.com/ru/post/1671000/


All Articles