X-Git-Url: http://git.cielonegro.org/gitweb.cgi?p=hxt-compile.git;a=blobdiff_plain;f=Text%2FXML%2FHXT%2FCompilation.hs;fp=Text%2FXML%2FHXT%2FCompilation.hs;h=c2428de92137d65c3e6904bf749b96ed35337224;hp=01e13e28b48ead8dd963a5cc6f4220ea75d49e4f;hb=13dc5a370f4d7d3223937346fc63ce94c8aa85a8;hpb=107cd29639a348397eef214bd7e8e6eaa0d9f701 diff --git a/Text/XML/HXT/Compilation.hs b/Text/XML/HXT/Compilation.hs index 01e13e2..c2428de 100644 --- a/Text/XML/HXT/Compilation.hs +++ b/Text/XML/HXT/Compilation.hs @@ -11,6 +11,8 @@ import Text.XML.HXT.Compilation.XmlTree compileDocument :: ArrowXml a => a XmlTree (HsQualType, HsExp) compileDocument = uniqueNamespacesFromDeclAndQNames + >>> + filterOutRootAttrs >>> ( constA (HsQualType [] (HsTyCon (UnQual (HsIdent "XmlTree")))) &&& @@ -18,6 +20,12 @@ compileDocument = uniqueNamespacesFromDeclAndQNames ) +filterOutRootAttrs :: ArrowXml a => a XmlTree XmlTree +filterOutRootAttrs = processTopDownUntil (clearAttrs `when` isRoot) + where + clearAttrs = processAttrl none + + wrapIntoModule :: Arrow a => a (Module, ([HsImportDecl], (HsName, (HsQualType, HsExp)))) HsModule wrapIntoModule = proc (modName, (extImports, (symName, (symType, symExp)))) -> do let hsModule = HsModule undefined modName (Just exports) imports decls