/usr/lib/hugs/packages/HaXml/programs/CanonicaliseLazy/Main.hs is in libhugs-haxml-bundled 98.200609.21-5.4+b3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | module Main where
import IO
import List (isSuffixOf)
import Text.XML.HaXml.ParseLazy (xmlParse)
import Text.XML.HaXml.Html.ParseLazy (htmlParse)
import Text.XML.HaXml.Wrappers (fix2Args)
import Text.PrettyPrint.HughesPJ (render)
import qualified Text.XML.HaXml.Pretty as XmlPP
import qualified Text.XML.HaXml.Html.Pretty as HtmlPP
-- This is just a trivial application that reads an XML or HTML document
-- from a file (or stdin) and writes it back to another file (or stdout).
-- It demonstrates the behaviour of the parser and pretty-printer,
-- including any shortcomings they may have.
main =
fix2Args >>= \(inf,outf)->
( if inf=="-" then getContents
else readFile inf ) >>= \content->
( if outf=="-" then return stdout
else openFile outf WriteMode ) >>= \o->
let (parse,format) =
if ".html" `isSuffixOf` inf || ".htm" `isSuffixOf` inf
then (htmlParse inf, HtmlPP.document)
else (xmlParse inf, XmlPP.document)
in
do ( mapM_ (hPutStrLn o) . lines . render . format . parse) content
hFlush o
|