私は Yesod で QuasiQuotations を使用していましたが、すべてうまくいきました。しかし、私のファイルは非常に大きくなり、見た目が良くありません。また、私の TextEditor はこの構文を正しく強調表示しません。それが私のファイルを次のように分割する理由です:
getHomeR :: Handler Html
getHomeR = do
webSockets chatApp
defaultLayout $ do
$(luciusFile "templates/chat.lucius")
$(juliusFile "templates/chat.julius")
$(hamletFile "templates/chat.hamlet")
これが間違っている場合は、教えてください。runghc myFile.hs
実行すると、次のような多くのエラーがスローされます。
chat_new.hs:115:9:
Couldn't match expected type ‘t0 -> Css’
with actual type ‘WidgetT App IO a0’
The lambda expression ‘\ _render_ajFK
-> (shakespeare-2.0.7:Text.Css.CssNoWhitespace . (foldr ($) ...))
...’
has one argument,
but its type ‘WidgetT App IO a0’ has none
In a stmt of a 'do' block:
\ _render_ajFK
...
この。
chat_new.hs:116:9:
Couldn't match type ‘(url0 -> [(Text, Text)] -> Text)
-> Javascript’
with ‘WidgetT App IO a1’
Expected type: WidgetT App IO a1
Actual type: JavascriptUrl url0
Probable cause: ‘asJavascriptUrl’ is applied to too few arguments
...
また、HTML (Hamlet) 用のものもあります。
したがって、テンプレートごとに 1 つです。