on master help sign in
Fix TH bug when deriving ToJSON1/2 or FromJSON1/2 for types that don't mention the parameter
dc3e070Ryan Scott
Data/Aeson/TH.hs+6−4
@@ -1408,10 +1408,12 @@ dispatchFunByType jc jf conName tvMap list ty = do
1408 if any (`mentionsName` tyVarNames) lhsArgs
1408 if any (`mentionsName` tyVarNames) lhsArgs
1409 || itf && any (`mentionsName` tyVarNames) tyArgs
1409 || itf && any (`mentionsName` tyVarNames) tyArgs
1410 then outOfPlaceTyVarError jc conName
1410 then outOfPlaceTyVarError jc conName
1411+ else if any (`mentionsName` tyVarNames) rhsArgs
1411− else appsE $ varE (jsonFunValOrListName list jf $ toEnum numLastArgs)
1412+ then appsE $ varE (jsonFunValOrListName list jf $ toEnum numLastArgs)
1412− : zipWith (dispatchFunByType jc jf conName tvMap)
1413+ : zipWith (dispatchFunByType jc jf conName tvMap)
1413− (cycle [False,True])
1414+ (cycle [False,True])
1414− (interleave rhsArgs rhsArgs)
1415+ (interleave rhsArgs rhsArgs)
1416+ else varE $ jsonFunValOrListName list jf Arity0
1415
1417
1416dispatchToJSON, dispatchToEncoding, dispatchParseJSON
1418dispatchToJSON, dispatchToEncoding, dispatchParseJSON
1417 :: JSONClass -> Name -> TyVarMap -> Type -> Q Exp
1419 :: JSONClass -> Name -> TyVarMap -> Type -> Q Exp