summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstuebinm2022-04-05 23:22:58 +0200
committerstuebinm2022-04-05 23:22:58 +0200
commit52d38a0cc3d30aac2cf22fec3644cf17f908d0b8 (patch)
treefa3467ab037f468dfa2e58996ee7929adeae37e4
parent833186af823d334c464a204133b3db5e5f19ccce (diff)
cwality-maps: also traverse generic aeson values
this works surprisingly well, actually
-rw-r--r--cwality-maps/Substitute.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/cwality-maps/Substitute.hs b/cwality-maps/Substitute.hs
index 65e8fc3..ccab272 100644
--- a/cwality-maps/Substitute.hs
+++ b/cwality-maps/Substitute.hs
@@ -53,7 +53,12 @@ trivial :: t -> b -> ([a], t)
trivial = const . ([],)
instance {-# OVERLAPS #-} Substitutable A.Value where
- substitute = trivial
+ substitute (A.Object fields) params =
+ second A.Object $ traverse (`substitute` params) fields
+ substitute (A.String str) params =
+ second A.String $ substitute str params
+ substitute other params = ([], other)
+
instance Substitutable Int where
substitute = trivial