@@ -175,11 +175,17 @@ mod Parser {
175
175
///
176
176
/// This is generalization of `literal`.
177
177
///
178
- pub def literalSequence(lit: m[a]): Parser[DelayList[a], a] with Eq[a], Foldable[m] =
178
+ pub def literalSequence(lit: m[a]): Parser[DelayList[a], a] \ Foldable.Aef[m] with Eq[a], Foldable[m] =
179
+ literalSequenceHelper(Foldable.toList(lit))
180
+
181
+ ///
182
+ /// Helper for `literalSequence` which does not have the foldable associated effect.
183
+ ///
184
+ def literalSequenceHelper(lit: List[a]): Parser[DelayList[a], a] with Eq[a] =
179
185
inp -> inp // Wrap in lambda so the recursive call does not immediately happen
180
- |> match Foldable.toList( lit) {
186
+ |> match lit {
181
187
case Nil => succeed(ENil)
182
- case x :: xs => (literal(x) `then` (literalSequence (xs))) `using` cons
188
+ case x :: xs => (literal(x) `then` (literalSequenceHelper (xs))) `using` cons
183
189
}
184
190
185
191
///
@@ -211,7 +217,7 @@ mod Parser {
211
217
///
212
218
/// Returns a parser that recognizes any of the elements in `syms`.
213
219
///
214
- pub def any(f: a -> Parser[b, c], syms: m[a]): Parser[b, c] with Foldable[m] =
220
+ pub def any(f: a -> Parser[b, c], syms: m[a]): Parser[b, c] \ Foldable.Aef[m] with Foldable[m] =
215
221
Foldable.foldRight(f >> otherwise, fail, syms)
216
222
217
223
///
@@ -223,7 +229,7 @@ mod Parser {
223
229
///
224
230
/// Returns `chars` as a string.
225
231
///
226
- pub def stringify(chars: m[Char]): String with Foldable[m] = region r {
232
+ pub def stringify(chars: m[Char]): String \ Foldable.Aef[m] with Foldable[m] = region r {
227
233
let sb = StringBuilder.empty(r);
228
234
let ap = sb |> flip(StringBuilder.append!);
229
235
Foldable.forEach(ap, chars);
0 commit comments