From b4ca3be64011015e98a861b54ca655fd3e23d85f Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Sun, 10 Sep 2017 18:34:42 +0100 Subject: [PATCH] Simplify with a foldMap. --- src/Diff.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Diff.hs b/src/Diff.hs index 262093c51..428f14266 100644 --- a/src/Diff.hs +++ b/src/Diff.hs @@ -220,6 +220,6 @@ instance (ToJSONFields a, ToJSONFields1 f) => ToJSONFields (Diff f a) where toJSONFields = toJSONFields . unDiff instance (ToJSON b, ToJSONFields a, ToJSONFields1 f) => ToJSONFields (DiffF f a b) where - toJSONFields (Copy vs a f) = foldr (\ (Metavar k, v) -> (pack k .= v :)) [] vs <> toJSONFields a <> toJSONFields1 f + toJSONFields (Copy vs a f) = foldMap (\ (Metavar k, v) -> [pack k .= v]) vs <> toJSONFields a <> toJSONFields1 f toJSONFields (Var (Metavar v)) = [ "metavar" .= v ] toJSONFields (Patch a) = toJSONFields a