-
Notifications
You must be signed in to change notification settings - Fork 237
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
Needing to import Data.Integer.Base (pos) for an instance for ℚ.positive ½ is unintuitive #1878
Comments
|
@jamesmckinna that lets me define a proof, but doesn't get the instance into scope, which is what I wanted |
Is the objection to widening the import list from |
I was writing a something using rational numbers, when I made this issue (almost a year ago so I may be a little hazy on the details). I had a function that needed an instance I believe the solution to this would be to make |
Yes, I see. (Now). One 'problem'/'issue' with the current So there's a (possible) refactoring/redesign opportunity (a version of which would be your rebinding of Offering a low(er?)-energy solution, why not (appropriately) specialise |
So, I tried writing the following in -- Instances
instance
pos-/ : ∀ {n} {d} → .{{_ : ℕ.NonZero n}} → .{{_ : ℕ.NonZero d}} → Positive (+ n / d)
pos-/ {n = suc _} = _ where instance _ = ℤ.posℕ {n = n} and was surprised by two things:
There's a separate problem, which I don't understand, about whether the typechecker can correctly unfold |
For the exact above code (agda: v2.6.3; stdlib: master) does anyone else get the same (anomalous) typechecking behaviour as I do? |
Re: |
Best solution I think is just to have the |
I don't really understand the instance mechanics so I don't know what the right solution is here, but can we re-export or wrap
pos
(andneg
etc) from Data.Rational.Base and Data.Rational.Unnormalised.Base?The text was updated successfully, but these errors were encountered: