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

Discussion: instance argument candidates from the context #1716

Closed
UlfNorell opened this issue Nov 10, 2015 · 6 comments
Closed

Discussion: instance argument candidates from the context #1716

UlfNorell opened this issue Nov 10, 2015 · 6 comments
Labels
instance Instance resolution type: enhancement Issues and pull requests about possible improvements
Milestone

Comments

@UlfNorell
Copy link
Member

Currently any variable in the context is available for instance search, so you can define things like

foo : {A : Set} (eqA : Eq A) → A → A → Bool
foo eqA x y = isYes (x == y)

My question is this: are there cases where you need this, or could we restrict instance search to only consider variables from the context that are themselves instance arguments?

There are two reasons why I think this would be desirable

  • it mirrors the treatment of top-level instances (only things declared instance are considered)
  • there can be very many things in the context, making instance search slow
@UlfNorell UlfNorell added type: enhancement Issues and pull requests about possible improvements instance Instance resolution labels Nov 10, 2015
@jespercockx
Copy link
Member

AFAIK there is currently no way to declare an instance in a telescope. What would be a sensible syntax for it? Maybe something like this:

foo : instance {A : Set} → Set
foo = it

I also think that all instance arguments in the telescope should be considered instances automatically, otherwise passing around instance arguments could become very painful.

@UlfNorell
Copy link
Member Author

My suggestion is that only instance arguments in the context are considered for instance search, not that nothing from the context is considered. In your example you would have to say

foo : {{A :Set}} → Set

@jespercockx
Copy link
Member

I see, in that case I am in favor of this proposal.

@andreasabel
Copy link
Member

I cannot judge the consequences of this, but a cautious agreement to your proposal from me.

@np
Copy link
Contributor

np commented Nov 10, 2015

What about module parameters?

On 11/10/2015 03:20 PM, Ulf Norell wrote:

My suggestion is that only instance arguments in the context are
considered for instance search, not that nothing from the context is
considered. In your example you would have to say

|foo : {{A :Set}} → Set |


Reply to this email directly or view it on GitHub
#1716 (comment).

Best regards,
-- NP

@UlfNorell
Copy link
Member Author

The same rules would apply to module parameters (obviously).

@asr asr added this to the 2.4.4 milestone Feb 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
instance Instance resolution type: enhancement Issues and pull requests about possible improvements
Projects
None yet
Development

No branches or pull requests

5 participants