@@ -43,10 +43,10 @@ everywhereOnValues f g h = (f', g', h')
4343
4444 g' :: Expr -> Expr
4545 g' (UnaryMinus v) = g (UnaryMinus (g' v))
46- g' (BinaryNoParens op v1 v2) = g (BinaryNoParens op (g' v1) (g' v2))
46+ g' (BinaryNoParens op v1 v2) = g (BinaryNoParens (g' op) (g' v1) (g' v2))
4747 g' (Parens v) = g (Parens (g' v))
48- g' (OperatorSection op (Left v)) = g (OperatorSection op (Left $ g' v))
49- g' (OperatorSection op (Right v)) = g (OperatorSection op (Right $ g' v))
48+ g' (OperatorSection op (Left v)) = g (OperatorSection (g' op) (Left $ g' v))
49+ g' (OperatorSection op (Right v)) = g (OperatorSection (g' op) (Right $ g' v))
5050 g' (ArrayLiteral vs) = g (ArrayLiteral (map g' vs))
5151 g' (ObjectLiteral vs) = g (ObjectLiteral (map (fmap g') vs))
5252 g' (ObjectConstructor vs) = g (ObjectConstructor (map (second (fmap g')) vs))
@@ -85,7 +85,6 @@ everywhereOnValues f g h = (f', g', h')
8585 handleDoNotationElement (DoNotationLet ds) = DoNotationLet (map f' ds)
8686 handleDoNotationElement (PositionedDoNotationElement pos com e) = PositionedDoNotationElement pos com (handleDoNotationElement e)
8787
88-
8988everywhereOnValuesTopDownM :: (Functor m , Applicative m , Monad m ) =>
9089 (Declaration -> m Declaration ) ->
9190 (Expr -> m Expr ) ->
@@ -102,10 +101,10 @@ everywhereOnValuesTopDownM f g h = (f' <=< f, g' <=< g, h' <=< h)
102101 f' other = f other
103102
104103 g' (UnaryMinus v) = UnaryMinus <$> (g v >>= g')
105- g' (BinaryNoParens op v1 v2) = BinaryNoParens op <$ > (g v1 >>= g') <*> (g v2 >>= g')
104+ g' (BinaryNoParens op v1 v2) = BinaryNoParens <$> (g op >>= g') <* > (g v1 >>= g') <*> (g v2 >>= g')
106105 g' (Parens v) = Parens <$> (g v >>= g')
107- g' (OperatorSection op (Left v)) = OperatorSection op . Left <$> (g v >>= g')
108- g' (OperatorSection op (Right v)) = OperatorSection op . Right <$> (g v >>= g')
106+ g' (OperatorSection op (Left v)) = OperatorSection <$> (g op >>= g') <*> ( Left <$> (g v >>= g') )
107+ g' (OperatorSection op (Right v)) = OperatorSection <$> (g op >>= g') <*> ( Right <$> (g v >>= g') )
109108 g' (ArrayLiteral vs) = ArrayLiteral <$> mapM (g' <=< g) vs
110109 g' (ObjectLiteral vs) = ObjectLiteral <$> mapM (sndM (g' <=< g)) vs
111110 g' (ObjectConstructor vs) = ObjectConstructor <$> mapM (sndM $ maybeM (g' <=< g)) vs
@@ -155,10 +154,10 @@ everywhereOnValuesM f g h = (f', g', h')
155154 f' other = f other
156155
157156 g' (UnaryMinus v) = (UnaryMinus <$> g' v) >>= g
158- g' (BinaryNoParens op v1 v2) = (BinaryNoParens op <$ > g' v1 <*> g' v2) >>= g
157+ g' (BinaryNoParens op v1 v2) = (BinaryNoParens <$> g' op <* > g' v1 <*> g' v2) >>= g
159158 g' (Parens v) = (Parens <$> g' v) >>= g
160- g' (OperatorSection op (Left v)) = (OperatorSection op . Left <$> g' v) >>= g
161- g' (OperatorSection op (Right v)) = (OperatorSection op . Right <$> g' v) >>= g
159+ g' (OperatorSection op (Left v)) = (OperatorSection <$> g' op <*> ( Left <$> g' v) ) >>= g
160+ g' (OperatorSection op (Right v)) = (OperatorSection <$> g' op <*> ( Right <$> g' v) ) >>= g
162161 g' (ArrayLiteral vs) = (ArrayLiteral <$> mapM g' vs) >>= g
163162 g' (ObjectLiteral vs) = (ObjectLiteral <$> mapM (sndM g') vs) >>= g
164163 g' (ObjectConstructor vs) = (ObjectConstructor <$> mapM (sndM $ maybeM g') vs) >>= g
@@ -211,10 +210,10 @@ everythingOnValues (<>) f g h i j = (f', g', h', i', j')
211210 f' d = f d
212211
213212 g' v@ (UnaryMinus v1) = g v <> g' v1
214- g' v@ (BinaryNoParens _ v1 v2) = g v <> g' v1 <> g' v2
213+ g' v@ (BinaryNoParens op v1 v2) = g v <> g op <> g' v1 <> g' v2
215214 g' v@ (Parens v1) = g v <> g' v1
216- g' v@ (OperatorSection _ (Left v1)) = g v <> g' v1
217- g' v@ (OperatorSection _ (Right v1)) = g v <> g' v1
215+ g' v@ (OperatorSection op (Left v1)) = g v <> g op <> g' v1
216+ g' v@ (OperatorSection op (Right v1)) = g v <> g op <> g' v1
218217 g' v@ (ArrayLiteral vs) = foldl (<>) (g v) (map g' vs)
219218 g' v@ (ObjectLiteral vs) = foldl (<>) (g v) (map (g' . snd ) vs)
220219 g' v@ (ObjectConstructor vs) = foldl (<>) (g v) (map g' (mapMaybe snd vs))
@@ -278,10 +277,10 @@ everythingWithContextOnValues s0 r0 (<>) f g h i j = (f'' s0, g'' s0, h'' s0, i'
278277 g'' s v = let (s', r) = g s v in r <> g' s' v
279278
280279 g' s (UnaryMinus v1) = g'' s v1
281- g' s (BinaryNoParens _ v1 v2) = g'' s v1 <> g'' s v2
280+ g' s (BinaryNoParens op v1 v2) = g'' s op <> g'' s v1 <> g'' s v2
282281 g' s (Parens v1) = g'' s v1
283- g' s (OperatorSection _ (Left v)) = g'' s v
284- g' s (OperatorSection _ (Right v)) = g'' s v
282+ g' s (OperatorSection op (Left v)) = g'' s op <> g'' s v
283+ g' s (OperatorSection op (Right v)) = g'' s op <> g'' s v
285284 g' s (ArrayLiteral vs) = foldl (<>) r0 (map (g'' s) vs)
286285 g' s (ObjectLiteral vs) = foldl (<>) r0 (map (g'' s . snd ) vs)
287286 g' s (ObjectConstructor vs) = foldl (<>) r0 (map (g'' s) (mapMaybe snd vs))
@@ -348,10 +347,10 @@ everywhereWithContextOnValuesM s0 f g h i j = (f'' s0, g'' s0, h'' s0, i'' s0, j
348347 g'' s = uncurry g' <=< g s
349348
350349 g' s (UnaryMinus v) = UnaryMinus <$> g'' s v
351- g' s (BinaryNoParens op v1 v2) = BinaryNoParens op <$ > g'' s v1 <*> g'' s v2
350+ g' s (BinaryNoParens op v1 v2) = BinaryNoParens <$> g'' s op <* > g'' s v1 <*> g'' s v2
352351 g' s (Parens v) = Parens <$> g'' s v
353- g' s (OperatorSection op (Left v)) = OperatorSection op . Left <$> g'' s v
354- g' s (OperatorSection op (Right v)) = OperatorSection op . Right <$> g'' s v
352+ g' s (OperatorSection op (Left v)) = OperatorSection <$> g'' s op <*> ( Left <$> g'' s v)
353+ g' s (OperatorSection op (Right v)) = OperatorSection <$> g'' s op <*> ( Right <$> g'' s v)
355354 g' s (ArrayLiteral vs) = ArrayLiteral <$> mapM (g'' s) vs
356355 g' s (ObjectLiteral vs) = ObjectLiteral <$> mapM (sndM (g'' s)) vs
357356 g' s (ObjectConstructor vs) = ObjectConstructor <$> mapM (sndM $ maybeM (g'' s)) vs
0 commit comments