Skip to content

Commit

Permalink
Update Tuple application to check quanity
Browse files Browse the repository at this point in the history
For downstream dc10-scalaq example
  • Loading branch information
julianpeeters committed Feb 23, 2024
1 parent c7cb2ce commit 19d128a
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package dc10.scala.predef.datatype

import cats.data.StateT
import cats.implicits.given
import dc10.scala.{ErrorF, Statement}
import dc10.scala.{Error, ErrorF, Statement}
import dc10.scala.Statement.{TypeExpr, ValueExpr}
import dc10.scala.Symbol.Term
import dc10.scala.Symbol.Term.ValueLevel.Var.{ListCtor, OptionCtor}
Expand Down Expand Up @@ -138,6 +138,12 @@ object ComplexTypes:
l <- tuple
a <- arg1
b <- arg2
_ <- StateT.liftF[ErrorF, List[Statement], Unit]((a.value, b.value) match
case (Term.ValueLevel.Var.UserDefinedValue(scala.Some(qnt1), nme1, tpe1, impl1), Term.ValueLevel.Var.UserDefinedValue(scala.Some(qnt2), nme2, tpe2, impl2)) =>
if nme1 == nme2 then Left(scala.List(Error("Linear type error")))
else Right(())
case _ => Right(())
)
v <- StateT.pure[ErrorF, List[Statement], Term.ValueLevel[Tuple2[A, B], (Unit, (Y, Z))]](Term.ValueLevel.App.AppCtor2(
None,
"",
Expand All @@ -155,7 +161,7 @@ object ComplexTypes:
a.value.tpe.dep.tpe.dep
),
a.value.tpe.dep,
a.value.tpe.dep.tpe.dep
b.value.tpe.dep
)
),
a.value,
Expand Down

0 comments on commit 19d128a

Please sign in to comment.