@@ -22,7 +22,7 @@ wrapper around the field type:
25−> "Color" =:= enum
25+> "Color" =:= enum Both
@@ -40,7 +40,7 @@ to be either @R@, @G@ or @B@.
43−> "Message" =:= record
43+> "Message" =:= record Both
44> ! "author"
44> ! "author"
45> + "recipient"
45> + "recipient"
46> ? "message" [t|Text|]
46> ? "message" [t|Text|]
@@ -67,10 +67,10 @@ enumeration is exhaustive (contains only the listed constructors) or
67non-exhaustive (also contains a constructor for unknown values; this
67non-exhaustive (also contains a constructor for unknown values; this
68is the default):
68is the default):
70−> "Enum1" Exhaustive =:= enum
70+> "Enum1" Exhaustive =:= enum Generator
73−> "Enum2" NonExhaustive =:= enum
73+> "Enum2" NonExhaustive =:= enum Generator
76To define a record, use the `record` function followed by the name of
76To define a record, use the `record` function followed by the name of
@@ -78,7 +78,7 @@ the data type to be generated. The prefix for the record fields is
78inferred automatically by taking all of the uppercase letters in the
78inferred automatically by taking all of the uppercase letters in the
79name. You can override it manually like so:
79name. You can override it manually like so:
81−> "Reference" "ref" =:= record
81+> "Reference" "ref" =:= record Parser
84To describe a record field you must supply its name as it appears
84To describe a record field you must supply its name as it appears
@@ -93,10 +93,14 @@ The type of the field is inferred automatically from its name, so
93if the field is called @"author"@ its type will be @Author@. You can
93if the field is called @"author"@ its type will be @Author@. You can
94override the type by specifying it in quasiquotes like so:
94override the type by specifying it in quasiquotes like so:
96−> "Message" =:= record
96+> "Message" =:= record Both
97−> ! "author" [t|Person|]
97+> ! "author" [t|Person|].
100+Both @record@ and @enum@ take a @GenType@ argument which tells it to generate
101+generator, parser or both. It's being used to optimize compilation time by
102+skipping the unnecessary TH instance generation.
@@ -104,6 +108,7 @@ module Data.THGen.XML
104 ( Exhaustiveness(..)
108 ( Exhaustiveness(..)
105 , PrefixName(..)
109 , PrefixName(..)
106 , ExhaustivenessName(..)
110 , ExhaustivenessName(..)