4
我想從字符串中讀取HTML,處理它並使用HXT將字符串作爲字符串返回。由於此操作不需要IO,我寧願執行箭頭runLA
而不是runX
。HXT:以純代碼讀取和寫入HTML到字符串時的令人驚訝的行爲
的代碼看起來是這樣的(省略爲了簡化處理):
runLA (hread >>> writeDocumentToString [withOutputHTML, withIndent yes]) html
然而,周邊html
標籤在結果丟失:
["\n <head>\n <title>Bogus</title>\n </head>\n <body>\n Some trivial bogus text.\n </body>\n",""]
當我使用RUNX代替這樣:
runX (readString [] html >>> writeDocumentToString [withOutputHTML, withIndent yes])
我得到預期的結果:
["<html>\n <head>\n <title>Bogus</title>\n </head>\n <body>\n Some trivial bogus text.\n </body>\n</html>\n"]
這是爲什麼,我該如何解決?