diff --git a/lib/Data/XML/Types.hs b/lib/Data/XML/Types.hs
--- a/lib/Data/XML/Types.hs
+++ b/lib/Data/XML/Types.hs
@@ -1,4 +1,7 @@
+{-# LANGUAGE CPP #-}
 {-# LANGUAGE DeriveDataTypeable #-}
+-- if impl(ghc >= 7.2):
+--   extensions: DeriveGeneric, StandaloneDeriving
 
 -- |
 -- Module: Data.XML.Types
@@ -78,6 +81,10 @@
 import           Data.Typeable (Typeable)
 import           Control.DeepSeq (NFData(rnf))
 
+#if MIN_VERSION_base(4,4,0)
+import           GHC.Generics (Generic)
+#endif
+
 data Document = Document
 	{ documentPrologue :: Prologue
 	, documentRoot :: Element
@@ -88,6 +95,10 @@
 instance NFData Document where
 	rnf (Document a b c) = rnf a `seq` rnf b `seq` rnf c `seq` ()
 
+#if MIN_VERSION_base(4,4,0)
+deriving instance Generic Document
+#endif
+
 data Prologue = Prologue
 	{ prologueBefore :: [Miscellaneous]
 	, prologueDoctype :: Maybe Doctype
@@ -98,6 +109,10 @@
 instance NFData Prologue where
 	rnf (Prologue a b c) = rnf a `seq` rnf b `seq` rnf c `seq` ()
 
+#if MIN_VERSION_base(4,4,0)
+deriving instance Generic Prologue
+#endif
+
 data Instruction = Instruction
 	{ instructionTarget :: Text
 	, instructionData :: Text
@@ -107,6 +122,10 @@
 instance NFData Instruction where
 	rnf (Instruction a b) = rnf a `seq` rnf b `seq` ()
 
+#if MIN_VERSION_base(4,4,0)
+deriving instance Generic Instruction
+#endif
+
 data Miscellaneous
 	= MiscInstruction Instruction
 	| MiscComment Text
@@ -116,6 +135,10 @@
 	rnf (MiscInstruction a) = rnf a `seq` ()
 	rnf (MiscComment a)     = rnf a `seq` ()
 
+#if MIN_VERSION_base(4,4,0)
+deriving instance Generic Miscellaneous
+#endif
+
 data Node
 	= NodeElement Element
 	| NodeInstruction Instruction
@@ -129,6 +152,10 @@
 	rnf (NodeContent a)     = rnf a `seq` ()
 	rnf (NodeComment a)     = rnf a `seq` ()
 
+#if MIN_VERSION_base(4,4,0)
+deriving instance Generic Node
+#endif
+
 data Element = Element
 	{ elementName :: Name
 	, elementAttributes :: [(Name, [Content])]
@@ -139,6 +166,10 @@
 instance NFData Element where
 	rnf (Element a b c) = rnf a `seq` rnf b `seq` rnf c `seq` ()
 
+#if MIN_VERSION_base(4,4,0)
+deriving instance Generic Element
+#endif
+
 data Content
 	= ContentText Text
 	| ContentEntity Text -- ^ For pass-through parsing
@@ -148,6 +179,10 @@
 	rnf (ContentText a)   = rnf a `seq` ()
 	rnf (ContentEntity a) = rnf a `seq` ()
 
+#if MIN_VERSION_base(4,4,0)
+deriving instance Generic Content
+#endif
+
 -- | A fully qualified name.
 --
 -- Prefixes are not semantically important; they are included only to
@@ -186,6 +221,10 @@
 instance NFData Name where
 	rnf (Name a b c) = rnf a `seq` rnf b `seq` rnf c `seq` ()
 
+#if MIN_VERSION_base(4,4,0)
+deriving instance Generic Name
+#endif
+
 -- | Note: due to the incredible complexity of DTDs, this type only supports
 -- external subsets. I've tried adding internal subset types, but they
 -- quickly gain more code than the rest of this module put together.
@@ -201,6 +240,10 @@
 instance NFData Doctype where
 	rnf (Doctype a b) = rnf a `seq` rnf b `seq` ()
 
+#if MIN_VERSION_base(4,4,0)
+deriving instance Generic Doctype
+#endif
+
 data ExternalID
 	= SystemID Text
 	| PublicID Text Text
@@ -210,6 +253,10 @@
 	rnf (SystemID a)   = rnf a `seq` ()
 	rnf (PublicID a b) = rnf a `seq` rnf b `seq` ()
 
+#if MIN_VERSION_base(4,4,0)
+deriving instance Generic ExternalID
+#endif
+
 -- | Some XML processing tools are incremental, and work in terms of events
 -- rather than node trees. The 'Event' type allows a document to be fully
 -- specified as a sequence of events.
@@ -244,6 +291,10 @@
 	rnf (EventComment a)        = rnf a `seq` ()
 	rnf (EventCDATA a)          = rnf a `seq` ()
 	rnf _                       = ()
+
+#if MIN_VERSION_base(4,4,0)
+deriving instance Generic Event
+#endif
 
 isElement :: Node -> [Element]
 isElement (NodeElement e) = [e]
diff --git a/xml-types.cabal b/xml-types.cabal
--- a/xml-types.cabal
+++ b/xml-types.cabal
@@ -1,5 +1,5 @@
 name: xml-types
-version: 0.3.4
+version: 0.3.5
 synopsis: Basic types for representing XML
 license: MIT
 license-file: license.txt
@@ -19,11 +19,14 @@
 source-repository this
   type: git
   location: https://john-millikin.com/code/haskell-xml-types/
-  tag: xml-types_0.3.4
+  tag: xml-types_0.3.5
 
 library
   ghc-options: -Wall
   hs-source-dirs: lib
+
+  if impl(ghc >= 7.2)
+    extensions: DeriveGeneric, StandaloneDeriving
 
   build-depends:
       base >= 3.0 && < 5.0
