Comments (3)
What I always liked about =
comparing to ===
is that it has a presedence lower than even infix 0
, hence the clean look for function signatures that serve as properties of equality. Current infix 6
is okay for ===
meaning an alternative comparison function to ==
, but propositional equality type plays a different role.
= as a symbol for propositional equality has the benefit of being easy to type and easy to read for newcomers
I don't feel myself a newcomer, but I personally still find =
much easier to read than ===
in most of the cases.
Another downside of ===
being the only standard operator for propositional equality is that ===
operator is used not only for the propositional equality, for instance it is used for equality-based checks in propety-based testing libraries.
You considered the only alternative of doing nothing. In the motivation section (along with unique presedence of =
, which I really like) you mention ambiguity problem. I can propose an alternative solution alternative to yours one: instead of removing =
in favor of explicit ~=~
and ===
, we can consider removing only ambuguous semantics of =
, say, sticking it to ===
, since this is the most used case for it.
from idris2.
What I always liked about = comparing to === is that it has a precedence lower than even infix 0
I also like this, and experimented with the compiler to make =
a proper operator with precedence -1
and that seemed to work. I think it would be a reasonable change to make (===)
have a compiler-only precedence (like -1
), but I wasn't sure if that was something that the people really want, or need. I'd love for more people to chime in on that topic.
Another downside of === being the only standard operator for propositional equality is that === operator is used not only for the propositional equality, for instance it is used for equality-based checks in propety-based testing libraries.
Not a problem with the new fixity namespace features. The compiler can detect if there is a conflicting fixity and generate the appropriate program if necessary. In this instance it would mean hiding the built-in fixity for (===)
and calling equality in application position (Builtin.(===) a b)
.
I can propose an alternative solution alternative to yours one: instead of removing = in favor of explicit
=and ===
I think that's a great idea, however it does not really address the upgrade path problem which is the main body of this proposal. We would still need to provide a way to upgrade without breaking existing code-bases. Like mentionned at the end: we don't really have to, but that's the essence of this proposal, to do something nice while learning something on the way there. I know we have a lot of issues right know with code synthesis and this would be a great time to review the infrastructure around it.
from idris2.
I can propose an alternative solution alternative to yours one: instead of removing = in favor of explicit = and ===
I think that's a great idea, however it does not really address the upgrade path problem
I can see it as being a drop-in idea for the end-goal with your proposed solution for migration still being applicable. I think I like the idea of =
remaining equivalent to ===
(possibly modulo precedence, though I didn't know they had different precedence and I am not sure I think that specific point is a benefit). I also like the idea of offering code actions that desugar various kinds of things.
The desugar code action initially seemed of arguable use to me outside of this very specific migration need, but the more I think on it the more I can imagine situations where lifting a with
block into a standalone helper function could indeed be desirable.
I saved this for last because it is a bit "sunk-cost-ty" but I'm in favor of past work that served to differentiate e.g. assignment from equality by introducing :=
so we have in some areas already begun to narrow in on =
being used for equality; this would seem to make those distinctions unnecessary and a bit of a bummer from the perspective of wanting =
to be useful for something. Of course, =
would still be used for function clauses, but regardless I don't think we have ambiguity problems between the equals of function clauses and the equals of an equality.
from idris2.
Related Issues (20)
- Type checker does not terminate when comparing codata types. HOT 2
- Failure to eliminate pattern case when matching by type HOT 3
- `unsafePerformIO` can be optimized out HOT 4
- Overly eager auto implicit in GADT ctor field's type results in typechecking failure
- Source file "Main.idr" is not in the source directory when invoking compiler with `--source-dir` HOT 2
- [ regression ] `Uninhabited (LTE 1 0)` will no longer be found HOT 2
- `idris2 --init` doesn't check a name of a package
- Totality checker fails to recognize missing cases on irrelevant parameter in irrelevant function HOT 1
- Regression in #3234, backticked infix operators are printed incorrectly HOT 1
- Postfix functions are parsed as if inside unquote when are right after unquote HOT 1
- Remove 'Closed' state from linear network API
- Type checking issue with Idris2 Load instruction in dependent context HOT 1
- Fedora FC38, FC39 with racket 7.9 — "make bootstrap-racket" freezes on compilation HOT 2
- No Nested ":" allowed? HOT 5
- FFI: segfault for conflicting names in C++
- Doc: "Multiplicities" section roadmap HOT 7
- [ bug ] Buggy `Data.Fin.fromInteger` in the presence of negative integer literals HOT 1
- Type information is lost/changed when inlining a function (and it's not clear why) HOT 5
- Inconsistency in totality checker with different constants values and representations
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from idris2.