Currently, when I run pedant compile example/tests.ped I get the following result:
id = x -> EVariable "x" ∀x0. type<x0>->type<x0>
addOne = x -> EBinOp "+" (EVariable "x") (EConstant (ExecutionValueNumber 1.0)) dimensionless->dimensionless
addOneUsd = x -> EBinOp "+" (EVariable "x") (EConstant (ExecutionValueNumber 1.0)) usd->usd
testVar = 1000.0 dimensionless
testId = 1000.0 dimensionless
testAddOne = 1001.0 dimensionless
dict = {x=1.0, y=2.0} {x:dimensionless,y:dimensionless}
val = 1.0 dimensionless
getX = d -> EAccess (EVariable "d") "x" ∀a19. {|x:type<a19>}->type<a19>
val2 = 1.0 dimensionless
The one thing that sticks out like a sore thumb is that functions are printed really poorly, just using the default "show" on an evaluation expression tree. It would be wonderful if this these execution expressions could be pretty printed to make them easier to read.
A simple solution would be to implement PrettyPrint on NumericValue and ExecutionExpression within src/Types.hs. Then use pPrint value instead of show value in src/Pedant.hs when printing expressions.
Currently, when I run
pedant compile example/tests.pedI get the following result:The one thing that sticks out like a sore thumb is that functions are printed really poorly, just using the default "show" on an evaluation expression tree. It would be wonderful if this these execution expressions could be pretty printed to make them easier to read.
A simple solution would be to implement
PrettyPrintonNumericValueandExecutionExpressionwithinsrc/Types.hs. Then usepPrint valueinstead ofshow valueinsrc/Pedant.hswhen printing expressions.