@@ -24,10 +24,11 @@ import Text.XML.ParentAttributes
2424import qualified Text.XML.Writer as XW
2525
2626
27−-- | Marks the type of code generation:
28−-- Parser - generate only instances for xml parsing (@FromDom@)
29−-- Generator - generate only @ToXML@ instances
30−-- Both - generate @FromDom@ and @ToXML@ instances
27+{- | Marks the type of code generation:
28+@Parser@ - generate only instances for xml parsing (@FromDom@)
29+@Generator@ - generate only @ToXML@ instances
30+@Both@ - generate @FromDom@ and @ToXML@ instances
31+-}
3132data GenType = Parser | Generator | Both
3233
3334{- | Marks the style of code generation regarding records fields
@@ -324,7 +325,9 @@ isoXmlGenerateDatatype
324325 -- generate a newtype instead to do less allocations later
325326 then THC.newtypeD name (TH.recC name fields) [''Eq, ''Show, ''Generic]
326327 else THC.dataD name [TH.recC name fields] [''Eq, ''Show, ''Generic]
327− lensDecls <- makeFieldOpticsForDec lensRules termDecl
328+ lensDecls <- case generateLens of
329+ NoLens -> pure []
330+ LensRenaming -> makeFieldOpticsForDec lensRules termDecl
328331 nfDataInst <- do
329332 TH.instanceD
330333 (return [])