2017-06-03から1日間の記事一覧
htmlの最初 <html lang="ja"> <head> <meta charset="UTF-8"> <title>title</title> </head> <body> </body> </html>
単純に関数に代入してhtmlを作ってみたがお世辞にも簡潔には書けなかった。。 import Data.List main = putStrLn html tag_doctype = "\n" tag_html txt = "\n<html>\n" ++ txt ++ "\n</html>\n" tag_head txt = "\n<head>\n" ++ txt ++ "\n</head>\n" tag_body txt = "\n<body>\n" ++ txt ++</body>…
データ型と型クラスを使って少しまとめてみた。 同じようなコードを書かなくてはいけなくて面倒に感じる。 良い方法はないのだろうか。 import Data.List main = print (tag_doctype ++ html) tag_doctype = "" html = string (HTML [header,body]) header =…