xml-isogen-0.3.0: Generate XML-isomorphic types

Safe HaskellNone



class ToXmlParentAttributes a where Source #

Minimal complete definition



toXmlParentAttributes :: a -> [(Name, Text)] Source #


ToXmlParentAttributes a Source #

A catch-all instance: by default objects don't have parent attributes. The alternative solution is to write a default implementation in the class, but it has a drawback that it requires numerous (boilerplate) empty instances - one for each type that doesn't have parent attributes (most types). This overlappable instance gets overriden for XML records (described in Data.THGen.XML) because they can store parent attributes added via the !% and ?% operators. For example, toXmlParentAttributes applied to a Text or Integer value returns [] because of this instance. However, an XML record defined as Foo =:= record !% "bar" will have its own TH-generated ToXmlParentAttributes instance that inspects the value of its bar field and returns it as an attribute. This way the TH-generators can safely apply toXmlParentAttributes to any value without worrying about missing instances.


toXmlParentAttributes :: a -> [(Name, Text)] Source #