Yesod's shakespearean templates (hamlet) and IO

前端 未结 1 844
谎友^
谎友^ 2021-01-20 16:59

In Hamlet, how does one uses the result of an IO operation inside #{...} ?

For instance :

someIO :: IO String
-----------------

$with s         


        
1条回答
  •  渐次进展
    2021-01-20 17:24

    Hamlet is just providing an alternate syntax for normal Haskell code, so like normal Haskell, you have to keep your impure actions separate. In other words, you need to run the IO action outside of the template.

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