Skip to content

Commit

Permalink
Replace do-while (#3189)
Browse files Browse the repository at this point in the history
  • Loading branch information
travisbrown authored and LukaJCB committed Dec 3, 2019
1 parent 7035298 commit b2e8351
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions free/src/main/scala/cats/free/FreeApplicative.scala
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,13 @@ sealed abstract class FreeApplicative[F[_], A] extends Product with Serializable
val lengthInitial = argsFLength
// reassociate the functions into a single fn,
// and move the arguments into argsF
do {
while ({
val ap = argF.asInstanceOf[Ap[F, Any, Any]]
argsF ::= ap.fp
argsFLength += 1
argF = ap.fn.asInstanceOf[FA[F, Any]]
} while (argF.isInstanceOf[Ap[F, _, _]])
argF.isInstanceOf[Ap[F, _, _]]
}) ()
// consecutive `ap` calls have been queued as operations;
// argF is no longer an `Ap` node, so the entire topmost left-associated
// function application branch has been looped through and we've
Expand Down

0 comments on commit b2e8351

Please sign in to comment.