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

Adds :kind and :kind! commands to Eval Plugin #345

Merged
merged 7 commits into from
Aug 26, 2020
Merged

Adds :kind and :kind! commands to Eval Plugin #345

merged 7 commits into from
Aug 26, 2020

Conversation

konn
Copy link
Collaborator

@konn konn commented Aug 21, 2020

This pull request implements :kind and :kind! commands ala GHCi to Eval plugin.
The former displays the kind of a given type and the latter also displays the normalised form of a given type.

Examples

-- >>> type N = 1
-- >>> type M = 40
-- >>> :kind N + M + 1

evaluates to:

-- >>> type N = 1
-- >>> type M = 40
-- >>> :kind N + M + 1
-- N + M + 1 :: Nat

And

-- >>> type N = 1
-- >>> type M = 40
-- >>> :kind! N + M + 1

evaluates to:

-- >>> type N = 1
-- >>> type M = 40
-- >>> :kind! N + M + 1
-- N + M + 1 :: Nat
-- = 42

@konn konn changed the title Adds an :kind and :kind! commands to Eval Plugin Adds :kind and :kind! commands to Eval Plugin Aug 21, 2020
Copy link
Member

@Ailrun Ailrun left a comment

Choose a reason for hiding this comment

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

Thank you for the contribution!

import Data.Proxy
import Data.Proxy (Proxy(..))

type P = Proxy
Copy link
Member

Choose a reason for hiding this comment

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

Could you let me know why have you changed this test? It seems irrelevant to me.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, that change is not directly related to my change; but without this hack, at least on my laptop, Applies file LANGUAGE extensions test case fails due to the interference with import lens.
This issue seems already existent in the master branch and I wanted to avoid such errors to make my pull-request get merged as soon as possible. Indeed, I once wondered if I should make this change in this pull-request but I decided to include it since it's a minor change and somewhat related to Eval plugin.

But, yes, this change is semantically separate from this pull-request. Should I file this workaround as another pull-request?

Copy link
Member

@Ailrun Ailrun Aug 22, 2020

Choose a reason for hiding this comment

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

I think it is worthwhile to post that as an issue, but for the separated PR, it's OK to stay this change as-is.

src/Ide/Plugin/Eval.hs Outdated Show resolved Hide resolved
Copy link
Member

@Ailrun Ailrun left a comment

Choose a reason for hiding this comment

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

LGTM :)

@Ailrun Ailrun requested a review from pepeiborra August 22, 2020 01:45
Copy link
Collaborator

@pepeiborra pepeiborra left a comment

Choose a reason for hiding this comment

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

Looks good, nice!

@konn
Copy link
Collaborator Author

konn commented Aug 26, 2020

What does block this to be merged?

@pepeiborra pepeiborra merged commit 60b28b0 into haskell:master Aug 26, 2020
@konn
Copy link
Collaborator Author

konn commented Aug 26, 2020

Thanks!

pepeiborra pushed a commit to pepeiborra/ide that referenced this pull request Sep 6, 2020
* Implements `:kind!` GHCi command to Eval plugin

* Adds golden tests for `:kind!`

* Removes redundant lines

* Adds `:kind` command that returns kind only without normalisation

* Test cases for `:kind`

* Fixes `Applies file LANGUAGE extensions` to avoid sufferring from ImportLens

* Removes redundant leading space
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.

3 participants