Skip to content

Pretty Printing evaluation expressions. #9

Description

@Hazelfire

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions