moduleText.Roundtrip.Xml.ParserInternal(PxState,PxParser,GenXmlParser(..),AttrMap,RtEvent(..),WithPos(..),RtEventWithPos,EventWithPos,eventWithPos,eventWithoutPos)whereimportData.XML.TypesimportqualifiedData.TextasTimportText.PrettyPrint.HughesPJimportText.Roundtrip.ParserimportText.Roundtrip.Xml.PrettytypePxState=MaybeAttrMaptypePxParsersma=PParsersPxStatemanewtypeGenXmlParsersma=GenXmlParser(PxParsersma)typeAttrMap=[(Name,T.Text)]dataRtEvent=RtBeginDocument|RtEndDocument|RtBeginElementNameAttrMap|RtTextT.Text|RtEndElementName|RtInvalidEntityT.Textderiving(Eq)instancePrettyRtEventwhereppRtBeginDocument=text"begin-document"ppRtEndDocument=text"end-document"pp(RtBeginElementnm)=text"<"<>ppn<>(ifnullmthenemptyelsePrelude.foldl(\d(n,t)->d<+>ppn<>text"="<>doubleQuotes(text(T.unpackt)))(text"")m)<>text">"pp(RtTextt)=text"text"<>parens(shorten32t)whereshortennt|T.lengtht<=n=text(T.unpackt)|otherwise=text(T.unpack(T.takent))<+>text"..."pp(RtEndElementn)=text"</"<>ppn<>text">"instanceShowRtEventwhereshowsPrec_ev=showString(render(ppev))dataWithPosa=WithPos{wp_data::a,wp_pos::SourcePos}eventWithPos::a->SourceName->Line->Column->WithPosaeventWithPosxslc=WithPosx(newPosslc)eventWithoutPos::a->WithPosaeventWithoutPosx=WithPosx(newPos""(-1)(-1))typeEventWithPos=WithPosEventtypeRtEventWithPos=WithPosRtEventinstancePrettya=>Pretty(WithPosa)wherepp(WithPosap)=ppa<+>text" at "<+>text(showp)instancePrettya=>Show(WithPosa)whereshowsPrec_p=showString(render(ppp))