私はblaze-htmlチュートリアルに取り組んでいます。シンプルな Hello World ページが欲しいだけです。
{-# LANGUAGE OverloadedStrings #-}
import Control.Monad (forM_)
import Text.Blaze.Html5
import Text.Blaze.Html5.Attributes
import qualified Text.Blaze.Html5 as H
import qualified Text.Blaze.Html5.Attributes as A
import Text.Blaze.Html.Renderer.Text
notes :: Html
notes = docTypeHtml $ do
H.head $ do
H.title "John´ s Page"
body $ do
p "Hello World!"
それはどこにある?HTML を取得するにはどうすればよいですか? ターミナルまたはファイルに出力できますか? それは素晴らしいスタートになるでしょう。
<html>
<head><title>John's Page</title></head>
<body><p>Hello World!</p></body>
</html>
そして、すべてのインポートステートメントは本当に必要ですか? 私はそれを機能させたいだけです。
関数を使用して印刷しようとしましたrenderHTML
が、エラー メッセージが表示されます。
main = (renderHtml notes) >>= putStrLn
notes.hs:21:9:
Couldn't match expected type `IO String'
with actual type `Data.Text.Internal.Lazy.Text'
In the return type of a call of `renderHtml'
In the first argument of `(>>=)', namely `(renderHtml notes)'
In the expression: (renderHtml notes) >>= putStrLn