on 5ee3f5c help sign in
3 files changed+14−20
since splitsnapshots
unifiedsplit
src/Data/THGen/XML.hs+7−12 src/Data/THGen/XML/Internal.hs+3−4 test/TestDefs.hs+4−4
src/Data/THGen/XML.hs+7−12
@@ -22,7 +22,7 @@ wrapper around the field type:
2222
2323Example 1.
2424
25−> "Color" =:= enum Both
25+> "Color" =:= enum
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
4444> ! "author"
4545> + "recipient"
4646> ? "message" [t|Text|]
@@ -67,10 +67,10 @@ enumeration is exhaustive (contains only the listed constructors) or
6767non-exhaustive (also contains a constructor for unknown values; this
6868is the default):
6969
70−> "Enum1" Exhaustive =:= enum Generator
70+> "Enum1" Exhaustive =:= enum
7171> ...
7272
73−> "Enum2" NonExhaustive =:= enum Generator
73+> "Enum2" NonExhaustive =:= enum
7474> ...
7575
7676To 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
7878inferred automatically by taking all of the uppercase letters in the
7979name. You can override it manually like so:
8080
81−> "Reference" "ref" =:= record Parser
81+> "Reference" "ref" =:= record
8282> ...
8383
8484To describe a record field you must supply its name as it appears
@@ -93,14 +93,10 @@ 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
97−> ! "author" [t|Person|].
96+> "Message" =:= record
97+> ! "author" [t|Person|]
9898> ...
9999
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.
103−
104100-}
105101
106102
@@ -108,7 +104,6 @@ module Data.THGen.XML
108104 ( Exhaustiveness(..)
109105 , PrefixName(..)
110106 , ExhaustivenessName(..)
111− , GenType(..)
112107 , record
113108 , enum
114109 , (!)
src/Data/THGen/XML/Internal.hs+3−4
@@ -1,4 +1,3 @@
1−{-# LANGUAGE CPP #-}
21{-# LANGUAGE UndecidableInstances #-}
32{-# LANGUAGE FunctionalDependencies #-}
43
@@ -380,11 +379,11 @@ isoXmlGenerateDatatype genType (PrefixName strName' strPrefix') descRecordParts
380379 toXmlParentAttributesExpr
381380 = TH.lamE [if null exprAttributes then TH.wildP else TH.varP objName]
382381 $ [e|mapMaybe distribPair $(TH.listE exprAttributes)|]
383−#if __GLASGOW_HASKELL__ < 800
382+ #if __GLASGOW_HASKELL__ < 800
384383 TH.instanceD
385−#else
384+ #else
386385 TH.instanceWithOverlapD (Just TH.Overlapping)
387−#endif
386+ #endif
388387 (return [])
389388 [t|ToXmlParentAttributes $(TH.conT name)|]
390389 [funSimple 'toXmlParentAttributes toXmlParentAttributesExpr]
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
1313 & "baroque"
1414 & "bartender"
1515
16−"Quux" Exhaustive =:= enum Both
16+"Quux" Exhaustive =:= enum
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
2626 ^ "Shmuux" [t|XmlQuux|]
2727 + "Bar"
2828 ? "Baz" [t|Text|]
2929 !% "Quux"
3030 ?% "Muux" [t|XmlQuux|]
3131
32−"Root" =:= record Both
32+"Root" =:= record
3333 ! "{http://example.com/ns/my-namespace}Foo"
3434
3535instance Arbitrary XmlRoot where