@@ -94,14 +94,14 @@ is2ElemArray :: Value -> Bool
9494is2ElemArray (Array v) = V.length v == 2 && isString (V.head v)
9595is2ElemArray _ = False
9696
97−isObjectWithTypeValue :: Value -> Bool
98−isObjectWithTypeValue (Object obj) = "type" `H.member` obj &&
99− "value" `H.member` obj
100−isObjectWithTypeValue _ = False
97+isTaggedObjectValue :: Value -> Bool
98+isTaggedObjectValue (Object obj) = "tag" `H.member` obj &&
99+ "contents" `H.member` obj
100+isTaggedObjectValue _ = False
101101
102−isObjectWithType :: Value -> Bool
103−isObjectWithType (Object obj) = "type" `H.member` obj
104−isObjectWithType _ = False
102+isTaggedObject :: Value -> Bool
103+isTaggedObject (Object obj) = "tag" `H.member` obj
104+isTaggedObject _ = False
105105
106106isObjectWithSingleField :: Value -> Bool
107107isObjectWithSingleField (Object obj) = H.size obj == 1
@@ -167,24 +167,24 @@ tests = [
167167 testGroup "Nullary" [
168168 testProperty "string" (isString . thNullaryToJSONString)
169169 , testProperty "2ElemArray" (is2ElemArray . thNullaryToJSON2ElemArray)
170− , testProperty "ObjectWithType" (isObjectWithTypeValue . thNullaryToJSONObjectWithType)
170+ , testProperty "TaggedObject" (isTaggedObjectValue . thNullaryToJSONTaggedObject)
171171 , testProperty "ObjectWithSingleField" (isObjectWithSingleField . thNullaryToJSONObjectWithSingleField)
172172
173173 , testGroup "roundTrip" [
174174 testProperty "string" (toParseJSON thNullaryParseJSONString thNullaryToJSONString)
175175 , testProperty "2ElemArray" (toParseJSON thNullaryParseJSON2ElemArray thNullaryToJSON2ElemArray)
176− , testProperty "ObjectWithType" (toParseJSON thNullaryParseJSONObjectWithType thNullaryToJSONObjectWithType)
176+ , testProperty "TaggedObject" (toParseJSON thNullaryParseJSONTaggedObject thNullaryToJSONTaggedObject)
177177 , testProperty "ObjectWithSingleField" (toParseJSON thNullaryParseJSONObjectWithSingleField thNullaryToJSONObjectWithSingleField)
178178 ]
179179 ]
180180 , testGroup "SomeType" [
181181 testProperty "2ElemArray" (is2ElemArray . (thSomeTypeToJSON2ElemArray :: SomeTypeToJSON))
182− , testProperty "ObjectWithType" (isObjectWithType . (thSomeTypeToJSONObjectWithType :: SomeTypeToJSON))
182+ , testProperty "TaggedObject" (isTaggedObject . (thSomeTypeToJSONTaggedObject :: SomeTypeToJSON))
183183 , testProperty "ObjectWithSingleField" (isObjectWithSingleField . (thSomeTypeToJSONObjectWithSingleField :: SomeTypeToJSON))
184184
185185 , testGroup "roundTrip" [
186186 testProperty "2ElemArray" (toParseJSON thSomeTypeParseJSON2ElemArray (thSomeTypeToJSON2ElemArray :: SomeTypeToJSON))
187− , testProperty "ObjectWithType" (toParseJSON thSomeTypeParseJSONObjectWithType (thSomeTypeToJSONObjectWithType :: SomeTypeToJSON))
187+ , testProperty "TaggedObject" (toParseJSON thSomeTypeParseJSONTaggedObject (thSomeTypeToJSONTaggedObject :: SomeTypeToJSON))
188188 , testProperty "ObjectWithSingleField" (toParseJSON thSomeTypeParseJSONObjectWithSingleField (thSomeTypeToJSONObjectWithSingleField :: SomeTypeToJSON))
189189 ]
190190 ]
@@ -193,34 +193,34 @@ tests = [
193193 testGroup "Nullary" [
194194 testProperty "string" (isString . gNullaryToJSONString)
195195 , testProperty "2ElemArray" (is2ElemArray . gNullaryToJSON2ElemArray)
196− , testProperty "ObjectWithType" (isObjectWithTypeValue . gNullaryToJSONObjectWithType)
196+ , testProperty "TaggedObject" (isTaggedObjectValue . gNullaryToJSONTaggedObject)
197197 , testProperty "ObjectWithSingleField" (isObjectWithSingleField . gNullaryToJSONObjectWithSingleField)
198198 , testGroup "eq" [
199199 testProperty "string" (\n -> gNullaryToJSONString n == thNullaryToJSONString n)
200200 , testProperty "2ElemArray" (\n -> gNullaryToJSON2ElemArray n == thNullaryToJSON2ElemArray n)
201− , testProperty "ObjectWithType" (\n -> gNullaryToJSONObjectWithType n == thNullaryToJSONObjectWithType n)
201+ , testProperty "TaggedObject" (\n -> gNullaryToJSONTaggedObject n == thNullaryToJSONTaggedObject n)
202202 , testProperty "ObjectWithSingleField" (\n -> gNullaryToJSONObjectWithSingleField n == thNullaryToJSONObjectWithSingleField n)
203203 ]
204204 , testGroup "roundTrip" [
205205 testProperty "string" (toParseJSON gNullaryParseJSONString gNullaryToJSONString)
206206 , testProperty "2ElemArray" (toParseJSON gNullaryParseJSON2ElemArray gNullaryToJSON2ElemArray)
207− , testProperty "ObjectWithType" (toParseJSON gNullaryParseJSONObjectWithType gNullaryToJSONObjectWithType)
207+ , testProperty "TaggedObject" (toParseJSON gNullaryParseJSONTaggedObject gNullaryToJSONTaggedObject)
208208 , testProperty "ObjectWithSingleField" (toParseJSON gNullaryParseJSONObjectWithSingleField gNullaryToJSONObjectWithSingleField)
209209 ]
210210 ]
211211 , testGroup "SomeType" [
212212 testProperty "2ElemArray" (is2ElemArray . (gSomeTypeToJSON2ElemArray :: SomeTypeToJSON))
213− , testProperty "ObjectWithType" (isObjectWithType . (gSomeTypeToJSONObjectWithType :: SomeTypeToJSON))
213+ , testProperty "TaggedObject" (isTaggedObject . (gSomeTypeToJSONTaggedObject :: SomeTypeToJSON))
214214 , testProperty "ObjectWithSingleField" (isObjectWithSingleField . (gSomeTypeToJSONObjectWithSingleField :: SomeTypeToJSON))
215215
216216 , testGroup "eq" [
217217 testProperty "2ElemArray" (\n -> (gSomeTypeToJSON2ElemArray :: SomeTypeToJSON) n == thSomeTypeToJSON2ElemArray n)
218− , testProperty "ObjectWithType" (\n -> (gSomeTypeToJSONObjectWithType :: SomeTypeToJSON) n == thSomeTypeToJSONObjectWithType n)
218+ , testProperty "TaggedObject" (\n -> (gSomeTypeToJSONTaggedObject :: SomeTypeToJSON) n == thSomeTypeToJSONTaggedObject n)
219219 , testProperty "ObjectWithSingleField" (\n -> (gSomeTypeToJSONObjectWithSingleField :: SomeTypeToJSON) n == thSomeTypeToJSONObjectWithSingleField n)
220220 ]
221221 , testGroup "roundTrip" [
222222 testProperty "2ElemArray" (toParseJSON gSomeTypeParseJSON2ElemArray (gSomeTypeToJSON2ElemArray :: SomeTypeToJSON))
223− , testProperty "ObjectWithType" (toParseJSON gSomeTypeParseJSONObjectWithType (gSomeTypeToJSONObjectWithType :: SomeTypeToJSON))
223+ , testProperty "TaggedObject" (toParseJSON gSomeTypeParseJSONTaggedObject (gSomeTypeToJSONTaggedObject :: SomeTypeToJSON))
224224 , testProperty "ObjectWithSingleField" (toParseJSON gSomeTypeParseJSONObjectWithSingleField (gSomeTypeToJSONObjectWithSingleField :: SomeTypeToJSON))
225225 ]
226226 ]