Skip to content

Add support polykind for Quote from Prim.TypeError#4142

Merged
rhendric merged 3 commits intopurescript:masterfrom
xgrommx:fix-type-error-quote
Nov 17, 2021
Merged

Add support polykind for Quote from Prim.TypeError#4142
rhendric merged 3 commits intopurescript:masterfrom
xgrommx:fix-type-error-quote

Conversation

@xgrommx
Copy link
Copy Markdown
Contributor

@xgrommx xgrommx commented Jul 8, 2021

Previously Quote working only with kind Type. Now it will be support any kind

For Example

data X :: forall k. k -> Type
data X a

foreign import data MkX :: forall k. k -> X k

e = ("a" :: forall a. Fail (Beside (Text "Some problem with ") (Quote (MkX Number))) => String)

main = log e

Will be produce

  A custom type error occurred while solving type class constraints:

    Some problem with MkX @Type Number


A custom type error occurred while solving type class constraints:

Don't want to show Just @Type String because.
Copy link
Copy Markdown
Contributor

@hdgarrood hdgarrood Jul 9, 2021

Choose a reason for hiding this comment

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

I think we should probably strip the kind annotations out here (the @Type bit).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We still want to show them when --verbose-errors is set, right?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If we already decided on a strategy of showing kind annotations when verbose errors is on, then applying that same strategy here sounds good. I can’t remember whether that should be happening anyway; do the tests run with verbose errors on?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

As far as I can tell, in the only places we're currently erasing kind annotations in error messages, we do so conditional on verbose errors being off. I believe the tests don't run with verbose errors, which maybe makes testing that the erasure is conditional on verbosity difficult.

Also, it seems there are plenty of other places where we don't do this and perhaps should (just grep for @ in tests/**/*.out), which maybe makes dumping this request on this PR a little unfair? I agree that it should be done, but maybe we should clean this up holistically (and figure out how to test it robustly) in a separate PR.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ok, yes, that makes sense.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We don’t strip them in the error “trace” to aid debugging.

@hdgarrood hdgarrood dismissed their stale review July 9, 2021 06:16

Hiding kind annotations can happen separately.

@rhendric
Copy link
Copy Markdown
Member

@xgrommx, could you please:

  1. Rebase this on top of current master.
  2. Create a file in CHANGELOG.d for this change—it doesn't have to be more than a brief bullet point. (See CHANGELOG.d/README.md, after you've rebased.)

When that's squared away, we can merge!

@xgrommx
Copy link
Copy Markdown
Contributor Author

xgrommx commented Jul 14, 2021

@rhendric what do u mean about rebase?

@JordanMartinez
Copy link
Copy Markdown
Contributor

@xgrommx he means git rebase. We've changed how we handle the changelog (see #4132), so the rebase needs to occur so that you can add a file in that directory.

git fetch upstream
git rebase upstream/master fix-type-error-quote
# add a file to CHANGELOG.d (see its README.md)
# to document this change

@JordanMartinez
Copy link
Copy Markdown
Contributor

@xgrommx Any updates on this?

@xgrommx
Copy link
Copy Markdown
Contributor Author

xgrommx commented Jul 24, 2021

@JordanMartinez sorry I was in vacation.

@xgrommx
Copy link
Copy Markdown
Contributor Author

xgrommx commented Jul 24, 2021

It's ok?

purescript-2:fix-type-error-quote* λ git fetch origin
purescript-2:fix-type-error-quote* λ git rebase origin/master fix-type-error-quote
Current branch fix-type-error-quote is up to date.
purescript-2:fix-type-error-quote* λ

@JordanMartinez
Copy link
Copy Markdown
Contributor

JordanMartinez commented Jul 25, 2021

@xgrommx Ah, no worries about that. I hope you enjoyed your vacation!

Your example above is fetching data from origin (i.e. your fork of purescript), not upstream (i.e the actual purescript repo). Similarly, it's rebasing against your fork's master branch, not the purescript repo's master branch.

Below is what I get when I run git remote -v, What do you get when you run that?

$ git remote -v
origin	git@github.com:JordanMartinez/purescript.git (fetch)
origin	git@github.com:JordanMartinez/purescript.git (push)
rh	git@github.com:rhendric/purescript.git (fetch)
rh	git@github.com:rhendric/purescript.git (push)
upstream	https://github.com/purescript/purescript.git (fetch)
upstream	https://github.com/purescript/purescript.git (push)

@JordanMartinez
Copy link
Copy Markdown
Contributor

Rather than rebasing on master, I merged with master and added a changelog entry. I haven't tested this out, but I assume CI should still pass.

@rhendric rhendric merged commit 6b2b2a9 into purescript:master Nov 17, 2021
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

Successfully merging this pull request may close these issues.

5 participants