@@ -12,21 +12,12 @@
13-----------------------------------------------------------------------------
13-----------------------------------------------------------------------------
17module Language.PureScript.AST.Traversals where
15module Language.PureScript.AST.Traversals where
19−#if __GLASGOW_HASKELL__ < 710
17+import Prelude ()
20−import Data.Monoid (Monoid(..), mconcat)
18+import Prelude.Compat
22−import Data.Maybe (mapMaybe)
23−#if __GLASGOW_HASKELL__ < 710
24−import Data.Traversable (traverse)
27−#if __GLASGOW_HASKELL__ < 710
20+import Data.Maybe (mapMaybe)
28−import Control.Applicative
30import Control.Monad
21import Control.Monad
31import Control.Arrow ((***), (+++), second)
22import Control.Arrow ((***), (+++), second)
@@ -101,10 +92,10 @@ everywhereOnValuesTopDownM :: (Functor m, Applicative m, Monad m) =>
101 (Declaration -> m Declaration, Expr -> m Expr, Binder -> m Binder)
92 (Declaration -> m Declaration, Expr -> m Expr, Binder -> m Binder)
102everywhereOnValuesTopDownM f g h = (f' <=< f, g' <=< g, h' <=< h)
93everywhereOnValuesTopDownM f g h = (f' <=< f, g' <=< g, h' <=< h)
104− f' (DataBindingGroupDeclaration ds) = DataBindingGroupDeclaration <$> mapM (f' <=< f) ds
95+ f' (DataBindingGroupDeclaration ds) = DataBindingGroupDeclaration <$> traverse (f' <=< f) ds
105− f' (ValueDeclaration name nameKind bs val) = ValueDeclaration name nameKind <$> mapM (h' <=< h) bs <*> eitherM (mapM (pairM (g' <=< g) (g' <=< g))) (g' <=< g) val
96+ f' (ValueDeclaration name nameKind bs val) = ValueDeclaration name nameKind <$> traverse (h' <=< h) bs <*> eitherM (traverse (pairM (g' <=< g) (g' <=< g))) (g' <=< g) val
106− f' (BindingGroupDeclaration ds) = BindingGroupDeclaration <$> mapM (\(name, nameKind, val) -> (,,) name nameKind <$> (g val >>= g')) ds
97+ f' (BindingGroupDeclaration ds) = BindingGroupDeclaration <$> traverse (\(name, nameKind, val) -> (,,) name nameKind <$> (g val >>= g')) ds
107− f' (TypeClassDeclaration name args implies ds) = TypeClassDeclaration name args implies <$> mapM (f' <=< f) ds
98+ f' (TypeClassDeclaration name args implies ds) = TypeClassDeclaration name args implies <$> traverse (f' <=< f) ds
108 f' (TypeInstanceDeclaration name cs className args ds) = TypeInstanceDeclaration name cs className args <$> traverseTypeInstanceBody (traverse (f' <=< f)) ds
99 f' (TypeInstanceDeclaration name cs className args ds) = TypeInstanceDeclaration name cs className args <$> traverseTypeInstanceBody (traverse (f' <=< f)) ds
109 f' (PositionedDeclaration pos com d) = PositionedDeclaration pos com <$> (f d >>= f')
100 f' (PositionedDeclaration pos com d) = PositionedDeclaration pos com <$> (f d >>= f')
110 f' other = f other
101 f' other = f other
@@ -114,37 +105,37 @@ everywhereOnValuesTopDownM f g h = (f' <=< f, g' <=< g, h' <=< h)
114 g' (Parens v) = Parens <$> (g v >>= g')
105 g' (Parens v) = Parens <$> (g v >>= g')
115 g' (OperatorSection op (Left v)) = OperatorSection <$> (g op >>= g') <*> (Left <$> (g v >>= g'))
106 g' (OperatorSection op (Left v)) = OperatorSection <$> (g op >>= g') <*> (Left <$> (g v >>= g'))
116 g' (OperatorSection op (Right v)) = OperatorSection <$> (g op >>= g') <*> (Right <$> (g v >>= g'))
107 g' (OperatorSection op (Right v)) = OperatorSection <$> (g op >>= g') <*> (Right <$> (g v >>= g'))
117− g' (ArrayLiteral vs) = ArrayLiteral <$> mapM (g' <=< g) vs
108+ g' (ArrayLiteral vs) = ArrayLiteral <$> traverse (g' <=< g) vs
118− g' (ObjectLiteral vs) = ObjectLiteral <$> mapM (sndM (g' <=< g)) vs
109+ g' (ObjectLiteral vs) = ObjectLiteral <$> traverse (sndM (g' <=< g)) vs
119− g' (ObjectConstructor vs) = ObjectConstructor <$> mapM (sndM $ maybeM (g' <=< g)) vs
110+ g' (ObjectConstructor vs) = ObjectConstructor <$> traverse (sndM $ maybeM (g' <=< g)) vs
120 g' (TypeClassDictionaryConstructorApp name v) = TypeClassDictionaryConstructorApp name <$> (g v >>= g')
111 g' (TypeClassDictionaryConstructorApp name v) = TypeClassDictionaryConstructorApp name <$> (g v >>= g')
121 g' (Accessor prop v) = Accessor prop <$> (g v >>= g')
112 g' (Accessor prop v) = Accessor prop <$> (g v >>= g')
122− g' (ObjectUpdate obj vs) = ObjectUpdate <$> (g obj >>= g') <*> mapM (sndM (g' <=< g)) vs
113+ g' (ObjectUpdate obj vs) = ObjectUpdate <$> (g obj >>= g') <*> traverse (sndM (g' <=< g)) vs
123− g' (ObjectUpdater obj vs) = ObjectUpdater <$> (maybeM g obj >>= maybeM g') <*> mapM (sndM $ maybeM (g' <=< g)) vs
114+ g' (ObjectUpdater obj vs) = ObjectUpdater <$> (maybeM g obj >>= maybeM g') <*> traverse (sndM $ maybeM (g' <=< g)) vs
124 g' (Abs name v) = Abs name <$> (g v >>= g')
115 g' (Abs name v) = Abs name <$> (g v >>= g')
125 g' (App v1 v2) = App <$> (g v1 >>= g') <*> (g v2 >>= g')
116 g' (App v1 v2) = App <$> (g v1 >>= g') <*> (g v2 >>= g')
126 g' (IfThenElse v1 v2 v3) = IfThenElse <$> (g v1 >>= g') <*> (g v2 >>= g') <*> (g v3 >>= g')
117 g' (IfThenElse v1 v2 v3) = IfThenElse <$> (g v1 >>= g') <*> (g v2 >>= g') <*> (g v3 >>= g')
127− g' (Case vs alts) = Case <$> mapM (g' <=< g) vs <*> mapM handleCaseAlternative alts
118+ g' (Case vs alts) = Case <$> traverse (g' <=< g) vs <*> traverse handleCaseAlternative alts
128 g' (TypedValue check v ty) = TypedValue check <$> (g v >>= g') <*> pure ty
119 g' (TypedValue check v ty) = TypedValue check <$> (g v >>= g') <*> pure ty
129− g' (Let ds v) = Let <$> mapM (f' <=< f) ds <*> (g v >>= g')
120+ g' (Let ds v) = Let <$> traverse (f' <=< f) ds <*> (g v >>= g')
130− g' (Do es) = Do <$> mapM handleDoNotationElement es
121+ g' (Do es) = Do <$> traverse handleDoNotationElement es
131 g' (PositionedValue pos com v) = PositionedValue pos com <$> (g v >>= g')
122 g' (PositionedValue pos com v) = PositionedValue pos com <$> (g v >>= g')
132 g' other = g other
123 g' other = g other
134− h' (ConstructorBinder ctor bs) = ConstructorBinder ctor <$> mapM (h' <=< h) bs
125+ h' (ConstructorBinder ctor bs) = ConstructorBinder ctor <$> traverse (h' <=< h) bs
135− h' (ObjectBinder bs) = ObjectBinder <$> mapM (sndM (h' <=< h)) bs
126+ h' (ObjectBinder bs) = ObjectBinder <$> traverse (sndM (h' <=< h)) bs
136− h' (ArrayBinder bs) = ArrayBinder <$> mapM (h' <=< h) bs
127+ h' (ArrayBinder bs) = ArrayBinder <$> traverse (h' <=< h) bs
137 h' (NamedBinder name b) = NamedBinder name <$> (h b >>= h')
128 h' (NamedBinder name b) = NamedBinder name <$> (h b >>= h')
138 h' (PositionedBinder pos com b) = PositionedBinder pos com <$> (h b >>= h')
129 h' (PositionedBinder pos com b) = PositionedBinder pos com <$> (h b >>= h')
139 h' (TypedBinder t b) = TypedBinder t <$> (h b >>= h')
130 h' (TypedBinder t b) = TypedBinder t <$> (h b >>= h')
140 h' other = h other
131 h' other = h other
142− handleCaseAlternative (CaseAlternative bs val) = CaseAlternative <$> mapM (h' <=< h) bs
133+ handleCaseAlternative (CaseAlternative bs val) = CaseAlternative <$> traverse (h' <=< h) bs
143− <*> eitherM (mapM (pairM (g' <=< g) (g' <=< g))) (g' <=< g) val
134+ <*> eitherM (traverse (pairM (g' <=< g) (g' <=< g))) (g' <=< g) val
145 handleDoNotationElement (DoNotationValue v) = DoNotationValue <$> (g' <=< g) v
136 handleDoNotationElement (DoNotationValue v) = DoNotationValue <$> (g' <=< g) v
146 handleDoNotationElement (DoNotationBind b v) = DoNotationBind <$> (h' <=< h) b <*> (g' <=< g) v
137 handleDoNotationElement (DoNotationBind b v) = DoNotationBind <$> (h' <=< h) b <*> (g' <=< g) v
147− handleDoNotationElement (DoNotationLet ds) = DoNotationLet <$> mapM (f' <=< f) ds
138+ handleDoNotationElement (DoNotationLet ds) = DoNotationLet <$> traverse (f' <=< f) ds
148 handleDoNotationElement (PositionedDoNotationElement pos com e) = PositionedDoNotationElement pos com <$> handleDoNotationElement e
139 handleDoNotationElement (PositionedDoNotationElement pos com e) = PositionedDoNotationElement pos com <$> handleDoNotationElement e
150everywhereOnValuesM :: (Functor m, Applicative m, Monad m) =>
141everywhereOnValuesM :: (Functor m, Applicative m, Monad m) =>
@@ -154,11 +145,11 @@ everywhereOnValuesM :: (Functor m, Applicative m, Monad m) =>
154 (Declaration -> m Declaration, Expr -> m Expr, Binder -> m Binder)
145 (Declaration -> m Declaration, Expr -> m Expr, Binder -> m Binder)
155everywhereOnValuesM f g h = (f', g', h')
146everywhereOnValuesM f g h = (f', g', h')
157− f' (DataBindingGroupDeclaration ds) = (DataBindingGroupDeclaration <$> mapM f' ds) >>= f
148+ f' (DataBindingGroupDeclaration ds) = (DataBindingGroupDeclaration <$> traverse f' ds) >>= f
158− f' (ValueDeclaration name nameKind bs val) = (ValueDeclaration name nameKind <$> mapM h' bs <*> eitherM (mapM (pairM g' g')) g' val) >>= f
149+ f' (ValueDeclaration name nameKind bs val) = (ValueDeclaration name nameKind <$> traverse h' bs <*> eitherM (traverse (pairM g' g')) g' val) >>= f
159− f' (BindingGroupDeclaration ds) = (BindingGroupDeclaration <$> mapM (\(name, nameKind, val) -> (,,) name nameKind <$> g' val) ds) >>= f
150+ f' (BindingGroupDeclaration ds) = (BindingGroupDeclaration <$> traverse (\(name, nameKind, val) -> (,,) name nameKind <$> g' val) ds) >>= f
160− f' (TypeClassDeclaration name args implies ds) = (TypeClassDeclaration name args implies <$> mapM f' ds) >>= f
151+ f' (TypeClassDeclaration name args implies ds) = (TypeClassDeclaration name args implies <$> traverse f' ds) >>= f
161− f' (TypeInstanceDeclaration name cs className args ds) = (TypeInstanceDeclaration name cs className args <$> traverseTypeInstanceBody (mapM f') ds) >>= f
152+ f' (TypeInstanceDeclaration name cs className args ds) = (TypeInstanceDeclaration name cs className args <$> traverseTypeInstanceBody (traverse f') ds) >>= f
162 f' (PositionedDeclaration pos com d) = (PositionedDeclaration pos com <$> f' d) >>= f
153 f' (PositionedDeclaration pos com d) = (PositionedDeclaration pos com <$> f' d) >>= f
163 f' other = f other
154 f' other = f other
@@ -167,37 +158,37 @@ everywhereOnValuesM f g h = (f', g', h')
167 g' (Parens v) = (Parens <$> g' v) >>= g
158 g' (Parens v) = (Parens <$> g' v) >>= g
168 g' (OperatorSection op (Left v)) = (OperatorSection <$> g' op <*> (Left <$> g' v)) >>= g
159 g' (OperatorSection op (Left v)) = (OperatorSection <$> g' op <*> (Left <$> g' v)) >>= g
169 g' (OperatorSection op (Right v)) = (OperatorSection <$> g' op <*> (Right <$> g' v)) >>= g
160 g' (OperatorSection op (Right v)) = (OperatorSection <$> g' op <*> (Right <$> g' v)) >>= g
170− g' (ArrayLiteral vs) = (ArrayLiteral <$> mapM g' vs) >>= g
161+ g' (ArrayLiteral vs) = (ArrayLiteral <$> traverse g' vs) >>= g
171− g' (ObjectLiteral vs) = (ObjectLiteral <$> mapM (sndM g') vs) >>= g
162+ g' (ObjectLiteral vs) = (ObjectLiteral <$> traverse (sndM g') vs) >>= g
172− g' (ObjectConstructor vs) = (ObjectConstructor <$> mapM (sndM $ maybeM g') vs) >>= g
163+ g' (ObjectConstructor vs) = (ObjectConstructor <$> traverse (sndM $ maybeM g') vs) >>= g
173 g' (TypeClassDictionaryConstructorApp name v) = (TypeClassDictionaryConstructorApp name <$> g' v) >>= g
164 g' (TypeClassDictionaryConstructorApp name v) = (TypeClassDictionaryConstructorApp name <$> g' v) >>= g
174 g' (Accessor prop v) = (Accessor prop <$> g' v) >>= g
165 g' (Accessor prop v) = (Accessor prop <$> g' v) >>= g
175− g' (ObjectUpdate obj vs) = (ObjectUpdate <$> g' obj <*> mapM (sndM g') vs) >>= g
166+ g' (ObjectUpdate obj vs) = (ObjectUpdate <$> g' obj <*> traverse (sndM g') vs) >>= g
176− g' (ObjectUpdater obj vs) = (ObjectUpdater <$> maybeM g' obj <*> mapM (sndM $ maybeM g') vs) >>= g
167+ g' (ObjectUpdater obj vs) = (ObjectUpdater <$> maybeM g' obj <*> traverse (sndM $ maybeM g') vs) >>= g
177 g' (Abs name v) = (Abs name <$> g' v) >>= g
168 g' (Abs name v) = (Abs name <$> g' v) >>= g
178 g' (App v1 v2) = (App <$> g' v1 <*> g' v2) >>= g
169 g' (App v1 v2) = (App <$> g' v1 <*> g' v2) >>= g
179 g' (IfThenElse v1 v2 v3) = (IfThenElse <$> g' v1 <*> g' v2 <*> g' v3) >>= g
170 g' (IfThenElse v1 v2 v3) = (IfThenElse <$> g' v1 <*> g' v2 <*> g' v3) >>= g
180− g' (Case vs alts) = (Case <$> mapM g' vs <*> mapM handleCaseAlternative alts) >>= g
171+ g' (Case vs alts) = (Case <$> traverse g' vs <*> traverse handleCaseAlternative alts) >>= g
181 g' (TypedValue check v ty) = (TypedValue check <$> g' v <*> pure ty) >>= g
172 g' (TypedValue check v ty) = (TypedValue check <$> g' v <*> pure ty) >>= g
182− g' (Let ds v) = (Let <$> mapM f' ds <*> g' v) >>= g
173+ g' (Let ds v) = (Let <$> traverse f' ds <*> g' v) >>= g
183− g' (Do es) = (Do <$> mapM handleDoNotationElement es) >>= g
174+ g' (Do es) = (Do <$> traverse handleDoNotationElement es) >>= g
184 g' (PositionedValue pos com v) = (PositionedValue pos com <$> g' v) >>= g
175 g' (PositionedValue pos com v) = (PositionedValue pos com <$> g' v) >>= g
185 g' other = g other
176 g' other = g other
187− h' (ConstructorBinder ctor bs) = (ConstructorBinder ctor <$> mapM h' bs) >>= h
178+ h' (ConstructorBinder ctor bs) = (ConstructorBinder ctor <$> traverse h' bs) >>= h
188− h' (ObjectBinder bs) = (ObjectBinder <$> mapM (sndM h') bs) >>= h
179+ h' (ObjectBinder bs) = (ObjectBinder <$> traverse (sndM h') bs) >>= h
189− h' (ArrayBinder bs) = (ArrayBinder <$> mapM h' bs) >>= h
180+ h' (ArrayBinder bs) = (ArrayBinder <$> traverse h' bs) >>= h
190 h' (NamedBinder name b) = (NamedBinder name <$> h' b) >>= h
181 h' (NamedBinder name b) = (NamedBinder name <$> h' b) >>= h
191 h' (PositionedBinder pos com b) = (PositionedBinder pos com <$> h' b) >>= h
182 h' (PositionedBinder pos com b) = (PositionedBinder pos com <$> h' b) >>= h
192 h' (TypedBinder t b) = (TypedBinder t <$> h' b) >>= h
183 h' (TypedBinder t b) = (TypedBinder t <$> h' b) >>= h
193 h' other = h other
184 h' other = h other
195− handleCaseAlternative (CaseAlternative bs val) = CaseAlternative <$> mapM h' bs
186+ handleCaseAlternative (CaseAlternative bs val) = CaseAlternative <$> traverse h' bs
196− <*> eitherM (mapM (pairM g' g')) g' val
187+ <*> eitherM (traverse (pairM g' g')) g' val
198 handleDoNotationElement (DoNotationValue v) = DoNotationValue <$> g' v
189 handleDoNotationElement (DoNotationValue v) = DoNotationValue <$> g' v
199 handleDoNotationElement (DoNotationBind b v) = DoNotationBind <$> h' b <*> g' v
190 handleDoNotationElement (DoNotationBind b v) = DoNotationBind <$> h' b <*> g' v
200− handleDoNotationElement (DoNotationLet ds) = DoNotationLet <$> mapM f' ds
191+ handleDoNotationElement (DoNotationLet ds) = DoNotationLet <$> traverse f' ds
201 handleDoNotationElement (PositionedDoNotationElement pos com e) = PositionedDoNotationElement pos com <$> handleDoNotationElement e
192 handleDoNotationElement (PositionedDoNotationElement pos com e) = PositionedDoNotationElement pos com <$> handleDoNotationElement e
203everythingOnValues :: (r -> r -> r) ->
194everythingOnValues :: (r -> r -> r) ->
@@ -345,11 +336,11 @@ everywhereWithContextOnValuesM s0 f g h i j = (f'' s0, g'' s0, h'' s0, i'' s0, j
346 f'' s = uncurry f' <=< f s
337 f'' s = uncurry f' <=< f s
348− f' s (DataBindingGroupDeclaration ds) = DataBindingGroupDeclaration <$> mapM (f'' s) ds
339+ f' s (DataBindingGroupDeclaration ds) = DataBindingGroupDeclaration <$> traverse (f'' s) ds
349− f' s (ValueDeclaration name nameKind bs val) = ValueDeclaration name nameKind <$> mapM (h'' s) bs <*> eitherM (mapM (pairM (g'' s) (g'' s))) (g'' s) val
340+ f' s (ValueDeclaration name nameKind bs val) = ValueDeclaration name nameKind <$> traverse (h'' s) bs <*> eitherM (traverse (pairM (g'' s) (g'' s))) (g'' s) val
350− f' s (BindingGroupDeclaration ds) = BindingGroupDeclaration <$> mapM (thirdM (g'' s)) ds
341+ f' s (BindingGroupDeclaration ds) = BindingGroupDeclaration <$> traverse (thirdM (g'' s)) ds
351− f' s (TypeClassDeclaration name args implies ds) = TypeClassDeclaration name args implies <$> mapM (f'' s) ds
342+ f' s (TypeClassDeclaration name args implies ds) = TypeClassDeclaration name args implies <$> traverse (f'' s) ds
352− f' s (TypeInstanceDeclaration name cs className args ds) = TypeInstanceDeclaration name cs className args <$> traverseTypeInstanceBody (mapM (f'' s)) ds
343+ f' s (TypeInstanceDeclaration name cs className args ds) = TypeInstanceDeclaration name cs className args <$> traverseTypeInstanceBody (traverse (f'' s)) ds
353 f' s (PositionedDeclaration pos com d1) = PositionedDeclaration pos com <$> f'' s d1
344 f' s (PositionedDeclaration pos com d1) = PositionedDeclaration pos com <$> f'' s d1
354 f' _ other = return other
345 f' _ other = return other
@@ -360,28 +351,28 @@ everywhereWithContextOnValuesM s0 f g h i j = (f'' s0, g'' s0, h'' s0, i'' s0, j
360 g' s (Parens v) = Parens <$> g'' s v
351 g' s (Parens v) = Parens <$> g'' s v
361 g' s (OperatorSection op (Left v)) = OperatorSection <$> g'' s op <*> (Left <$> g'' s v)
352 g' s (OperatorSection op (Left v)) = OperatorSection <$> g'' s op <*> (Left <$> g'' s v)
362 g' s (OperatorSection op (Right v)) = OperatorSection <$> g'' s op <*> (Right <$> g'' s v)
353 g' s (OperatorSection op (Right v)) = OperatorSection <$> g'' s op <*> (Right <$> g'' s v)
363− g' s (ArrayLiteral vs) = ArrayLiteral <$> mapM (g'' s) vs
354+ g' s (ArrayLiteral vs) = ArrayLiteral <$> traverse (g'' s) vs
364− g' s (ObjectLiteral vs) = ObjectLiteral <$> mapM (sndM (g'' s)) vs
355+ g' s (ObjectLiteral vs) = ObjectLiteral <$> traverse (sndM (g'' s)) vs
365− g' s (ObjectConstructor vs) = ObjectConstructor <$> mapM (sndM $ maybeM (g'' s)) vs
356+ g' s (ObjectConstructor vs) = ObjectConstructor <$> traverse (sndM $ maybeM (g'' s)) vs
366 g' s (TypeClassDictionaryConstructorApp name v) = TypeClassDictionaryConstructorApp name <$> g'' s v
357 g' s (TypeClassDictionaryConstructorApp name v) = TypeClassDictionaryConstructorApp name <$> g'' s v
367 g' s (Accessor prop v) = Accessor prop <$> g'' s v
358 g' s (Accessor prop v) = Accessor prop <$> g'' s v
368− g' s (ObjectUpdate obj vs) = ObjectUpdate <$> g'' s obj <*> mapM (sndM (g'' s)) vs
359+ g' s (ObjectUpdate obj vs) = ObjectUpdate <$> g'' s obj <*> traverse (sndM (g'' s)) vs
369− g' s (ObjectUpdater obj vs) = ObjectUpdater <$> maybeM (g'' s) obj <*> mapM (sndM $ maybeM (g'' s)) vs
360+ g' s (ObjectUpdater obj vs) = ObjectUpdater <$> maybeM (g'' s) obj <*> traverse (sndM $ maybeM (g'' s)) vs
370 g' s (Abs name v) = Abs name <$> g'' s v
361 g' s (Abs name v) = Abs name <$> g'' s v
371 g' s (App v1 v2) = App <$> g'' s v1 <*> g'' s v2
362 g' s (App v1 v2) = App <$> g'' s v1 <*> g'' s v2
372 g' s (IfThenElse v1 v2 v3) = IfThenElse <$> g'' s v1 <*> g'' s v2 <*> g'' s v3
363 g' s (IfThenElse v1 v2 v3) = IfThenElse <$> g'' s v1 <*> g'' s v2 <*> g'' s v3
373− g' s (Case vs alts) = Case <$> mapM (g'' s) vs <*> mapM (i'' s) alts
364+ g' s (Case vs alts) = Case <$> traverse (g'' s) vs <*> traverse (i'' s) alts
374 g' s (TypedValue check v ty) = TypedValue check <$> g'' s v <*> pure ty
365 g' s (TypedValue check v ty) = TypedValue check <$> g'' s v <*> pure ty
375− g' s (Let ds v) = Let <$> mapM (f'' s) ds <*> g'' s v
366+ g' s (Let ds v) = Let <$> traverse (f'' s) ds <*> g'' s v
376− g' s (Do es) = Do <$> mapM (j'' s) es
367+ g' s (Do es) = Do <$> traverse (j'' s) es
377 g' s (PositionedValue pos com v) = PositionedValue pos com <$> g'' s v
368 g' s (PositionedValue pos com v) = PositionedValue pos com <$> g'' s v
378 g' _ other = return other
369 g' _ other = return other
380 h'' s = uncurry h' <=< h s
371 h'' s = uncurry h' <=< h s
382− h' s (ConstructorBinder ctor bs) = ConstructorBinder ctor <$> mapM (h'' s) bs
373+ h' s (ConstructorBinder ctor bs) = ConstructorBinder ctor <$> traverse (h'' s) bs
383− h' s (ObjectBinder bs) = ObjectBinder <$> mapM (sndM (h'' s)) bs
374+ h' s (ObjectBinder bs) = ObjectBinder <$> traverse (sndM (h'' s)) bs
384− h' s (ArrayBinder bs) = ArrayBinder <$> mapM (h'' s) bs
375+ h' s (ArrayBinder bs) = ArrayBinder <$> traverse (h'' s) bs
385 h' s (NamedBinder name b) = NamedBinder name <$> h'' s b
376 h' s (NamedBinder name b) = NamedBinder name <$> h'' s b
386 h' s (PositionedBinder pos com b) = PositionedBinder pos com <$> h'' s b
377 h' s (PositionedBinder pos com b) = PositionedBinder pos com <$> h'' s b
387 h' s (TypedBinder t b) = TypedBinder t <$> h'' s b
378 h' s (TypedBinder t b) = TypedBinder t <$> h'' s b
@@ -389,13 +380,13 @@ everywhereWithContextOnValuesM s0 f g h i j = (f'' s0, g'' s0, h'' s0, i'' s0, j
390 i'' s = uncurry i' <=< i s
381 i'' s = uncurry i' <=< i s
392− i' s (CaseAlternative bs val) = CaseAlternative <$> mapM (h'' s) bs <*> eitherM (mapM (pairM (g'' s) (g'' s))) (g'' s) val
383+ i' s (CaseAlternative bs val) = CaseAlternative <$> traverse (h'' s) bs <*> eitherM (traverse (pairM (g'' s) (g'' s))) (g'' s) val
394 j'' s = uncurry j' <=< j s
385 j'' s = uncurry j' <=< j s
396 j' s (DoNotationValue v) = DoNotationValue <$> g'' s v
387 j' s (DoNotationValue v) = DoNotationValue <$> g'' s v
397 j' s (DoNotationBind b v) = DoNotationBind <$> h'' s b <*> g'' s v
388 j' s (DoNotationBind b v) = DoNotationBind <$> h'' s b <*> g'' s v
398− j' s (DoNotationLet ds) = DoNotationLet <$> mapM (f'' s) ds
389+ j' s (DoNotationLet ds) = DoNotationLet <$> traverse (f'' s) ds
399 j' s (PositionedDoNotationElement pos com e1) = PositionedDoNotationElement pos com <$> j'' s e1
390 j' s (PositionedDoNotationElement pos com e1) = PositionedDoNotationElement pos com <$> j'' s e1
401accumTypes :: (Monoid r) => (Type -> r) -> (Declaration -> r, Expr -> r, Binder -> r, CaseAlternative -> r, DoNotationElement -> r)
392accumTypes :: (Monoid r) => (Type -> r) -> (Declaration -> r, Expr -> r, Binder -> r, CaseAlternative -> r, DoNotationElement -> r)