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

Deriving show doesn't parenthesize negative numbers #181

Open
arucil opened this issue Feb 15, 2019 · 0 comments
Open

Deriving show doesn't parenthesize negative numbers #181

arucil opened this issue Feb 15, 2019 · 0 comments

Comments

@arucil
Copy link

arucil commented Feb 15, 2019

When I define a data type with an integer member, the show_xx function doesn't add parenthesis around a negative integer member, hence I can't just copy the output and paste into my code to construct an identical value (I use this functionality to write tests).

For example, I wrote

type a = T of int [@@deriving show]

And invoke show_a (T (-20)), the output is (T -20).

By the way, I found Haskell's deriving Show handle negative integers correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant