-
Notifications
You must be signed in to change notification settings - Fork 105
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
Improve pretty printing #618
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
I have resurrected and fixed a roundtrip test. Please git pull
before git rebase/merge
! Thanks!
src/as_values/prim.ml
Outdated
let i = Conv.of_signed_Word32 (as_word32 v) | ||
in if i <= 0x10FFFF then k (Char i) else raise (Invalid_argument "codepoint out of bounds") | ||
let i = Conv.int_of_word32_u (as_word32 v) | ||
in if i < 0x110000 then k (Char i) else raise (Invalid_argument "character value out of bounds") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will cause a conflict with master
.
@@ -82,14 +81,6 @@ escape ch | '\\' `elem` show ch = "\\u{" <> hex (fromEnum ch) <> "}" | |||
escape '"' = "\\\"" | |||
escape ch = pure ch | |||
|
|||
prop_charToText (UTF8 char) = monadicIO $ do | |||
let testCase = "assert (switch (decodeUTF8 (charToText '" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll bring this test back soon (with t.chars().next()
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am working on it, may land in the branch soon.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done and pushed. Please pull before rebasing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, thanks!
Thanks for this! |
## Changelog for motoko-base: Branch: next-moc Commits: [dfinity/motoko-base@520ccf5d...712d0587](dfinity/motoko-base@520ccf5...712d058) * [`cba05e81`](dfinity/motoko-base@cba05e8) Publish on Mops ([dfinity/motoko-base#618](https://github.com/dfinity/motoko-base/issues/618)) * [`d81f5527`](dfinity/motoko-base@d81f552) Add commit hash to `matchers` dependency ([dfinity/motoko-base#621](https://github.com/dfinity/motoko-base/issues/621)) * [`c86d76ff`](dfinity/motoko-base@c86d76f) doc: update `List.mo` ([dfinity/motoko-base#616](https://github.com/dfinity/motoko-base/issues/616)) * [`4c2a90e7`](dfinity/motoko-base@4c2a90e) Fix compiler warning in `Array.take()` method ([dfinity/motoko-base#611](https://github.com/dfinity/motoko-base/issues/611))
## Changelog for motoko-base: Branch: next-moc Commits: [dfinity/motoko-base@520ccf5d...712d0587](dfinity/motoko-base@520ccf5...712d058) * [`cba05e81`](dfinity/motoko-base@cba05e8) Publish on Mops ([dfinity/motoko-base#618](https://github.com/dfinity/motoko-base/issues/618)) * [`d81f5527`](dfinity/motoko-base@d81f552) Add commit hash to `matchers` dependency ([dfinity/motoko-base#621](https://github.com/dfinity/motoko-base/issues/621)) * [`c86d76ff`](dfinity/motoko-base@c86d76f) doc: update `List.mo` ([dfinity/motoko-base#616](https://github.com/dfinity/motoko-base/issues/616)) * [`4c2a90e7`](dfinity/motoko-base@4c2a90e) Fix compiler warning in `Array.take()` method ([dfinity/motoko-base#611](https://github.com/dfinity/motoko-base/issues/611))
Various tweaks to our pretty printers:
debug_show
on empty arrays (would just show"]"
before)Side note: we have as many as 4 implementations of pretty-printing for values: in value.ml, in show.ml, in coverage.ml, and in prelude.as. Sigh.