on master help sign in
Simplify some type signatures
08fa32aBryan O'Sullivan
tests/Encoders.hs+12−14
@@ -84,47 +84,45 @@ gNullaryParseJSONObjectWithSingleField = genericParseJSON optsObjectWithSingleFi
84-- SomeType encoders/decoders
84-- SomeType encoders/decoders
85--------------------------------------------------------------------------------
85--------------------------------------------------------------------------------
86
86
87−type SomeTypeToJSON = SomeType Int -> Value
88−
89−thSomeTypeToJSON2ElemArray :: ToJSON a => SomeType a -> Value
87+thSomeTypeToJSON2ElemArray :: SomeType Int -> Value
90thSomeTypeToJSON2ElemArray = $(mkToJSON opts2ElemArray ''SomeType)
88thSomeTypeToJSON2ElemArray = $(mkToJSON opts2ElemArray ''SomeType)
91
89
92−thSomeTypeParseJSON2ElemArray :: FromJSON a => Value -> Parser (SomeType a)
90+thSomeTypeParseJSON2ElemArray :: Value -> Parser (SomeType Int)
93thSomeTypeParseJSON2ElemArray = $(mkParseJSON opts2ElemArray ''SomeType)
91thSomeTypeParseJSON2ElemArray = $(mkParseJSON opts2ElemArray ''SomeType)
94
92
95
93
96−thSomeTypeToJSONTaggedObject :: ToJSON a => SomeType a -> Value
94+thSomeTypeToJSONTaggedObject :: SomeType Int -> Value
97thSomeTypeToJSONTaggedObject = $(mkToJSON optsTaggedObject ''SomeType)
95thSomeTypeToJSONTaggedObject = $(mkToJSON optsTaggedObject ''SomeType)
98
96
99−thSomeTypeParseJSONTaggedObject :: FromJSON a => Value -> Parser (SomeType a)
97+thSomeTypeParseJSONTaggedObject :: Value -> Parser (SomeType Int)
100thSomeTypeParseJSONTaggedObject = $(mkParseJSON optsTaggedObject ''SomeType)
98thSomeTypeParseJSONTaggedObject = $(mkParseJSON optsTaggedObject ''SomeType)
101
99
102
100
103−thSomeTypeToJSONObjectWithSingleField :: ToJSON a => SomeType a -> Value
101+thSomeTypeToJSONObjectWithSingleField :: SomeType Int -> Value
104thSomeTypeToJSONObjectWithSingleField = $(mkToJSON optsObjectWithSingleField ''SomeType)
102thSomeTypeToJSONObjectWithSingleField = $(mkToJSON optsObjectWithSingleField ''SomeType)
105
103
106−thSomeTypeParseJSONObjectWithSingleField :: FromJSON a => Value -> Parser (SomeType a)
104+thSomeTypeParseJSONObjectWithSingleField :: Value -> Parser (SomeType Int)
107thSomeTypeParseJSONObjectWithSingleField = $(mkParseJSON optsObjectWithSingleField ''SomeType)
105thSomeTypeParseJSONObjectWithSingleField = $(mkParseJSON optsObjectWithSingleField ''SomeType)
108
106
109
107
110−gSomeTypeToJSON2ElemArray :: ToJSON a => SomeType a -> Value
108+gSomeTypeToJSON2ElemArray :: SomeType Int -> Value
111gSomeTypeToJSON2ElemArray = genericToJSON opts2ElemArray
109gSomeTypeToJSON2ElemArray = genericToJSON opts2ElemArray
112
110
113−gSomeTypeParseJSON2ElemArray :: FromJSON a => Value -> Parser (SomeType a)
111+gSomeTypeParseJSON2ElemArray :: Value -> Parser (SomeType Int)
114gSomeTypeParseJSON2ElemArray = genericParseJSON opts2ElemArray
112gSomeTypeParseJSON2ElemArray = genericParseJSON opts2ElemArray
115
113
116
114
117−gSomeTypeToJSONTaggedObject :: ToJSON a => SomeType a -> Value
115+gSomeTypeToJSONTaggedObject :: SomeType Int -> Value
118gSomeTypeToJSONTaggedObject = genericToJSON optsTaggedObject
116gSomeTypeToJSONTaggedObject = genericToJSON optsTaggedObject
119
117
120−gSomeTypeParseJSONTaggedObject :: FromJSON a => Value -> Parser (SomeType a)
118+gSomeTypeParseJSONTaggedObject :: Value -> Parser (SomeType Int)
121gSomeTypeParseJSONTaggedObject = genericParseJSON optsTaggedObject
119gSomeTypeParseJSONTaggedObject = genericParseJSON optsTaggedObject
122
120
123
121
124−gSomeTypeToJSONObjectWithSingleField :: ToJSON a => SomeType a -> Value
122+gSomeTypeToJSONObjectWithSingleField :: SomeType Int -> Value
125gSomeTypeToJSONObjectWithSingleField = genericToJSON optsObjectWithSingleField
123gSomeTypeToJSONObjectWithSingleField = genericToJSON optsObjectWithSingleField
126
124
127−gSomeTypeParseJSONObjectWithSingleField :: FromJSON a => Value -> Parser (SomeType a)
125+gSomeTypeParseJSONObjectWithSingleField :: Value -> Parser (SomeType Int)
128gSomeTypeParseJSONObjectWithSingleField = genericParseJSON optsObjectWithSingleField
126gSomeTypeParseJSONObjectWithSingleField = genericParseJSON optsObjectWithSingleField
129
127
130
128
tests/Properties.hs+6−6
@@ -173,13 +173,13 @@ tests = [
173 ]
173 ]
174 ]
174 ]
175 , testGroup "SomeType" [
175 , testGroup "SomeType" [
176− testProperty "2ElemArray" (is2ElemArray . (thSomeTypeToJSON2ElemArray :: SomeTypeToJSON))
176+ testProperty "2ElemArray" (is2ElemArray . thSomeTypeToJSON2ElemArray)
177− , testProperty "TaggedObject" (isTaggedObject . (thSomeTypeToJSONTaggedObject :: SomeTypeToJSON))
177+ , testProperty "TaggedObject" (isTaggedObject . thSomeTypeToJSONTaggedObject)
178− , testProperty "ObjectWithSingleField" (isObjectWithSingleField . (thSomeTypeToJSONObjectWithSingleField :: SomeTypeToJSON))
178+ , testProperty "ObjectWithSingleField" (isObjectWithSingleField . thSomeTypeToJSONObjectWithSingleField)
179 , testGroup "roundTrip" [
179 , testGroup "roundTrip" [
180− testProperty "2ElemArray" (toParseJSON thSomeTypeParseJSON2ElemArray (thSomeTypeToJSON2ElemArray :: SomeTypeToJSON))
180+ testProperty "2ElemArray" (toParseJSON thSomeTypeParseJSON2ElemArray thSomeTypeToJSON2ElemArray)
181− , testProperty "TaggedObject" (toParseJSON thSomeTypeParseJSONTaggedObject (thSomeTypeToJSONTaggedObject :: SomeTypeToJSON))
181+ , testProperty "TaggedObject" (toParseJSON thSomeTypeParseJSONTaggedObject thSomeTypeToJSONTaggedObject)
182− , testProperty "ObjectWithSingleField" (toParseJSON thSomeTypeParseJSONObjectWithSingleField (thSomeTypeToJSONObjectWithSingleField :: SomeTypeToJSON))
182+ , testProperty "ObjectWithSingleField" (toParseJSON thSomeTypeParseJSONObjectWithSingleField thSomeTypeToJSONObjectWithSingleField)
183 ]
183 ]
184 , testGroup "Approx" [
184 , testGroup "Approx" [
185 testProperty "string" (isString . thApproxToJSONUnwrap)
185 testProperty "string" (isString . thApproxToJSONUnwrap)