How does one inspect values inside the Handler Mon

2019-09-09 12:46发布

I have a type Handler [Maybe AvailableDay] I would like to inspect the contents of [Maybe AvailableDay] in ghci. How do I do that?

1条回答
SAY GOODBYE
2楼-- · 2019-09-09 13:47

You cannot simply extract the "contents" of a Handler, as a Handler is really a computation which can depend on the current request, session state and so on. So in order to run it, you'd have to feed it all of that. This would involve using runHandler, followed by unYesodApp, and run on the resulting Iteratee. Technically possible, but incredibly messy to do on your own.

If you don't think the value is depending on any of that, then you should be able to rewrite it as a pure computation or one in the IO monad, which should be a lot simpler to run.

查看更多
登录 后发表回答