on master help sign in
Minor renaming
249abb2Bryan O'Sullivan
tests/Encoders.hs+4−6
@@ -132,19 +132,17 @@ gSomeTypeParseJSONObjectWithSingleField = genericParseJSON optsObjectWithSingleF
132-- Approx encoders/decoders
132-- Approx encoders/decoders
133--------------------------------------------------------------------------------
133--------------------------------------------------------------------------------
134
134
135−type ApproxToJSON = Approx String -> Value
136−
137−thApproxToJSONUnwrap :: ToJSON a => Approx a -> Value
135+thApproxToJSONUnwrap :: Approx String -> Value
138thApproxToJSONUnwrap = $(mkToJSON optsUnwrapUnaryRecords ''Approx)
136thApproxToJSONUnwrap = $(mkToJSON optsUnwrapUnaryRecords ''Approx)
139
137
140−thApproxParseJSONUnwrap :: FromJSON a => Value -> Parser (Approx a)
138+thApproxParseJSONUnwrap :: Value -> Parser (Approx String)
141thApproxParseJSONUnwrap = $(mkParseJSON optsUnwrapUnaryRecords ''Approx)
139thApproxParseJSONUnwrap = $(mkParseJSON optsUnwrapUnaryRecords ''Approx)
142
140
143
141
144−thApproxToJSONDefault :: ToJSON a => Approx a -> Value
142+thApproxToJSONDefault :: Approx String -> Value
145thApproxToJSONDefault = $(mkToJSON defaultOptions ''Approx)
143thApproxToJSONDefault = $(mkToJSON defaultOptions ''Approx)
146
144
147−thApproxParseJSONDefault :: FromJSON a => Value -> Parser (Approx a)
145+thApproxParseJSONDefault :: Value -> Parser (Approx String)
148thApproxParseJSONDefault = $(mkParseJSON defaultOptions ''Approx)
146thApproxParseJSONDefault = $(mkParseJSON defaultOptions ''Approx)
149
147
150gApproxToJSONUnwrap :: Approx String -> Value
148gApproxToJSONUnwrap :: Approx String -> Value
tests/Properties.hs+4−4
@@ -182,11 +182,11 @@ tests = [
182 , testProperty "ObjectWithSingleField" (toParseJSON thSomeTypeParseJSONObjectWithSingleField (thSomeTypeToJSONObjectWithSingleField :: SomeTypeToJSON))
182 , testProperty "ObjectWithSingleField" (toParseJSON thSomeTypeParseJSONObjectWithSingleField (thSomeTypeToJSONObjectWithSingleField :: SomeTypeToJSON))
183 ]
183 ]
184 , testGroup "Approx" [
184 , testGroup "Approx" [
185− testProperty "string" (isString . (thApproxToJSONUnwrap ::ApproxToJSON))
185+ testProperty "string" (isString . thApproxToJSONUnwrap)
186− , testProperty "ObjectWithSingleField" (isObjectWithSingleField . (thApproxToJSONDefault ::ApproxToJSON))
186+ , testProperty "ObjectWithSingleField" (isObjectWithSingleField . thApproxToJSONDefault)
187 , testGroup "roundTrip" [
187 , testGroup "roundTrip" [
188− testProperty "string" (toParseJSON thApproxParseJSONUnwrap (thApproxToJSONUnwrap ::ApproxToJSON))
188+ testProperty "string" (toParseJSON thApproxParseJSONUnwrap thApproxToJSONUnwrap)
189− , testProperty "ObjectWithSingleField" (toParseJSON thApproxParseJSONDefault (thApproxToJSONDefault ::ApproxToJSON))
189+ , testProperty "ObjectWithSingleField" (toParseJSON thApproxParseJSONDefault thApproxToJSONDefault)
190 ]
190 ]
191 ]
191 ]
192 ]
192 ]