@@ -128,11 +128,8 @@ object Show extends Phase[CoreTransformed, CoreTransformed] {
128128 sys error " targ was not ground type in PureApp"
129129 case Let (id, annotatedTpe, binding, body) => Let (id, annotatedTpe, transform(binding), transform(body))
130130 case Return (expr) => Return (transform(expr))
131- case o => println(o); ???
132- }
133-
134- def transform (pure : Pure )(using ShowContext ): Pure = pure match {
135- case ValueVar (id, annotatedType) => ValueVar (id, annotatedType)
131+ // TODO: We might need to do the same thing as in PureApp if we want to allow show(something) instead of something.show
132+ case ImpureApp (id, callee, targs, vargs, bargs, body) => ImpureApp (id, callee, targs, vargs, bargs, body)
136133 case o => println(o); ???
137134 }
138135
@@ -143,11 +140,9 @@ object Show extends Phase[CoreTransformed, CoreTransformed] {
143140 val targ = targs(0 )
144141 if (isGroundType(targ))
145142 val bvar = getOrAddShow(targ)
146- return Pure .PureApp (bvar, List .empty, vargs)
143+ return Expr .PureApp (bvar, List .empty, vargs)
147144 sys error " targ was not ground type in PureApp"
148145 case PureApp (b, targs, vargs) => PureApp (b, targs, vargs)
149- // TODO: We might need to do the same thing as in PureApp if we want to allow show(something) instead of something.show
150- case DirectApp (b, targs, vargs, bargs) => DirectApp (b, targs, vargs, bargs)
151146 case o => println(o); ???
152147 }
153148
@@ -221,15 +216,15 @@ object Show extends Phase[CoreTransformed, CoreTransformed] {
221216 // Literal("Just("), PureApp(show, x), Literal(", "), PureApp(show, y), Literal(")")
222217 // =>
223218 // PureApp(concat, List(Literal("Just("), PureApp(concat, List(PureApp(show, x), PureApp(concat, List(Literal(", "), ...))))
224- def concatPure (pures : List [Pure ])(using ctx : ShowContext ): Pure = pures match
219+ def concatPure (pures : List [Expr ])(using ctx : ShowContext ): Expr = pures match
225220 case head :: next :: rest => PureApp (ctx.infixConcatFn, List .empty, List (head, PureApp (ctx.infixConcatFn, List .empty, List (Literal (" , " , TString ), concatPure(next :: rest)))))
226221 case head :: Nil => PureApp (ctx.infixConcatFn, List .empty, List (head, Literal (" )" , TString )))
227222 case Nil => Literal (" )" , TString )
228223
229- def fieldValueVar (field : Field ): Pure = field match
224+ def fieldValueVar (field : Field ): Expr = field match
230225 case Field (id, tpe) => ValueVar (id, tpe)
231226
232- def fieldPure (field : Field )(using ctx : ShowContext ): Pure = field match
227+ def fieldPure (field : Field )(using ctx : ShowContext ): Expr . PureApp = field match
233228 case Field (id, tpe) => PureApp (ctx.showDefnsMap(List (tpe)), List .empty, List (ValueVar (id, tpe)))
234229
235230 def getOrAddShow (vt : ValueType )(using ctx : ShowContext ): BlockVar = vt match
0 commit comments