@@ -85,7 +85,13 @@ private IterateT(Pure<M> pureM,
85
85
public <MMTA extends MonadRec <Maybe <Tuple2 <A , IterateT <M , A >>>, M >> MMTA runIterateT () {
86
86
MonadRec <ImmutableQueue <Choice2 <Fn0 <MonadRec <Maybe <Tuple2 <A , IterateT <M , A >>>, M >>, MonadRec <A , M >>>, M >
87
87
mSpine = pureM .apply (spine );
88
- return mSpine .trampolineM (resume (pureM )).coerce ();
88
+ return mSpine .trampolineM (tSpine -> tSpine .head ().<MonadRec <RecursiveResult <ImmutableQueue <Choice2 <Fn0 <MonadRec <Maybe <Tuple2 <A , IterateT <M , A >>>, M >>, MonadRec <A , M >>>, Maybe <Tuple2 <A , IterateT <M , A >>>>, M >>match (
89
+ ___ -> pureM .apply (terminate (nothing ())),
90
+ thunkOrReal -> thunkOrReal .match (
91
+ thunk -> thunk .apply ().fmap (m -> m .match (
92
+ ___ -> recurse (tSpine .tail ()),
93
+ t -> terminate (just (t .fmap (as -> new IterateT <>(pureM , as .spine .concat (tSpine .tail ()))))))),
94
+ real -> real .fmap (a -> terminate (just (tuple (a , new IterateT <>(pureM , tSpine .tail ())))))))).coerce ();
89
95
}
90
96
91
97
/**
@@ -289,19 +295,6 @@ public <B> IterateT<M, A> discardR(Applicative<B, IterateT<M, ?>> appB) {
289
295
return MonadT .super .discardR (appB ).coerce ();
290
296
}
291
297
292
- private static <M extends MonadRec <?, M >, A >
293
- Fn1 <ImmutableQueue <Choice2 <Fn0 <MonadRec <Maybe <Tuple2 <A , IterateT <M , A >>>, M >>, MonadRec <A , M >>>,
294
- MonadRec <RecursiveResult <ImmutableQueue <Choice2 <Fn0 <MonadRec <Maybe <Tuple2 <A , IterateT <M , A >>>, M >>, MonadRec <A , M >>>, Maybe <Tuple2 <A , IterateT <M , A >>>>, M >>
295
- resume (Pure <M > pureM ) {
296
- return spine -> spine .head ().match (
297
- ___ -> pureM .apply (terminate (nothing ())),
298
- thunkOrReal -> thunkOrReal .match (
299
- thunk -> thunk .apply ().fmap (m -> m .match (
300
- ___ -> recurse (spine .tail ()),
301
- t -> terminate (just (t .fmap (as -> new IterateT <>(pureM , as .spine .concat (spine .tail ()))))))),
302
- real -> real .fmap (a -> terminate (just (tuple (a , new IterateT <>(pureM , spine .tail ())))))));
303
- }
304
-
305
298
/**
306
299
* Static factory method for creating an empty {@link IterateT}.
307
300
*
0 commit comments