Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pretty Printing evaluation expressions. #9

Open
Hazelfire opened this issue Dec 20, 2021 · 0 comments
Open

Pretty Printing evaluation expressions. #9

Hazelfire opened this issue Dec 20, 2021 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@Hazelfire
Copy link
Owner

Hazelfire commented Dec 20, 2021

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.

@Hazelfire Hazelfire added enhancement New feature or request good first issue Good for newcomers labels Dec 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant