git.iko.soy/typeable/xml-isogen
on master help sign in
Rename Both to ParserAndGenerator (#27)

commit89f3d89df563d640680c84fb4410eac2fe5517cb authorYuras <shumovichy@gmail.com> dateThu 20 Feb 2020, 12:07 (7 years ago) parent92aae10
5 files changed+18−10
.gitignore+4 CHANGELOG.md+4 src/Data/THGen/XML.hs+3−3 src/Data/THGen/XML/Internal.hs+3−3 test/TestDefs.hs+4−4
.gitignore+4
@@ -3,3 +3,7 @@ dist
33.stack-work
44.cabal-sandbox/
55cabal.sandbox.config
6+
7+# vim backup and swap files
8+*~
9+.*.swp
CHANGELOG.md+4
@@ -1,6 +1,10 @@
11HEAD
22------
33
4+* Rename Both to ParserAndGenerator (#27)
5+* Add Nillable newtype (#24)
6+* Include digits in the auto-gerenated prefix (#22)
7+
480.3.0
59------
610
src/Data/THGen/XML.hs+3−3
@@ -22,7 +22,7 @@ wrapper around the field type:
2222
2323Example 1.
2424
25−> "Color" =:= enum Both
25+> "Color" =:= enum ParserAndGenerator
2626> & "R"
2727> & "G"
2828> & "B"
@@ -40,7 +40,7 @@ to be either @R@, @G@ or @B@.
4040
4141Example 2.
4242
43−> "Message" =:= record Both
43+> "Message" =:= record ParserAndGenerator
4444> ! "author"
4545> + "recipient"
4646> ? "message" [t|Text|]
@@ -93,7 +93,7 @@ The type of the field is inferred automatically from its name, so
9393if the field is called @"author"@ its type will be @Author@. You can
9494override the type by specifying it in quasiquotes like so:
9595
96−> "Message" =:= record Both
96+> "Message" =:= record ParserAndGenerator
9797> ! "author" [t|Person|].
9898> ...
9999
src/Data/THGen/XML/Internal.hs+3−3
@@ -24,7 +24,7 @@ import Text.XML.ParentAttributes
2424import qualified Text.XML.Writer as XW
2525
2626
27−data GenType = Parser | Generator | Both
27+data GenType = Parser | Generator | ParserAndGenerator
2828
2929data XmlFieldPlural
3030 = XmlFieldPluralMandatory -- Occurs exactly 1 time (Identity)
@@ -230,7 +230,7 @@ isoXmlGenerateEnum genType (ExhaustivenessName strName' exh) enumCons = do
230230 fromDomInst <- genFromDomInst
231231 fromAttributeInst <- genFromAttributeInst
232232 return $ enumDecls ++ [fromDomInst, fromAttributeInst]
233− Both -> do
233+ ParserAndGenerator -> do
234234 toXmlInst <- genToXmlInst
235235 toXmlAttributeInst <- genToXmlAttributeInst
236236 fromDomInst <- genFromDomInst
@@ -398,7 +398,7 @@ isoXmlGenerateDatatype genType (PrefixName strName' strPrefix') descRecordParts
398398 Parser -> do
399399 fromDomInst <- genFromDomInst
400400 return $ [termDecl] ++ lensDecls ++ [fromDomInst, nfDataInst]
401− Both -> do
401+ ParserAndGenerator -> do
402402 toXmlInst <- genToXmlInst
403403 toXmlParentAttributesInst <- genToXmlParentAttributeInst
404404 fromDomInst <- genFromDomInst
test/TestDefs.hs+4−4
@@ -9,11 +9,11 @@ import Data.THGen.XML
99import Test.QuickCheck.Arbitrary.Generic
1010import Test.QuickCheck.Instances ()
1111
12−"Bar" =:= enum Both
12+"Bar" =:= enum ParserAndGenerator
1313 & "baroque"
1414 & "bartender"
1515
16−"Quux" Exhaustive =:= enum Both
16+"Quux" Exhaustive =:= enum ParserAndGenerator
1717 & "ALL"
1818 & "YOUR"
1919 & "BASE"
@@ -22,14 +22,14 @@ import Test.QuickCheck.Instances ()
2222 & "TO"
2323 & "US"
2424
25−"Foo" =:= record Both
25+"Foo" =:= record ParserAndGenerator
2626 ^ "Shmuux" [t|XmlQuux|]
2727 + "Bar"
2828 ? "Baz" [t|Text|]
2929 !% "Quux"
3030 ?% "Muux" [t|XmlQuux|]
3131
32−"Root" =:= record Both
32+"Root" =:= record ParserAndGenerator
3333 ! "{http://example.com/ns/my-namespace}Foo"
3434
3535instance Arbitrary XmlRoot where