Skip to content

Commit

Permalink
remove asCheap from Matchless (#1239)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnynek authored Oct 31, 2024
1 parent 58bf311 commit 447f5dd
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions core/src/main/scala/org/bykn/bosatsu/Matchless.scala
Original file line number Diff line number Diff line change
Expand Up @@ -217,18 +217,12 @@ object Matchless {

case class PrevNat(of: Expr) extends Expr

private def asCheap(expr: Expr): Option[CheapExpr] =
expr match {
case c: CheapExpr => Some(c)
case _ => None
}

private def maybeMemo[F[_]: Monad](
tmp: F[Long]
)(fn: CheapExpr => F[Expr]): Expr => F[Expr] = { (arg: Expr) =>
asCheap(arg) match {
case Some(c) => fn(c)
case None =>
arg match {
case c: CheapExpr => fn(c)
case _ =>
for {
nm <- tmp
bound = LocalAnon(nm)
Expand Down

0 comments on commit 447f5dd

Please sign in to comment.