Skip to content

TypeLevelString/TypeConcat should not be quoted#2586

Merged
hdgarrood merged 3 commits intopurescript:masterfrom
michaelficarra:GH-2568
Jan 20, 2017
Merged

TypeLevelString/TypeConcat should not be quoted#2586
hdgarrood merged 3 commits intopurescript:masterfrom
michaelficarra:GH-2568

Conversation

@michaelficarra
Copy link
Copy Markdown
Contributor

Fixes #2568. No tests, but I manually confirmed by compiling examples/warning/CustomWarning.purs. Before this change, the warning would be quoted. After, it is not. If you want me to add a test, let me know how it should be done.

@hdgarrood
Copy link
Copy Markdown
Contributor

It would of course be nice to test this, but I don't think we have a good way of testing error messages with the current test suite, so I'm inclined to leave it without tests for now.

@hdgarrood
Copy link
Copy Markdown
Contributor

What happens if you have a Warn constraint with a type level string which contains lone surrogates?

@michaelficarra
Copy link
Copy Markdown
Contributor Author

@hdgarrood It will just print the type like any other.

Changing line 4 of examples/warning/CustomWarning.purs to

foo :: forall t. Warn (TypeConcat "Custom warning \xD800 " (TypeString t)) => t -> t

results in

A custom warning occurred while solving type class constraints:

    TypeConcat "Custom warning \55296 " (TypeString Int)

If you'd like, we could print it instead using Unicode replacement characters or omitting the lone surrogates. Additionally, TypeConcat on a lone high surrogate and lone low surrogate will not result in a surrogate pair, but that doesn't bother me so much. We could also fix that if you'd really like.

Copy link
Copy Markdown
Contributor

@hdgarrood hdgarrood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, as long as it doesn't do anything like producing an internal error I'm happy. LGTM 👍

@michaelficarra
Copy link
Copy Markdown
Contributor Author

@hdgarrood I went ahead and pushed an additional commit to add support for combining lone surrogates into surrogate pairs and using the Unicode replacement character when attempting to print lone surrogates.

This type:

foo :: forall t. Warn (TypeConcat (TypeConcat "Custom warning \xD834" "\xDF06 ") (TypeString t)) => t -> t

now prints

A custom warning occurred while solving type class constraints:

  Custom warning 𝌆 Int

Please review again.

@michaelficarra michaelficarra force-pushed the GH-2568 branch 3 times, most recently from 5c2a698 to efd8759 Compare January 20, 2017 17:23
@hdgarrood
Copy link
Copy Markdown
Contributor

Now that we have a use for it, I think I'd rather export a new function from the module which defines PSString rather that implementing it in terms of decodeStringEither here. Also if memory serves correctly, isn't the replacement character U+FFFD, not U+FFEF?

@michaelficarra
Copy link
Copy Markdown
Contributor Author

@hdgarrood I can do that. Also, yes, that was a mistake which I've already corrected.

@michaelficarra
Copy link
Copy Markdown
Contributor Author

@hdgarrood See 5dda947.

@paf31
Copy link
Copy Markdown
Contributor

paf31 commented Jan 20, 2017

👍 LGTM, thanks!

@hdgarrood
Copy link
Copy Markdown
Contributor

Looks great, would you mind resolving the conflicts and then I think we can merge this?

@michaelficarra
Copy link
Copy Markdown
Contributor Author

Rebased.

@michaelficarra
Copy link
Copy Markdown
Contributor Author

Hmm, I'm not sure why Appveyor has failed or why Travis is seemingly stuck forever without starting any builds. I'll try just amending and force-pushing to restart everything.

@hdgarrood
Copy link
Copy Markdown
Contributor

That's weird. Do the tests pass locally for you?

@michaelficarra
Copy link
Copy Markdown
Contributor Author

@hdgarrood Yes. On both of my development machines (Fedora and macOS).

@hdgarrood
Copy link
Copy Markdown
Contributor

In that case I'm tempted to just go ahead and merge this, what do people think?

@paf31
Copy link
Copy Markdown
Contributor

paf31 commented Jan 20, 2017

Sounds good.

@hdgarrood
Copy link
Copy Markdown
Contributor

Thanks @michaelficarra!

@hdgarrood hdgarrood merged commit bfb255d into purescript:master Jan 20, 2017
@hdgarrood hdgarrood deleted the GH-2568 branch January 20, 2017 23:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants