Exceptions in Yesod

后端 未结 1 1780
Happy的楠姐
Happy的楠姐 2021-01-31 06:39

I had made a daemon that used a very primitive form of ipc (telnet and send a String that had certain words in a certain order). I snapped out of it and am now usin

1条回答
  •  孤独总比滥情好
    2021-01-31 07:22

    Philosophically speaking, in the Haskell/Yesod world you want to pass the values forward, rather than return them backwards. So instead of having the handlers return a value, have them call forwards to the next step in the process, which may be to generate an exception.

    Remember that you can bundle any amount of future actions into a single object, so you can pass a continuation object to your handlers and foos that basically tells them, "After you are done, run this blob of code." That way they can be void and return nothing.

    0 讨论(0)
提交回复
热议问题